RBAC & Ownership
This page describes Role-Based Access Control (RBAC) for environments.
| Role | Who |
|---|---|
Creator |
The Jenkins user who ran Create-Environment. This value never changes. |
Co-owner |
A user in the |
Administrator |
A user in the |
Permissions
| Role | create | update | deploy | start / stop / restart | delete | manage-owners | cleanup |
|---|---|---|---|---|---|---|---|
Creator ( |
n/a |
✓ |
✓ |
✓ |
✓ |
✓ |
own env only |
Co-owner ( |
n/a |
✓ |
✓ |
✓ |
✓ |
✓ |
own env only |
Admin (listed in |
✓ (bypasses |
✓ |
✓ |
✓ |
✓ |
✓ |
all envs |
Anyone else |
✓ (subject to |
✗ |
✗ |
✗ |
✗ |
✗ |
no effect on other users' envs |
RBAC is enabled by default (QA_RBAC_ENABLED=true). Set QA_RBAC_ENABLED=false in Manage Jenkins → System → Global properties to fall back to the legacy "everyone can touch anything" mode.
|
For Developers: Where It Is Enforced
-
utils.checkOwnershipis called byupdateEnvStep,manageEnvStepanddeployEnvStep. The form dropdowns have no ownership check. -
createEnvStep— quota check (QAConfig.Limits.MAX_ENVS_PER_USER) happens before any filesystem work. Admins bypass it. -
cleanupEnvsStep— filters the env list by ownership before the TTL check, so a non-admin can never delete someone else’s env. Cron-triggered runs have nocurrentUserand bypass the check so unattended cleanup still works. -
listEnvsStephas no ownership filter. All users see all environments.
Disabling RBAC (QA_RBAC_ENABLED=false) short-circuits checkOwnership to true and canModify to true.
manage-owners — the ownership editor
Triggered via QA-Environments/Manage-Environment with ACTION=manage-owners.
ACTION=manage-owners)-
OWNERS_LIST—CascadeChoiceParameter+PT_CHECKBOXof Jenkins logins. Currently saved co-owners appear pre-checked. The creator is not in the list. -
OWNERS_PREVIEW— live HTML diff of pending change (added vs removed). Display-only.
meta.json{
"created_by": "alice", // unchanged
"owners": ["bob", "carol"] // rewritten from OWNERS_LIST submission
// all other fields untouched — no lifecycle transition
}
Why manage-owners is special:
-
It is the only
ACTIONthat does not go through the duplicate-audit code path the lifecycle actions share. The audit is skipped because the action does not touch containers or volumes and the ownership diff has its own audit line. -
manage-ownersis offered for envs in any state. You can reassign ownership on a stopped or failed env without first starting it.
Validation rules
utils.validateOwners(newOwners, meta, currentUser, adminUsers, knownJenkinsLogins):
-
Rejects an empty list (there must be at least one co-owner or the creator; the creator is always implicit).
-
Requires the submitting user to appear in the result unless they are an admin — non-admins cannot remove themselves without granting access to someone else first.
-
Enforces
MAX_OWNERS_PER_ENV(default5, override viaQA_MAX_OWNERS_PER_ENV). -
Drops unknown logins — a login is "known" if it already appears in the Jenkins user database. Users without a Full Name still count.
Result is a List that manageEnvStep writes verbatim back into meta.owners[] via utils.atomicWriteMeta.
Limits
| Limit | Default | Override |
|---|---|---|
|
|
|
|
|
|
Transfer of ownership
There is no user-facing "transfer" action. created_by is immutable. To move an env to a new owner:
-
Admin (or current creator) adds the target user to
owners[]viamanage-owners. -
Target user now has every mutating right the creator has.
-
The audit trail (
meta.created_by+ themanage-ownersaudit line) records who did what.
If the business really requires a new created_by, an admin has to edit meta.json directly on the master under /var/jenkins_home/qa-data/envs/<env>/meta.json.
Audit trail
-
MASTER_AUDIT_LOG(${MASTER_ENVS_DIR}/.audit-log.ndjson) — one line per privileged action. -
MASTER_OPERATION_LOG(${MASTER_ENVS_DIR}/.operation-log.ndjson) — one line per step invocation.
Both are append-only NDJSON files written by utils.logOperation. Rotate them externally — the library does not rotate them.