Skip to content

Add explicit ancestor authorization assertions - #54

Merged
zth merged 6 commits into
mainfrom
agent/authorize-selection-coverage
Aug 2, 2026
Merged

zth merged 6 commits into
mainfrom
agent/authorize-selection-coverage

Conversation

@zth

@zth zth commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add explicit @gql.authorize.byAncestor({reason}) dispositions for reviewed structural child fields
  • keep ordinary @gql.authorize(Policy.check) policies direct and field-local
  • statically prove that every path to a byAncestor field crosses a policy or allowed resolver outcome
  • emit no additional runtime checks for ancestor-authorized fields
  • record review reasons and nearest possible boundaries in the authorization manifest
  • replace the earlier experimental {scope: Fields} API completely

Semantics

byAncestor can be placed on a concrete object type as a default for its immediate GraphQL fields, including separately declared resolver fields, or directly on one field. It is intentionally non-recursive: returned object types must declare their own disposition. A direct field policy, public declaration, or resolver outcome overrides a type-level default; an explicit field-level assertion cannot be combined with a direct disposition.

The proof is path-sensitive. Lists and nullability are transparent, while unions and interface return types fan out to concrete objects. A shared type fails if any entry path reaches it without an earlier policy or allowed resolver outcome. Public fields are not authorization boundaries. Interface annotations and subscriptions remain unsupported until their inheritance and per-event semantics are defined.

Mutation root fields still require a pre-resolver policy before a payload can rely on ancestor authorization.

Performance

Policies execute only where declared, exactly once per normal GraphQL field execution. Structural descendants do not reevaluate the policy. Static analysis propagates only nearest possible boundaries, preventing boundary sets from growing with schema depth while retaining deterministic audit provenance.

Coverage

Fixtures cover:

  • field-level and type-level assertions
  • direct-policy and public overrides
  • resolver-outcome and mutation-payload boundaries
  • shared types with multiple protected paths
  • rejection of protected/unprotected alternate paths
  • union fan-out
  • invalid reasons, duplicates, conflicts, missing ancestors, interfaces, and subscriptions
  • deterministic manifests and exactly-once generated policy calls

Validation

  • opam exec --switch=5.3.0 -- make test
  • opam exec --switch=5.3.0 -- make checkformat
  • npm run build
  • git diff --check

@zth zth changed the title Add selection-wide authorization coverage Add returned-field authorization scopes Aug 1, 2026
@zth zth changed the title Add returned-field authorization scopes Add explicit ancestor authorization assertions Aug 2, 2026
@zth
zth marked this pull request as ready for review August 2, 2026 17:27
@zth

zth commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62a5e15f72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ml/GenerateSchemaAuthorization.ml Resolved
@zth

zth commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c5dadc3b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ml/GenerateSchemaAuthorization.ml Resolved
@zth

zth commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: f388b77432

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zth
zth merged commit b70957a into main Aug 2, 2026
5 checks passed
@zth
zth deleted the agent/authorize-selection-coverage branch August 2, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant