Add Cloudflare Zero Trust SSO authentication#1
Open
sachin-anyteam wants to merge 4 commits intomasterfrom
Open
Add Cloudflare Zero Trust SSO authentication#1sachin-anyteam wants to merge 4 commits intomasterfrom
sachin-anyteam wants to merge 4 commits intomasterfrom
Conversation
Implement Cloudflare Zero Trust (Access) as an authentication provider, enabling users authenticated via Cloudflare to access Metabase without a second login step. Features: - JWT validation using RS256 with Cloudflare's JWKS endpoint - JIT user provisioning (auto-create users on first login) - Optional require-auth mode to enforce Cloudflare-only access - Allowlisted paths for health checks and setup endpoints Security measures: - RS256-only algorithm allowlist (prevents alg=none attacks) - SSRF protection for JWKS URL validation - JWKS caching with automatic refresh on key rotation - Deactivated user rejection - Email normalization before user lookup - Audit event logging Configuration via environment variables: - MB_CLOUDFLARE_ZERO_TRUST_ENABLED - MB_CLOUDFLARE_ZERO_TRUST_TEAM_NAME - MB_CLOUDFLARE_ZERO_TRUST_AUDIENCE_TAG - MB_CLOUDFLARE_ZERO_TRUST_USER_PROVISIONING_ENABLED - MB_CLOUDFLARE_ZERO_TRUST_REQUIRE_AUTH - MB_CLOUDFLARE_ZERO_TRUST_ALLOWED_PATHS Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix Base64 URL decoder usage in JWT header decoding - Use with-redefs instead of with-temporary-setting-values in middleware tests - Use correct metabase.test namespace in test files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add derive statements to register Cloudflare Zero Trust events with the Metabase event system. Events must derive from :metabase/event for publish-event! to work. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Allow disabling password login without requiring a premium license. This enables the MB_ENABLE_PASSWORD_LOGIN=false environment variable to work in the open source build. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Key Changes
New Files
src/metabase/sso/cloudflare_zero_trust/settings.cljsrc/metabase/sso/cloudflare_zero_trust/jwt.cljsrc/metabase/sso/providers/cloudflare_zero_trust.cljsrc/metabase/server/middleware/cloudflare_access.cljModified Files
src/metabase/server/handler.clj- Added middleware to chainsrc/metabase/sso/init.clj- Added provider requiresrc/metabase/sso/settings.clj- Added tosso-enabled?checkSecurity Features
Configuration
Test plan
🤖 Generated with Claude Code