feat(auth): add scoped API keys for Astra - #244
Open
loveRhythm1990 wants to merge 4 commits into
Open
Conversation
loveRhythm1990
requested review from
XuPeng-SH,
aptend and
gouhongshen
as code owners
September 4, 2026 12:40
10 tasks
gouhongshen
reviewed
Sep 7, 2026
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.
What type of PR is this?
Which issue(s) this PR fixes
Related: #245
This reference intentionally does not automatically close the cross-repository issue.
What this PR does / why we need it
Provide reusable, least-privilege credentials for Astra account sign-in and optional memory sharing.
Add API-key scopes and stable
GET /auth/whoamiidentity metadata.Enforce identity/read/write/key-management scopes across REST and MCP.
Prevent identity-only/read-only/read-write connection keys from administering groups, managing keys, or reaching unclassified authenticated routes.
Preserve scopes during rotation and maintain explicit compatibility for legacy/default keys.
Reject unauthorized memory access before per-user memory provisioning.
Make whoami verify the current database grant rather than trust a warm replica-local cache, so login/refresh observes revocation made through another API replica.
Decouple MCP authorization from metrics invalidation. Explicitly require
memory:writeformemory_apply,memory_rebuild_indexandmemory_tune_params.Classify exact dispatch names rather than sanitized tracking labels; reject unclassified tools by default, including with master credentials.
Apply the same admission to requests and notifications, with real HTTP/database regression coverage.
Verification
Latest MCP review-fix update (58744ff)
cargo test --locked -p memoria-api --lib: 93 passed.cargo test --locked -p memoria-api --test api_e2e test_scoped_ -- --nocapture: 3 passed.cargo test --locked -p memoria-api --test api_e2e test_mcp_ -- --nocapture: 16 passed.git diff --check: passed.Previously recorded verification
Local validation before push:
git diff --checkpassed.Production OAuth and GitOps deployment are not covered by these API tests.
Cross-repository dependencies
No MatrixOne source changes are included.