feat(server): add Handoff access control - #1398
Draft
Teingi wants to merge 2 commits into
Draft
Conversation
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.
Which issue or RFC does this PR close?
Implements #1395.
Design reference: #1396.
Rationale for this change
The current optional static Bearer token authenticates one deployment-local caller but cannot express per-user, per-scope, or exact-Handoff visibility. Handoff Receipts also record receiver observations; they are not authorization grants.
This change adds an independent Server Access Control boundary so user A can grant user B least-privilege access to one committed Handoff Revision without exposing the surrounding scope. Runtime domain APIs remain free of Principal, role, and permission parameters, and deployments can replace the built-in decision provider and relationship store with an external authorization system.
What changes are included in this PR?
AuthorizationProvider,RelationshipWriter, andAccessAuditStoreboundaries for integrations such as OpenFGA, Casbin, Oso, or an AuthZEN-compatible PDP./v1/access/me, check, batch-check, safe resource listing, role listing, binding management, and audit APIs plus typed Python SDK methods.x-powercontext-accessrequirements and enforce them at one Server PEP before Runtime dependencies or business metrics.disabled,legacy-static-admin, andenforcedrollout modes; the default legacy mode preserves the existing static-token administrator behavior.Are there any user-facing changes?
Yes. Authenticated deployments gain public Access APIs, stable 403 behavior, exact-Handoff receiver grants, Access audit records, and two Access configuration settings. Existing static-token deployments remain compatible through the default
legacy-static-adminmode.The change adds Server-owned Access tables but does not add identity or ACL fields to Handoff, Source, Memory, Work, or other Runtime domain records.
scope_idremains a business partition rather than an authorization credential.How was this change tested?
PRE_COMMIT_HOME=/tmp/powercontext-prek-cache make check.venv/bin/python -m pytest -q -p no:cacheprovider(974 passed, 9 skipped)make contract-test(30 passed)make docs-test.envOceanBase, generation LLM, and Embedding provider:AI usage statement
OpenAI Codex (GPT-5) was used to inspect the repository contracts, implement the Access Control layer and generated API changes, diagnose the real OceanBase SAVEPOINT failure, and run the validation described above. The author directed the design and publication scope.