Authorize node/namespace mutations in the deployment path#2361
Open
ruizhang0519 wants to merge 3 commits into
Open
Authorize node/namespace mutations in the deployment path#2361ruizhang0519 wants to merge 3 commits into
ruizhang0519 wants to merge 3 commits into
Conversation
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking: #2234 (step 0, internal mutation paths). This is the deployment slice; background propagation, the availability service-identity model, and remaining internal paths are separate follow-ups.
Deployments are declarative bulk syncs: the orchestrator creates/updates nodes and namespaces and deletes whatever the spec drops. It runs in a detached background task (
asyncio.create_task) after the HTTP response, so the actual mutations happen outside the request scope whereAccessCheckerlives. ThePOST /deploymentsentrypoint only authorizesWRITEon the deployment's root namespace — and sinceWRITEdoes not implyDELETE, aWRITE-only caller could delete nodes via an empty re-deploy.This re-authorizes inside the orchestrator (fail-closed) against the deploying user (
context.current_user), after the plan is built and before it is applied:WRITEon the deployment root and the namespace each deployed node lands inDELETEon nodes and namespaces the deploy removesNames are the rendered (fully-qualified) names — what the deploy actually mutates and what RBAC scopes match against. The check runs inside the deployment SAVEPOINT, so a denial rolls back any setup-phase writes. Git sync inherits this via the shared
DeploymentOrchestrator.Why this won't take effect now: DJ's default access policy is permissive, so the check allows requests unless an explicit restrictive grant/policy denies them.
When this will start taking effect: once a deployment enables restrictive RBAC. Until then this is a no-op.
Out of scope (internal-path follow-ups):
_maybe_autolock_git_namespace(namespace git-fields mutated after the orchestrator returns), per-preagg-parent authorization within a deploy, background revalidation/propagation, and the availability service-identity model.Verification:
WRITE-but-not-DELETEcaller passes the HTTP entrypoint (WRITE allowed), then an empty re-deploy that would delete a node is denied by the orchestrator; the deploy fails and the node survives. Fails before this change (node deleted), passes after.