Repository navigation
fix(dataviewer): fail closed on incomplete auth; honor CORS wildcards - #2071
Jamie Kim (jkim323) merged 10 commits into
Conversation
Require azure_ad/auth0 settings at provider construction instead of starting with empty tenant/domain values. Split CORS_ORIGINS entries that contain '*' into allow_origin_regex so Terraform's https://*.<env domain> pattern matches real Origin headers. Fixes microsoft#1939
c1f19d8 to
abd1a06
Compare
Marcel Bindseil (bindsi)
left a comment
There was a problem hiding this comment.
The CORS wildcard implementation behaves correctly for the intended deployed origin shape, but the authentication change does not yet satisfy issue #1939's startup contract. Azure AD, Auth0, and unknown-provider validation remain lazy: lifespan startup succeeds, then the first protected request raises. Please construct the selected provider during startup and add lifespan regressions. Also add middleware-level CORS tests, refresh the blocked branch from current main, and publish the supported backend validation result for the final head.
|
Thanks for the review. An isolated probe at 70a7fac confirms the startup issue: Azure AD/Auth0 and unknown providers are only constructed on the first protected request. I’m blocked on the documented pinned RPI bootstrap: this environment has gh 2.46.0, which does not provide gh skill. Is there a supported alternative for completing that bootstrap? No follow-up changes have been pushed. The startup fix, lifespan and middleware CORS regressions, main refresh, and supported backend validation are still pending. |
Construct the selected provider in the lifespan hook for every provider, not only easy_auth, so azure_ad/auth0 with missing settings and unknown DATAVIEWER_AUTH_PROVIDER values fail at startup instead of on the first protected request. Startup still skips provider construction when local auth is disabled for a non-hosted provider, matching require_auth. Add lifespan regressions for missing JWT settings, an unknown provider, eager JWT provider construction and the disabled local case, plus middleware-level CORS tests against the real app for wildcard and literal origins. Refs microsoft#1939
|
Marcel Bindseil (@bindsi) Pushed
Backend validation on
The RPI bootstrap question from my last comment no longer applies, since it only covers the Copilot cloud-agent setup. |
Review addressed
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2071 +/- ##
==========================================
- Coverage 87.29% 87.12% -0.18%
==========================================
Files 402 389 -13
Lines 52480 51406 -1074
Branches 7309 7167 -142
==========================================
- Hits 45814 44785 -1029
+ Misses 5365 5352 -13
+ Partials 1301 1269 -32
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
Summary
DATAVIEWER_AZURE_TENANT_ID/DATAVIEWER_AZURE_CLIENT_IDforazure_adandDATAVIEWER_AUTH0_DOMAIN/DATAVIEWER_AUTH0_AUDIENCEforauth0at provider construction (fail closed instead of starting with empty issuer/audience)CORS_ORIGINSentries containing*intoallow_origin_regexso Terraform'shttps://*.<env domain>value matches realOriginheaders under Starlette CORSMiddlewareTests
test_azure_ad_missing_settings_fail_closed/test_auth0_missing_settings_fail_closedtest_cors_wildcard_origins_become_regextest_auth_unit.py+test_config.py: 67 passedFixes #1939