P3.6: Enforce JWT auth on X-Service adapter dispatch #11

Closed
opened 2026-09-08 04:42:44 +00:00 by rock · 1 comment
Owner

Summary

Wire JWT validation into ServiceAdapter dispatcher. Currently auth.required: true on SQS adapter is ignored — and the existing SQS validator is broken.

Code repo: rock/homelab-frontend — internal/serviceadapter/router.go

Current state (verified 2026-09-08)

The SQS dispatcher has a hardcoded sqsJWTAuth validator pointing at authentik.riotpiao.com/application/o/sqs/jwks/ — but no sqs provider exists in Authentik. Every SQS request gets 403 regardless of token validity.

Other X-Service adapters (memory, s3, iam) have auth.required: false and pass JWT through unchanged.

Fix required

  1. Replace sqsJWTAuth hardcoded validator with the same multi-issuer validator used by /v1/* (accepts any Authentik provider)
  2. After JWT validation, check roles claim for sqs:read (GET) / sqs:write (POST)
  3. Apply same pattern to all adapters with auth.required: true
  4. Inject X-Forwarded-User headers (reuse P3.4 logic)

Test results from audit

portfolio-agent (roles: [sqs:read]) -> X-Service: sqs -> 403 (BROKEN)
memory-agent (roles: [sqs:read/write]) -> X-Service: sqs -> 403 (BROKEN)

Acceptance Criteria

  • Dispatcher uses multi-issuer validator (not provider-specific)
  • Checks roles claim for <service>:read/<service>:write
  • Returns 401/403 with RFC 9457 problem detail
  • Adapters with auth.required: false unchanged
  • Unit tests

Depends on

  • P3.4 (identity header injection)
## Summary Wire JWT validation into ServiceAdapter dispatcher. Currently `auth.required: true` on SQS adapter is ignored — and the existing SQS validator is **broken**. **Code repo:** `rock/homelab-frontend` — `internal/serviceadapter/router.go` ## Current state (verified 2026-09-08) The SQS dispatcher has a **hardcoded** `sqsJWTAuth` validator pointing at `authentik.riotpiao.com/application/o/sqs/jwks/` — but no `sqs` provider exists in Authentik. Every SQS request gets 403 regardless of token validity. Other X-Service adapters (`memory`, `s3`, `iam`) have `auth.required: false` and pass JWT through unchanged. ## Fix required 1. Replace `sqsJWTAuth` hardcoded validator with the **same multi-issuer validator** used by `/v1/*` (accepts any Authentik provider) 2. After JWT validation, check `roles` claim for `sqs:read` (GET) / `sqs:write` (POST) 3. Apply same pattern to all adapters with `auth.required: true` 4. Inject X-Forwarded-User headers (reuse P3.4 logic) ## Test results from audit ``` portfolio-agent (roles: [sqs:read]) -> X-Service: sqs -> 403 (BROKEN) memory-agent (roles: [sqs:read/write]) -> X-Service: sqs -> 403 (BROKEN) ``` ## Acceptance Criteria - [ ] Dispatcher uses multi-issuer validator (not provider-specific) - [ ] Checks `roles` claim for `<service>:read`/`<service>:write` - [ ] Returns 401/403 with RFC 9457 problem detail - [ ] Adapters with `auth.required: false` unchanged - [ ] Unit tests ## Depends on - P3.4 (identity header injection)
rock added this to the Phase 3: OAuth2 Token Exchange & Identity Propagation milestone 2026-09-08 04:42:44 +00:00
rock added the area/autharea/gatewaytype/featurestatus/todopriority/medium labels 2026-09-08 04:42:45 +00:00
rock self-assigned this 2026-09-08 04:42:47 +00:00
rock added this to the API-GW OAuth project 2026-09-08 04:44:00 +00:00
Author
Owner

Closed by homelab-frontend PR #16: riotpiao-poimen/homelab-frontend#16

Closed by homelab-frontend PR #16: https://forgejo.riotpiao.com/riotpiao-poimen/homelab-frontend/pulls/16
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: riotpiao-poimen/homelab#11