Enable RAJEE authentication by default and fix integration tests #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enables RAJEE authentication by default and completes the auth integration testing. Building on PR #18 which implemented the full JWT authentication system (Envoy jwt_authn + Lua authorization filters, JWKS endpoint, RAJEE token issuance), this PR flips the switch to enable auth by default, adds comprehensive integration test coverage, and fixes critical JWT validation issues discovered during testing.
What This PR Accomplishes
🔐 Authentication Enabled By Default
RAJEE Envoy now runs with authentication enabled by default. Every S3 request must include a valid JWT token with appropriate grants, enforced by:
✅ Complete Integration Test Coverage
Added comprehensive auth-enabled test coverage for all S3 operations:
🐛 Critical Fixes
JWT Issuer Claim: Fixed issuer to use only
scheme://netloc(no path component). This was causing JWT validation failures because Envoy expectedhttps://7tp2ch1qoj.execute-api.us-east-1.amazonaws.combut tokens containedhttps://7tp2ch1qoj.execute-api.us-east-1.amazonaws.com/prod.Test Token Issuance: Refactored integration tests to use the control plane
/tokenendpoint instead of local JWT signing. The previous approach had a silent fallback to a test secret when AWS Secrets Manager was unavailable, causing all tokens to fail validation against production JWKS. Now all test tokens are issued by the control plane and properly signed.Detailed Changes
Fixed
scheme://netloc(no path) for proper JWT validationraja_issuerextraction inapp.pyto strip path from API URL/tokenendpoint instead of local JWT signingget_jwt_secret()helper and its silent fallback to test secretsissue_rajee_token()now mints tokens via API, ensuring proper JWKS signature validationAdded
test_rajee_token_validates_against_jwks- Validates RAJEE tokens against the JWKS endpointrequire_api_issuer()- Extract issuer (scheme+netloc) from API URLissue_rajee_token()- Delegates to control planepolicies/rajee_test_policy.cedar- Grants alice access torajee-integration/prefixspecs/2-rajee/12-auth-failure-analysis.md- Root cause analysis of 401 vs 403 failure modesChanged
AUTH_DISABLED=falsefor RajeeEnvoyStackTesting Results
All integration tests pass with auth enabled:
Architecture
Auth Flow:
Grant Format:
s3:{Action}/{Bucket}/{Prefix}Examples:
s3:GetObject/my-bucket/rajee-integration/- Read access to prefixs3:PutObject/my-bucket/rajee-integration/- Write access to prefixs3:ListBucket/my-bucket/- List bucket contentsChangelog
See CHANGELOG.md v0.4.2 for the complete release notes.
Related Issues
Deployment Impact
Authorization: Bearer <token>headerMigration: Use the control plane
/tokenendpoint withtoken_type=rajeeto issue RAJEE tokens:🤖 Generated with Claude Code