Organizations, Teams, Roles, Repository Access, Enterprise Policies, and Delegated Administration: Diagnostics, Failure Modes, Security, and Performance
Diagnose retained access, nested-team inheritance, broad ownership, base-permission surprises, and enterprise-policy conflicts with evidence-first, least-destructive corrections.
Learning objectives
- Apply an evidence-first diagnostic sequence to access incidents.
- Find hidden access through second teams, parent-team inheritance, direct grants, and base permissions.
- Separate local organization limitations from enterprise-enforced policy.
- Treat ownership/transfer, token/key handling, and privilege elevation as security-sensitive operations.
- Repair an intentionally broken offboarding scenario without broad destructive changes.
1. Diagnostic sequence: evidence before revocation guesses
When access looks wrong, use one sequence: preserve evidence → identify repository/org/account/ref/workflow/artifact scope → enumerate every access source → inspect permissions/settings/rules/audit/API responses → choose the least destructive correction → verify effective access again. Do not “fix” access by deleting repositories, rotating unrelated credentials, or making another person owner.
2. Failure: offboarded user retains access through a second path
Suppose devon was removed from
app-engineering but still writes app-api.
Preserve the original access review output. Inspect direct grants,
every team membership, nested parent grants, organization roles, and
base permission. In the local fixture, add a second team:
"support-escalation": {"parent": null, "repos": {"app-api":"write"}}
If Devon remains a member of support-escalation, the
first team removal was correct but incomplete. The least destructive
correction is to remove the stale second membership, not reduce
repository permissions for everyone. Then rerun the effective-access
evaluator and preserve the before/after evidence.
3. Failure: nested-team inheritance grants more than expected
A child team can inherit all repository grants from every ancestor. If a security-specialist child is moved under a broad Engineering parent with Write across application repositories, that hierarchy change is an authorization change. GitHub warns about repository access when moving teams for this reason.
Repair by changing the parent team's overly broad grant, moving the child to the intended parent, or redesigning hierarchy so parent permissions are safe for every descendant. Do not try to “deny” one child while preserving a stronger inherited parent grant; GitHub permission grants are additive rather than explicit-deny ACLs.
4. Failure: too many organization owners erase separation of duties
If CI admins, security analysts, release engineers, and billing contacts are all owners, every specialist can perform unrelated high-impact operations. There may be no technical evidence distinguishing routine authority from emergency authority. Inventory owners and map each person's actual tasks to narrower repository/team/predefined/custom roles. Retain at least the continuity owners GitHub recommends, but demote unnecessary owners only through a planned, verified change.
5. Failure: base permission creates surprising effective access
A user has no team grant to security-policy but can
still read it. If the base permission is Read, this is expected for
organization members. Changing the repository's team grants will not
remove the base grant. Correct the organization base permission only
if the organization's intended policy is different, because changing
it affects all existing and future members.
For internal repositories in Enterprise Cloud, even base
None does not mean enterprise members lose internal
visibility. Diagnose repository visibility before treating read
access as a permission leak.
6. Failure: enterprise policy overrides organization settings
An organization owner sees a setting disabled or a REST request rejected and assumes the token lacks scope. Before creating a broader token, check whether the organization belongs to an enterprise with enforced repository, Actions, security, or identity policy. Enterprise owners can define policy that organizations cannot weaken. Under managed users or synchronized teams, the IdP may be authoritative.
The correction is made at the layer that owns the policy—or the organization accepts the inherited constraint. A local workaround that broadens credentials cannot override an enterprise policy and usually increases risk.
7. Intentionally broken offboarding: interpret, do not hide the cause
Use this synthetic state after “offboarding”:
"devon": {
"active": true,
"relationship": "member",
"teams": ["support-escalation"],
"direct": {"release-ops":"maintain"}
}
The evaluator returns non-none roles. That output is
the failure evidence. Do not delete it and replace it with a clean
screenshot. Record each source, remove the stale team membership,
remove the expired direct grant, then mark the identity
inactive/removed in the simulator. The final verification must show
none for all repositories. In a live organization,
separately verify organization membership/collaborator state and all
repository/team paths.
8. Security-sensitive actions and causal risks
| Action | Why sensitive | Safer chapter posture |
|---|---|---|
| Promote/demote organization owner | Full control or possible lockout | Fixture or disposable org; continuity preflight |
| Transfer repository | Changes ownership, URLs, policies, access | Explain only; not required |
| Change base permission | Impacts every member and repository | Model locally; optional disposable org |
| Create token/key | Creates credential with independent lifecycle | Not required; reuse current gh auth for read-only inspection |
| Force-update branch/history | Unrelated destructive ref rewrite | Never used for access repair |
| Delete organization/repository | Data and governance destruction | Excluded from mandatory cleanup |
9. Reliability and scale: permissions are cached understanding, not static truth
Large organizations can have thousands of membership and repository edges. Avoid N×M API polling when a targeted access review can use team/repository inventories, pagination, audit evidence, or enterprise identity sources. Chapter 26's pagination/rate-limit practices apply. Chapter 27's event-driven patterns can notify a governance service of membership/repository changes, but periodic reconciliation is still needed because event loss, enterprise changes, and external IdP updates can occur.
Knowledge check
A user still has Write after removal from one team. What should you inspect next?
All other team memberships including parent-team inheritance, direct repository grants, organization-wide roles, base permission, and enterprise/internal visibility. Effective access is additive.
Why is lowering repository team access not always the right repair for one user?
It may revoke legitimate access from every team member while leaving the user's other grant path intact. Remove the stale source of that user's access instead.
An organization owner cannot change a setting. Why is creating a broader PAT a poor first response?
The control may be enterprise-enforced or IdP-authoritative. Broader credentials do not override policy and expand credential risk.
Why can an internal repository remain readable when base permission is None?
Internal visibility is an enterprise-account model that grants enterprise members broad read visibility independent of ordinary organization base permission.
What evidence proves offboarding in the fixture?
A preserved before state showing the access sources, recorded removals of every stale source, and a final evaluator result of none for every repository while the synthetic identity is inactive.
Summary
Access diagnosis is source tracing. Hidden second teams, parent inheritance, direct exceptions, base permission, internal visibility, and enterprise policy can all explain “surprising” access. Preserve the original evidence, repair the narrow cause at its authoritative layer, and independently verify effective access rather than relying on the success message from one removal.
Official references
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0
Send only Ethereum/ERC-20 compatible assets to this
address.