Skip to content

Add scoped session data scope resolver - #170

Merged
eviltester merged 1 commit into
masterfrom
codex/scoped-session-resolver-168
Aug 24, 2026
Merged

Add scoped session data scope resolver#170
eviltester merged 1 commit into
masterfrom
codex/scoped-session-resolver-168

Conversation

@eviltester

Copy link
Copy Markdown
Owner

Summary

  • Adds trusted scoped-session credential resolution before request validators and operation handling.
  • Lets scoped-session authentication select the active data scope when credentials are valid.
  • Preserves anonymous default-scope reads, rejects invalid credentials by default, and lets explicit route auth win when it selects a data scope.
  • Adds coverage for HTTP/direct API behaviour, authorizers, validators, hooks, callbacks, fixed/generated routes, and OpenAPI docs for required scoped-session headers.

Verification

  • Full Maven verification passed during commit hook: mvn clean verify
  • Local Maven install was completed for API Challenges: mvn install -DskipTests

Closes #168

Copilot AI lite review requested due to automatic review settings August 24, 2026 11:04

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@eviltester
eviltester merged commit 01b1833 into master Aug 24, 2026
3 checks passed
@eviltester
eviltester deleted the codex/scoped-session-resolver-168 branch August 24, 2026 11:07

@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: 4af7e1202c

ℹ️ 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 on lines +290 to +292
for (FilterBy filterBy : safeQueryParams(queryParams).toList()) {
if (queryParamName.equals(filterBy.fieldName)) {
return CredentialValue.present(filterBy.fieldValue);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Exclude the scoped credential from entity filters

When the credential source is QUERY_PARAM, this reads the credential but leaves the same FilterBy in the parameters later passed to EffectiveQueryParams. If URL filtering is disabled, an otherwise valid credential can trigger the generic 400 for forbidden filters; if filtering is enabled and the entity has a field with the credential's name, the credential value silently filters the returned data. Treat the credential parameter as transport metadata and exclude it from the parameters processed by the route handler.

Useful? React with 👍 / 👎.

Comment on lines +136 to +138
if (result.dataScopeSelection().isPresent()) {
final ApiResponse dataScopeResponse =
dataScopeSelectionApplier.apply(context, result.dataScopeSelection().get());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delay data-scope creation until all auth gates pass

On routes that also enforce explicit route authentication, this applies the scoped-session selection before RouteAuthPolicy checks the second credential. A valid scoped credential selecting ENSURE_EXISTS or ENSURE_CREATED_AND_POPULATED can therefore persistently create or populate a store even when the required bearer/API-key credential is missing or rejected; defer the mutating selection until every required authentication gate has succeeded.

Useful? React with 👍 / 👎.

}

@Test
void authorizerReceivesScopedSessionSelectedScopeAndPrincipal() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Split the authorizer scope and principal checks

This test combines two separable propagation contracts—selected data scope and authenticated principal—so a regression in either concern is reported through one test whose name itself requires “And.” Split them into independently named tests while retaining the shared setup.

AGENTS.md reference: AGENTS.md:L6-L15

Useful? React with 👍 / 👎.

}

@Test
void operationCallbackReceivesScopedSessionPrincipalAndScope() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Split the callback principal and scope checks

This callback test verifies two independent context properties in one method, making failures in principal propagation and scope propagation share a single scenario and name. Give each callback contract its own test so the failing behavior is unambiguous.

AGENTS.md reference: AGENTS.md:L6-L15

Useful? React with 👍 / 👎.

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.

Scoped Session Resolver With Anonymous Default Data Scope

2 participants