Checkpoint Lab — Users, Groups, Permissions, Tokens, Authentication, and Authorization
Produce a two-team least-privilege RBAC matrix, prove permitted and denied actions with scoped identities, revoke credentials, and package independent audit evidence.
Learning objectives — Checkpoint objectives
- Build and document a two-team least-privilege RBAC matrix on disposable Community Build.
- Predict the effective authorization results before executing them.
- Prove positive and negative scanner/API outcomes with bounded identities.
- Demonstrate the impact of the default global Execute Analysis grant and repair it safely in the lab.
- Revoke credentials, verify access failure, and restore the original global state.
- Produce an evidence packet that a reviewer can replay without seeing any token values.
1. Checkpoint scenario
You administer a disposable local SonarQube instance used by two synthetic teams, Alpha and Beta. Each team should browse/source-view/analyze only its own private project. Neither routine user is an administrator. CI uses project-analysis tokens; read-only API verification uses limited user tokens.
Your task is to prove the matrix, intentionally expose one broader inherited permission, repair it, prove revocation, and restore the initial server state.
2. Exact assumptions and prerequisites
| Assumption | Checkpoint value |
|---|---|
| SonarQube | Community Build 26.9.0.129388 |
| Scanner | SonarScanner CLI 8.1.0.6389 |
| Authentication | Built-in local users for mandatory path; forced authentication remains enabled |
| Database/plugins/CI/IdP | No change required; external identity is intentionally deferred to Chapter 22 |
| Projects |
sq-ch21-alpha-app,
sq-ch21-beta-app, private
|
| Groups |
sq-ch21-alpha-devs,
sq-ch21-beta-devs
|
| Tokens | Short-lived project-analysis + limited user tokens; values never enter evidence |
3. Write the intended RBAC matrix before configuration
| Identity | Alpha project | Beta project | Global admin |
|---|---|---|---|
| sq21-alpha / alpha-devs | Browse, Source, Execute Analysis | None | None |
| sq21-beta / beta-devs | None | Browse, Source, Execute Analysis | None |
| Lab administrator | Administrative setup only | Administrative setup only | Administer System |
Also record the actual initial global Execute
Analysis state for sonar-users. The desired final
rollback state is whatever you observed initially—not what you
remember the default to be.
4. Predictions before mutation
-
Prediction A: while
sonar-usersstill has global Execute Analysis, both authenticated users may be able to analyze either project despite narrow project templates. - Prediction B: after removing that global grant in the disposable lab, Alpha will analyze Alpha but not Beta; Beta will analyze Beta but not Alpha.
- Prediction C: Alpha’s limited user token will read Alpha’s private measures but will not gain Beta Browse permission.
- Prediction D: revoking Alpha’s project-analysis token will make the same Alpha scan fail without changing source, project key, gate, profile, or template.
- Prediction E: restoring the original global grant during cleanup changes authorization state but does not rewrite earlier analysis/task evidence.
5. Setup and preflight evidence
- Capture server/scanner versions.
- Capture Global Permissions, Users, Groups, Permission Templates, and default visibility.
- Create the two local users/groups and record memberships.
- Create Alpha/Beta permission templates with key regexes and project grants.
- Create the two private projects and verify template assignment.
- Create source fixtures and record Git SHAs.
- Create short-lived project-analysis and user tokens under the limited users.
mkdir -p evidence/ch21/{preflight,alpha,beta,deny,revocation,rollback}
curl -fsS "$SONAR_HOST_URL/api/system/status" > evidence/ch21/preflight/system-status.json
sonar-scanner --version 2>&1 | tee evidence/ch21/preflight/scanner-version.txt
printf 'alpha_sha=%s\n' "$(git -C sq-ch21-rbac/alpha rev-parse HEAD)" > evidence/ch21/preflight/revisions.txt
printf 'beta_sha=%s\n' "$(git -C sq-ch21-rbac/beta rev-parse HEAD)" >> evidence/ch21/preflight/revisions.txt
6. Execute the allow/deny proof
Run these evidence cases without changing the source revisions:
| Case | Expected after global grant is removed | Evidence |
|---|---|---|
| Alpha token → Alpha scan | Allowed | scanner log, report-task, ceTaskId, CE terminal status |
| Alpha token → Beta scan | Denied | first scanner error + nonzero exit |
| Beta token → Beta scan | Allowed | scanner log, report-task, ceTaskId, CE terminal status |
| Beta token → Alpha scan | Denied | first scanner error + nonzero exit |
| Alpha user token → Alpha private measures | Allowed | HTTP status/body + expiration header if returned |
| Alpha user token → Beta private measures | Denied/hidden according to endpoint semantics | Actual status/body, plus admin-side proof Beta exists |
7. Deliberate mistake: prove the default global grant can defeat isolation
If the initial state had global Execute Analysis on
sonar-users, preserve one cross-team scan result
before removing it. That is the deliberate broken
state. Record:
- Alpha’s membership in
sonar-users; - the global Execute Analysis grant;
- absence of Alpha’s Beta project-level grant;
- the surprising successful cross-team scan.
Then remove only that global grant, rerun the same revision/project/token pair, and preserve the denial. This is a causal authorization experiment.
8. Revoke and independently verify
Revoke Alpha’s project-analysis token. Repeat Alpha→Alpha scan and require nonzero exit. Revoke Alpha’s user token. Repeat the read-only Alpha API request and preserve the authentication failure/validation result.
revocation record:
owner: sq21-alpha
token type: project analysis / user
associated project (if applicable): sq-ch21-alpha-app
expiration originally selected:
revoke timestamp:
known consumers updated/removed:
post-revoke verification command:
post-revoke result:
token value: NEVER RECORDED
9. Required evidence packet
-
assumptions.md: release, scanner, auth source, edition limits, no external IdP/CI requirement. - Before/after global-permission records.
- User/group membership matrix and permission-template definitions.
- Private project visibility and project-permission records.
- Token metadata: owner/type/expiration/consumer/revocation—never token values.
- Alpha/Beta Git SHAs and effective scanner project keys.
-
Allowed scanner logs +
report-task.txt+ceTaskId+ CE results. - Denied cross-team scanner/API evidence.
- Revoked-token failure evidence.
- Rollback proof showing original global permission state restored.
- Limitations note: Community Build lab uses built-in identities; externally synchronized identity is covered next chapter.
10. Verification checklist
-
☐ Neither sample user is in
sonar-administrators. - ☐ Alpha and Beta permissions originate from intended groups/templates, not undocumented direct grants.
- ☐ Private visibility is independently verified.
- ☐ Global Execute Analysis initial and modified states are preserved.
- ☐ Positive and negative analysis tests were executed at exact recorded SHAs.
-
☐
ceTaskIdis preserved for successful analyses. - ☐ API evidence distinguishes authentication from authorization/resource visibility.
- ☐ Token values never appear in source, logs, screenshots, or evidence notes.
- ☐ Revoked credentials are proven unusable.
- ☐ Cleanup restores the original global permission.
11. Cleanup and rollback
- Export the evidence packet.
- Revoke remaining Chapter 21 credentials.
-
Restore the original
sonar-usersExecute Analysis state exactly. - Remove only the Chapter 21 disposable projects/templates/groups/users.
- Unset environment variables and remove the local synthetic source tree if no longer needed.
- Do not touch database/search state, global quality policy, external IdP configuration, or unrelated projects.
12. What Chapter 21 adds to the production operating model
The SonarQube control plane now includes a replayable identity chain: who authenticated, which groups/direct grants produced the effective permission, which project/global boundary applied, which token represented that identity, which analysis task resulted, and when access was revoked. Routine analysis no longer depends on administrator credentials.
Chapter 22 continues with SAML, LDAP, OIDC/SSO, Proxies, TLS, and Network Security, moving identity ownership from local accounts/groups toward enterprise authentication and network trust boundaries.
Knowledge check
What makes the cross-team denial causal rather than anecdotal?
The same revision, project key, token, and scanner are reused while only the causal global permission is changed.
Why should token values be absent from the evidence packet?
Evidence needs metadata and results, not the secret itself. Recording the secret creates another exposure path.
If Beta’s project-analysis token remains unexpired but its owner loses Execute Analysis, what should happen?
Current token semantics tie analysis validity to the owner retaining the relevant Execute Analysis permission, so the token should no longer authorize analysis.
Why restore the original global permission even if the narrower configuration seems better?
This is a disposable lab, not an unapproved production policy migration. Cleanup must restore the exact prior state.
What layer owns a synchronized enterprise group next chapter?
The configured external authentication/provisioning source of truth; SonarQube should not be treated as the independent owner of synchronized membership.
Does scanner success prove the user can administer the project?
No. Execute Analysis and Administer project are separate permissions.
Official references and version notes
-
Managing permissions — Community Build
— current global/project permissions, default
sonar-usersExecute Analysis grant, visibility, and permission templates. - Managing groups — additive direct/group permission model and built-in groups.
- Managing your tokens — user/project/global analysis token types, expiration, revocation, and owner-permission dependency.
- Administering tokens — administrator generation/revocation responsibilities.
- User accounts — built-in/delegated authentication and forced-authentication guidance.
- Web API — bearer authentication, token-expiration response header, form-data guidance, and Web API V2 transition.
- Current SonarQube downloads — Community Build 26.9.0.129388 baseline.
- SonarScanner CLI 8.1.0.6389 — scanner baseline used by the local analysis proofs.
Rechecked 2026-09-08. Mandatory exercises target
Community Build 26.9.0.129388 and
SonarScanner CLI 8.1.0.6389. Current Community
Build documentation says permissions are additive across direct
grants and group membership; sonar-users receives
global Execute Analysis by default on a fresh installation, so the
disposable RBAC lab temporarily removes that grant only after
preserving it and restores it during cleanup. Project-analysis
tokens are encouraged for one-project scanning. User tokens
inherit all permissions of their owner and are the recommended
bearer credential for Web API operations; project/global analysis
token validity depends on the owner retaining the corresponding
Execute Analysis permission. Token expiration can be selected by
users; enforcing an instance-wide maximum token lifetime for newly
generated tokens is Enterprise edition and above. New projects are
public by default in current documentation; the lab uses private
projects to make Browse/See Source Code boundaries observable. If
an external authentication/provisioning method synchronizes
users/groups/permissions, manual changes may be unavailable and
the external source of truth owns the change. Web API V2 is
gradually replacing older endpoints, so write automation must be
checked against the current in-instance API documentation.
SonarQube product names, editions, release trains, scanner runtimes, APIs, authentication options, and platform prerequisites can change independently. Re-check the linked SonarSource primary documentation for the exact target release before applying version-sensitive commands or operational guidance outside the disposable course environment.
report-task.txt/ceTaskId, CE result,
gate result, and revocation test separately. Never place token values
in the evidence packet.
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.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.