Repository navigation
fix(envoy): reject direct asymmetric JWT access when translation is enabled - #46023
Conversation
…nabled When TRANSLATION is enabled, the API key validator was accepting asymmetric JWTs (SERVICE_ROLE_KEY_ASYMMETRIC and ANON_KEY_ASYMMETRIC) directly from clients. This is incorrect — only sb_ keys should be accepted externally and then translated internally.
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@luizfelmach is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughAdds a Lua HTTP filter that enforces API-key validation on named protected routes and returns HTTP 401 for invalid/missing keys; the listener still includes an RBAC filter with apikey principals. Also updates the Envoy Docker image tag to v1.38.0. ChangesAPI Key Enforcement on Protected Routes
Envoy Container Image
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Braintrust eval report
|
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Bug fix + updating Envoy image
What is the current behavior?
When
TRANSLATIONis enabled in the Envoy configuration (lds.template.yaml), the Lua API key validator filter was placed after the translation filters. As a result, the validator was seeing already-trans lated keys and incorrectly accepting asymmetric JWTs (SERVICE_ROLE_KEY_ASYMMETRICandANON_KEY_ASYMMETRIC) directly from clients.This meant clients could bypass the intended
sb_key flow and use the internal asymmetric JWTs directly, which defeats the purpose of the translation layer.What is the new behavior?
The Lua validator filter is now placed before the translation filters. The validator sees the original client-provided key and enforces the correct policy:
sb_keys (SUPABASE_SECRET_KEY,SUPABASE_PUBLISHABLE_KEY) and legacy keys (SERVICE_ROLE_KEY,ANON_KEY)401 UnauthorizedThe translation filters then convert valid
sb_keys into internal asymmetric JWTs downstream as intended. No changes to the RBAC filter were needed.Additional context
docker/volumes/api/envoy/lds.template.yamlSummary by CodeRabbit