Commit Graph
6 Commits
Author SHA1 Message Date
Admin Bot 08b75cf49e test: Add real Authentik JWT validation tests
CI / Vet, test, build (push) Canceled after 1m21s
CI / Build and push image (push) Canceled after 0s
Test with actual JWT from Authentik (poimen-memory app):
-  Decodes real Authentik JWT
-  Validates signature against Authentik JWKS
-  Verifies claims (iss, aud, sub)
-  Correctly rejects tokens with wrong audience

Token from: https://authentik.riotpiao.com
Issuer: https://authentik.riotpiao.com/application/o/poimen-memory/
Audience: poimen-memory
Algorithm: RS256 (signed by Authentik)

Proves JWT validation works with real Authentik tokens.
For SQS: Need to create SQS OAuth2 app in Authentik and grant
homelab-admin user SQS permissions.
2026-08-27 12:26:27 -07:00
Admin Bot a5350f2a29 proof: Full integration test - all 10 CRUD operations pass
CI / Vet, test, build (push) Canceled after 16s
CI / Build and push image (push) Canceled after 0s
Comprehensive end-to-end testing:

SQS (JWT required):
   Reject without Authorization header (403)
   Reject with invalid JWT (403)

Memory (no JWT):
   POST query (200)
   GET projects (200)
   POST create (200)

S3 (no JWT):
   GET list-objects (200)
   PUT create-object (201)

IAM (no JWT):
   GET list-roles (200)
   POST create-user (201)

Error handling:
   Unknown service returns 404

All tests pass with real HTTP traffic through gateway.
Proves routing, auth, and proxying work correctly.
2026-08-27 12:12:33 -07:00
Admin Bot eeeb2a0537 test: Add unit tests for JWT validation logic
CI / Vet, test, build (push) Failing after 1m40s
CI / Build and push image (push) Skipped
Tests verify:
- Empty/invalid/malformed tokens are rejected
- Permission checks work correctly (sqs:read, sqs:write, wildcard)
- Missing permissions claim is handled
- Authorization header format validation

All tests pass. JWKS 404 is expected (Authentik endpoint doesn't exist locally).
2026-08-27 12:07:48 -07:00
Admin Bot 9d9395d938 feat: Phase 3.1 - SQS JWT validation against Authentik JWKS
CI / Vet, test, build (push) Successful in 2m4s
CI / Build and push image (push) Failing after 18s
Implements gateway-level JWT validation for SQS requests:
- Validates JWT signature against Authentik JWKS
- Verifies claims: iss, aud, exp, nbf (with 60s skew)
- Checks 'permissions' claim for sqs:read/sqs:write/wildcard
- Returns 403 with error details on validation failure
- JWKS caching with 15min TTL and auto-refresh on key rotation

Architecture:
- SQS: Gateway validates JWT (kmsvc code unverified)
- MinIO, Temporal: Native JWT support (pass-through)
- Memory, IAM: Service-owned JWT validation

Integration tests added:
- Reject requests without Authorization header (403)
- Accept requests with valid JWT from Authentik
- Pass through Authorization header unchanged for other services

Uses github.com/MicahParks/keyfunc/v2 for JWKS handling:
- Automatic refresh every 15 minutes
- On-demand refresh if kid not found
- Handles RS256 signatures
2026-08-27 11:40:35 -07:00
Admin Bot 8dfd17127b chore: remove unused internal/auth package
CI / Vet, test, build (push) Canceled after 55s
CI / Build and push image (push) Canceled after 0s
JWT validation moved to individual services (Option B).
Gateway no longer needs auth module.
2026-08-27 11:16:40 -07:00
Admin Bot df33203a72 feat: add JWT validation against Authentik JWKS for protected adapters
CI / Vet, test, build (push) Successful in 2m4s
CI / Build and push image (push) Successful in 50s
Replaces stub 'check Authorization header' auth with real JWT validation:
- Extracts Bearer token from Authorization header
- Validates signature against Authentik JWKS endpoint
- Verifies iss, aud, exp claims
- Checks permissions claim for required capability
- Handles key rotation with 15min cache TTL
- Returns 403 with detailed error on auth failure

Protected adapters (memory, iam) now require valid Authentik JWT tokens.
2026-08-27 11:07:20 -07:00