Skip to content

feat(services): authenticate exposed service requests - #3492

Open
drew wants to merge 1 commit into
codex/sandbox-service-exposurefrom
codex/service-exposure-auth
Open

drew wants to merge 1 commit into
codex/sandbox-service-exposurefrom
codex/service-exposure-auth

Conversation

@drew

@drew drew commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Require gateway authentication and workspace access for remotely exposed sandbox services while preserving local loopback development. Add a dedicated OpenShell service credential channel so applications can continue using the standard Authorization header.

This PR is stacked on #3439.

Related Issue

Related to #3402

Changes

  • Authenticate remote service requests through the existing gateway authenticator chain
  • Authorize users against the workspace encoded in the service hostname
  • Support OpenShell-Service-Authorization, standard bearer authorization, mTLS identity, and an exact-host secure session cookie
  • Strip gateway-owned credentials before proxying while preserving application authorization when a dedicated gateway credential is used
  • Reject cross-origin cookie-authenticated requests and prevent sandbox services from overwriting the reserved cookie
  • Keep loopback plaintext service routing trusted for local development
  • Document the authentication model and explicitly omit public service exposure

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (not included; full server unit and integration suites cover multiplexing, authentication boundaries, and relay behavior)

Additional verification:

  • cargo test -p openshell-server (1,685 passed, 8 ignored; all integration tests passed)
  • cargo clippy -p openshell-server --all-targets -- -D warnings

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@drew
drew added this pull request to stack #3493 September 20, 2026 05:04
@github-actions

Copy link
Copy Markdown

Signed-off-by: Drew Newberry <anewberry@nvidia.com>
@drew
drew force-pushed the codex/service-exposure-auth branch from bc5e9b7 to 830e3ff Compare September 20, 2026 06:56

@drew drew left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

This maintainer-authored follow-up to #3439 is project-valid, and its docs cover the new service-authentication behavior. The initial code-only review found one blocking credential-boundary defect.

Action required: keep a gateway bearer token from ever being relayed to the sandbox service after session-cookie authentication, and add regression coverage for the two-request flow.

Blocking findings:

  • GATOR-830e3ff2-01: a standard gateway Authorization token can be forwarded upstream after the new session cookie takes precedence on a later request.

Carried findings:

  • None

Non-blocking suggestions:

  • None
Gator metadata
  • Validation: maintainer-authored gateway security work stacked on #3439 and related to #3402
  • Docs: Fern docs and architecture guidance updated
  • Checks: current-head branch checks are still running
  • E2E: required for gateway service routing; dispatch follows resolution of blocking feedback
  • Head SHA: 830e3ff2882300a81d2b375470ddacb9dadb23a6
  • Base SHA: 8733df2c8db75379b512062df0129f96937721b3
  • Merge base SHA: 8733df2c8db75379b512062df0129f96937721b3
  • Patch ID: d8db2c327f16082f60cce94c9a84b66fea72977a
  • Gator payload: 9
  • Review mode: initial
  • Previous reviewed SHA: none
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:in-review

ServiceCredentialSource::DedicatedHeader,
Some(token),
)
} else if let Some(token) = cookie {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

gator-agent

Critical — GATOR-830e3ff2-01 · Gateway token can reach the sandbox service

Summary: A cookie-preserving client that authenticates once with the documented standard Authorization header receives a service session cookie. On its next request, the cookie branch wins and the still-configured Authorization header is treated as application auth, so the sandbox service receives the user’s gateway token. A compromised service can replay that token against gateway APIs with the user’s access.

Fix: Mint the service cookie only from the dedicated OpenShell header, always consume standard Authorization as a gateway credential, and let a supplied dedicated header replace an existing cookie for safe rotation.

Verify: Send Authorization: Bearer T, retain the returned cookie, then send both on a second request; the upstream must never receive T. Also verify a dedicated header plus an old cookie authenticates with and replaces the header token.

Agent context
  • Agent path: service request authentication → cookie precedence → upstream header filtering
  • Ownership: This PR introduces both cookie minting from standard Authorization and source-dependent forwarding.
  • Location: crates/openshell-server/src/service_routing.rs:237

@drew drew added the gator:in-review Gator is reviewing or awaiting PR review feedback label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:in-review Gator is reviewing or awaiting PR review feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant