More Info:
Allowing outside collaborators admin or push access to organization repositories places the organization at risk from non-member contributions that can be pushed without review.Risk Level
MediumAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are step‑by‑step instructions to remediate the issue of an Outside Collaborator having Admin access in GitHub using only the GitHub web console (GUI).
If you tell me whether the collaborator should keep some access or be fully removed, I can give you a minimal‑change set of clicks tailored to that scenario.
1. Confirm who the outside collaborator is
- Sign in to GitHub.
- Go to your Organization:
https://github.com/organizations→ click your org. - In the org, click People (top menu).
- Click the Outside collaborators tab.
- This shows all users who are not organization members but have access to one or more repos.
2. Check and adjust their repository permissions
- In Outside collaborators, find the user in question.
- On the right of their row, click … (three dots) → Manage access
(or click their name, then Repositories under their profile within the org). - You will see list of repositories they can access and their permission level for each (Read / Triage / Write / Maintain / Admin).
- Click the dropdown showing Admin.
- Choose one of:
- Write (if they still need contribute rights), or
- Read (if they only need to view), or
- Remove from repository (to revoke access completely).
3. (Preferred) Convert them to an organization member, then restrict
If the person is trusted and should be an ongoing collaborator, it is safer to:- In the organization, go to People → Outside collaborators.
- Find the user → click … → Convert to member.
- Choose:
- A Team that gives them appropriate least‑privilege access, or
- No default access, and then grant repo access explicitly with only the permissions they need (not Admin, unless absolutely required).
4. Remove outside collaborator status if not needed
If they should no longer have any access:- In People → Outside collaborators, find the user.
- Click … → Remove from organization (or Revoke access depending on UI version).
- Confirm removal.
- This removes all of their repository access within the organization.
5. Optional: Prevent overuse of Admin via repository settings
For each high‑value repository:- Go to the repo → Settings → Collaborators and teams (or Manage access).
- Review all collaborators:
- Downgrade any Admin users who do not truly need full control to Maintain, Write, or Read.
- Consider using teams instead of individual Admin roles and limit who can be Admin at the org level.
If you tell me whether the collaborator should keep some access or be fully removed, I can give you a minimal‑change set of clicks tailored to that scenario.
Using CLI
Using CLI
Below are concise, step‑by‑step remediation options using the GitHub CLI (
This returns outside collaborators with
Other valid values:
Ensure no outside collaborator has
gh) to fix an outside collaborator with admin access.Assumptions:- You’re an org owner or have admin rights on the repo.
ghis already installed.
1. Authenticate GitHub CLI (if not already)
2. Identify outside collaborators with admin access on a repo
ReplaceORG, REPO with your values.admin permissions on that repo.3. Option A – Downgrade their permissions on the repo
Example: change fromadmin → maintain (or push for write only).pull, triage, push, maintain, admin.Repeat for each user/repo combination where you find admin access.4. Option B – Completely remove them from the repo
5. (Optional) Remove them as an outside collaborator at org level
If you want to revoke all access they have as an outside collaborator:List all outside collaborators in the org
Remove a user as an outside collaborator
6. Verify remediation
Re-check permissions on the repo:"admin": true anymore.Using Python
Using Python
Below is a concise, step‑by‑step way to remediate “outside collaborator as admin” in GitHub using Python (via the GitHub REST API or PyGithub).Assumptions:
4. Using Raw REST API with
Install:
If you tell me your target policy (remove vs downgrade vs convert to member), I can give you a single ready‑to‑run Python script that applies it across your entire org.
- You have a GitHub Personal Access Token (classic or fine‑grained) with
admin:organdreposcopes. - You know:
ORG_NAME– your GitHub orgREPO_NAME– the affected repoCOLLAB_USERNAME– the outside collaborator currently withadminrights
1. High‑Level Remediation Plan
- Detect outside collaborators with admin access.
- For each:
- Either:
- Convert them to org member (invite to org) and lower repo permission (e.g., to
pushorpull), or - Remove them from the repo entirely.
- Convert them to org member (invite to org) and lower repo permission (e.g., to
- Either:
- Enforce that no outside collaborator has
adminpermission going forward.
2. Using PyGithub (Recommended)
2.1. Install and set up
2.2. Detect if user is an outside collaborator with admin
2.3. Option A – Downgrade permission (keep as outside collaborator, but not admin)
2.4. Option B – Invite to org, then set appropriate permission
2.5. Option C – Remove from repo entirely
3. Bulk Remediation for All Repos / All Outside Collaborators
4. Using Raw REST API with requests (if you don’t want PyGithub)
Install:4.1. Check if user is org member
4.2. Check collaborator permission on a repo
4.3. Downgrade permission
4.4. Remove collaborator
4.5. Invite user to org
If you tell me your target policy (remove vs downgrade vs convert to member), I can give you a single ready‑to‑run Python script that applies it across your entire org.
Using Terraform
Using Terraform
terraform plan should show the github_repository_collaborator (or the existing one for this user/repo) changing permission from "admin"/"push" to "pull".
