Repository navigation
feat(server): accounts.resolve security presets (#1339) - #1352
Merged
Merged
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
4 tasks done
Standardize the post-resolve authorization pattern multi-tenant adopters reach for — "the inner resolver found the account, but is the calling principal authorized for it?" — instead of every adopter rolling their own. Three exports composing with composeMethod over accounts.resolve: - requireAccountMatch — general post-resolve guard - requireAdvertiserMatch — gate on account.advertiser ∈ roster - requireOrgScope — gate on (account org === ctx org) Default deny returns null (indistinguishable from "not found", avoids principal enumeration); opt-in onDeny: 'throw' surfaces PermissionDenied. Closes #1339. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
force-pushed
the
bokelley/resolve-presets
branch
from
May 2, 2026 20:45
535f557 to
13ba434
Compare
1 of 4 tasks
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.
Summary
Closes #1339. Standardizes the post-resolve authorization pattern multi-tenant adopters reach for — "the inner resolver found the account, but is the calling principal authorized for it?" — instead of every adopter rolling their own.
Three exports composing with
composeMethodoveraccounts.resolve:requireAccountMatch(predicate, options?)— general post-resolve guardrequireAdvertiserMatch(getRoster, options?)— gate onaccount.advertiser ∈ rosterrequireOrgScope(getAccountOrg, getCtxOrg, options?)— gate on(account org === ctx org)Deny semantics
Default
onDeny: 'null'returnsnullfrom the wrapped resolver — buyer seesACCOUNT_NOT_FOUND, indistinguishable from a genuinely unknown account. Avoids principal enumeration; matches the canonicalaccounts.resolvefailure shape documented onAccountStore.resolve.Opt-in
onDeny: 'throw'surfacesPermissionDeniedErrorto the buyer. Use only when the principal is already known to be allowed to know the account exists.The
null-from-inner case short-circuits — predicates / roster getters do not run when the inner resolver couldn't find the account.Test plan
test/server-decisioning-resolve-presets.test.jscovering: pass/deny semantics, null short-circuit, async predicates/rosters, ctx threading, throw mode withactionlabel propagation, and a realistic composition fixturecomposeMethodtests still pass (test/server-decisioning-compose.test.js, 10 tests)npm run build:libcleannpm run format:checkcleanSource
Item 1 in the doha-v20 SDK asks drafted while migrating an adapter against current SDK HEAD. The companion docs/test-patterns issue (#1345) will reference these once they ship.
🤖 Generated with Claude Code