feat(auth): Fine grained auth integration with external services - #1169
feat(auth): Fine grained auth integration with external services#1169nathanzilgo wants to merge 19 commits into
Conversation
…p-gateway-registry-MAPE into feat/fine-grained-auth-integration
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Thanks for this — the fail-closed client, the header masking, and the 78 unit tests are genuinely strong work, and the native-default keeps existing deployments safe. Before it can merge, though, there's a set of items to address. Grouped by severity, with a short note on how to fix each. This is an important capability to add to the solution, and your implementation has helped us think more deeply about the design — so please read the comments below in that spirit, as us working through the design together rather than just as feedback on the PR. 🙏 Blockers (must fix before merge)1. In Suggested approach — make the authorizer the identity source in custom mode:
Net effect: 2. New config not propagated to the parameter reference or deployment surfaces.
3. The integration tests are currently placeholders. 4. Lint is failing (30 ruff errors). Should fix (important)5. Full request body + query params are egressed to the external authorizer — needs guardrails. Please implement all of the following:
6. 7. Config read directly from 8. Nice to fix9. Move 10. The webhook Pydantic contract is copy-pasted across 11. Narrow the broad Happy to help on the identity-contract design (#1) if useful — that's the most important one. The rest is mostly mechanical. Thanks again! Cc: @omrishiv |
|
Hi @nathanzilgo , just checking in, appreciate if you could please let us know your plans for this. Thanks. |
|
Great work @nathanzilgo @GuilhermeAlz are you 2 working on addressing @aarora79's comments otherwise I can also take a look if you are able to add me as a contributor? Alternatively I can open a new PR building on this, whatever is easiest for you :) |
|
Hey @aarora79 @ceng-p, sorry for the late response on this. I have been off the project since June, as I moved to another company, and there were a lot of changes in planning and priorities. I'm not sure if this implementation is still within the lab project's scope, so it might be best to align the next steps with @GuilhermeAlz. That said, I will try to address the review comments regarding my part of the PR over the next few days (it was completely impossible for me before this). Apologies again for the delay, and thank you for your patience and attention! 🙏 |
|
Hey guys, i'm also very sorry for the late response. As i am in the final months of my graduation, i lacked the time to contribute on my own. The project i am (and @nathanzilgo was) part of changed it's scope and our coordinator blocked us from contributing any further with this PR within the project's activities. I just submitted my final project and now i have more free time to contribute by myself. That said, i'll also try to adress my part of the PR over the next week. And no problem in adding @ceng-p as a contributor for me. |
Closes #358
Description of changes:
Integrates a pluggable custom authorizer webhook into the auth server's /validate endpoint, giving operators a drop-in replacement (or supplemental gate) for the built-in JWT/OAuth2 pipeline.
New AUTHORIZER_MODE env var (native / custom / both, default native) controls execution path — zero-change for existing deployments.
custommode — skips all native validation and forwards the full request context to an external HTTP endpoint; access is granted or denied solely by the webhook response.bothmode — runs the full native JWT/OAuth2 pipeline first, then passes the validated identity (username, scopes, groups) to the custom authorizer as a final gate.Startup validation — misconfigured CUSTOM_AUTHORIZER_URL or unsupported AUTHORIZER_MODE values raise a ValueError at startup rather than silently failing at request time.
Test plan
uv run pytest tests/auth_server/unit/test_custom_authorizer.py -v— all unit tests passuv run pytest tests/auth_server/integration/test_custom_authorizer_integration.py -v— all integration tests passAUTHORIZER_MODE=native— existing behavior unchanged (regression check)AUTHORIZER_MODE=customwith a running webhook — request authorized/denied by external serviceAUTHORIZER_MODE=both— native check passes, then custom authorizer consultedCUSTOM_AUTHORIZER_URLwithAUTHORIZER_MODE=custom→ server refuses to start with a clear errorAuthorizationheader is masked in the forwarded payload