Skip to content

[AS-184] Tech note: Router auth with JWT + SigV4 on AWS - #37

Open
ilan-bel wants to merge 3 commits into
mainfrom
docs/as-184-router-aws-jwt-sigv4
Open

ilan-bel wants to merge 3 commits into
mainfrom
docs/as-184-router-aws-jwt-sigv4

Conversation

@ilan-bel

@ilan-bel ilan-bel commented Jun 5, 2026

Copy link
Copy Markdown

Summary

Adds docs/router-aws-jwt-sigv4.md covering the two auth patterns Apollo Router needs on AWS:

  • JWT at the edge — validating inbound Bearer tokens against Cognito / Auth0 / OIDC JWKS endpoints, with Cognito-specific gotchas (access vs id tokens, regional JWKS URLs, token TTL).
  • SigV4 to subgraphs — signing outbound requests so Router can call IAM-authenticated API Gateway, Lambda Function URLs, AppSync, and App Runner using IRSA / ECS task role / EC2 instance profile.

Includes a combined router.yaml example with a header rule that strips the inbound Authorization header before SigV4 signing, plus smoke-test guidance.

Note

Originally drafted as a TN for apollographql/docs. That repo is now archived; the new apollographql/platform-docs requires SAML SSO grant on the contributor's OAuth token. Landing in apollosolutions/reference-architecture/docs/ as an interim home; can be migrated upstream once the SSO grant is in place.

Tracks AS-184.

Test plan

  • Markdown renders cleanly on github.com
  • All https://www.apollographql.com/docs/... links resolve
  • Code blocks are syntactically valid YAML

🤖 Generated with Claude Code

References: https://apollographql.atlassian.net/browse/AS-184

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@apollo-solutions-reviewer apollo-solutions-reviewer 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.

Solid tech note; the Cognito access-vs-id-token guidance, the IRSA/ECS/EC2 credential-chain breakdown, and the strip-Authorization-before-SigV4 header rule are all accurate and genuinely useful. A few blocking issues against the AS-184 acceptance criteria before this is ready.

  1. Invalid JWKS config key. In the Pattern 1 snippet the JWKS entry uses issuer: (singular scalar). The Router JWT plugin option is issuers: (a list); see https://apollographql.com/docs/graphos/routing/security/jwt#configuration-options. As written this YAML will fail config validation, which conflicts with the AC "working YAML snippets" and the PR's own "validated against a current Router version" test-plan item. Use issuers: ["https://cognito-idp.${AWS_REGION}.amazonaws.com/${USER_POOL_ID}"].

  2. Documentation links point at the archived IA. Every https://www.apollographql.com/docs/router/configuration/... link (and its anchors: #token-claims, #renewing-tokens, #requiresscopes, #policy) targets the pre-migration Router docs path. The current IA places these under /docs/graphos/routing/...: JWT at graphos/routing/security/jwt, SigV4 at graphos/routing/security/subgraph-authentication, authorization at graphos/routing/security/authorization. Since the ticket is explicitly motivated by the new docs IA and the test plan's "all links resolve" box is unchecked, please repoint all internal links and re-verify the anchors exist on the new pages.

  3. Missing architecture diagram. AC requires a diagram illustrating the client -> Router -> AWS-backed subgraph auth flow. The doc currently has none. A simple Mermaid sequence/flow diagram inline would satisfy this.

  4. SE/SA technical review. AC requires sign-off from at least one SE/SA. No review is recorded on the PR yet; please capture that before merge.

Non-blocking nits:

  • Pattern 1 mixes the authorization.directives.enabled block with require_authentication; confirm both keys are intended together and match the current authorization config schema on the new page.
  • "GA in 2.x" / "Router 1.43+" version claim for the SigV4 plugin should be spot-checked against release notes, since version strings drift.
  • CI is green (CLA signed, secrets scan passed); the failures above are content, not pipeline.

audiences: ["graphos-router"]
issuer: https://cognito-idp.${AWS_REGION}.amazonaws.com/${USER_POOL_ID}

authorization:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issuer: is not a valid JWKS key. The Router option is issuers: and takes a list. As written this fails config validation. Use issuers: ["https://cognito-idp.${AWS_REGION}.amazonaws.com/${USER_POOL_ID}"]. Ref: https://apollographql.com/docs/graphos/routing/security/jwt#configuration-options

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Confirmed at head 7adb688: Pattern 1 now uses issuers: as a list with the Cognito issuer URL, so the snippet passes config validation. Resolving.

## Pattern 1 — Validate inbound JWTs at the Router

The Router's [JWT authentication plugin](https://www.apollographql.com/docs/router/configuration/authn-jwt) validates a `Bearer` token against one or more JWKS endpoints and rejects unauthenticated traffic before composition. With AWS-hosted IdPs the JWKS URL is fully managed for you.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This and the other /docs/router/configuration/... links use the archived docs path. The current IA serves JWT auth at graphos/routing/security/jwt. Please repoint every internal link (and verify the deep-link anchors) to the new /docs/graphos/routing/... structure; the ticket is specifically about the new IA.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Confirmed at head 7adb688: all internal links now point at /docs/graphos/routing/... (jwt, subgraph-authentication, authorization) with valid anchors; no archived /docs/router/configuration/ paths remain. Resolving.

…-184)

Address docs-reviewer feedback:

- The JWT plugin option is `issuers:` (list), not `issuer:` (scalar);
  as written, config validation fails.
- Repoint every internal docs link from the archived `/docs/router/...`
  paths to the current `/docs/graphos/routing/security/...` IA. SigV4
  is now at `/security/subgraph-authentication`; JWT at `/security/jwt`;
  authorization directives at `/security/authorization`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ilan-bel pushed a commit that referenced this pull request Jun 8, 2026
…208)

Address docs-reviewer feedback:

- Health-check endpoint binds 127.0.0.1 by default; show the explicit
  `listen: 0.0.0.0:8088` snippet so ALB/EKS probes can reach it.
- Prometheus exporter is disabled by default and binds 127.0.0.1; show
  the enable + `listen: 0.0.0.0:9090` snippet for AMP scraping.
- Repoint health-check and self-hosted-runtime links from the archived
  /docs/router/... paths to the current /docs/graphos/routing/self-hosted/
  IA.

The two cross-references to the sibling PRs (#35 examples/router-helm-non-oci
and #37 router-aws-jwt-sigv4.md) are intentionally kept relative; they
resolve once those sibling PRs merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@apollo-solutions-reviewer apollo-solutions-reviewer 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.

Re-reviewed at head 7adb688. Two of the four blocking findings are fixed and their threads are resolved:

  1. JWKS config: Pattern 1 now uses issuers: as a list; the snippet validates.
  2. Doc links: all internal links repointed to /docs/graphos/routing/... (jwt, subgraph-authentication, authorization) with correct anchors; no archived /docs/router/configuration/ paths remain.

Two blocking AC items are still outstanding:

  1. Architecture diagram. The AC requires a diagram of the client -> Router -> AWS-backed subgraph auth flow. The current file has none; a Mermaid sequence or flow diagram inline would satisfy this.
  2. SE/SA technical review. The AC requires sign-off from at least one SE/SA. The only review on the PR is this bot's; no human SE/SA review is recorded yet.

Add the diagram and capture an SE/SA review, then re-request and I will approve.

Adds a Mermaid sequence diagram showing the client→Router→IdP→Subgraph
authentication flow, satisfying the AC requirement for an architecture diagram.
Still needs SE/SA technical review before final approval.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ilan-bel

ilan-bel commented Jun 9, 2026

Copy link
Copy Markdown
Author

@andywgarcia Assigning to you — architecture diagram has been added (satisfying AC item 3), but this still needs SE/SA technical review (AC item 4) before it can be approved. Could you take a look or find an SE/SA to sign off?

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.

2 participants