-
Notifications
You must be signed in to change notification settings - Fork 5
Support skipping OIDC validation checks #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThree boolean flags — SkipIssuerCheck, SkipAudienceCheck, SkipExpiryCheck — were added to configuration (builder and FromEnv), a parseBoolEnv helper was introduced, and those flags are propagated into provider.Config to control validator checks instead of hardcoded values. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant Conf as ConfigBuilder
participant Prov as Provider
participant Val as Validator
App->>Conf: Build config (FromEnv or fluent)
note right of Conf `#DFF2E1`: Config now includes skip flags
Conf->>Prov: createProvider(cfg)
Prov->>Val: init validator with\nSkipIssuerCheck, SkipAudienceCheck, SkipExpiryCheck
Val-->>Prov: validator instance
Prov-->>App: provider (validator configured)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
config.go(4 hunks)provider/provider.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
config.go (2)
provider/provider.go (1)
Logger(24-29)logger.go (1)
Logger(22-27)
🔇 Additional comments (4)
provider/provider.go (2)
33-40: LGTM with security caveat.The new configuration fields are correctly defined. However, these flags bypass critical security validations.
Ensure these flags are:
- Documented with clear security warnings
- Used only in development/testing environments
- Never enabled in production
Consider adding runtime warnings when these checks are disabled.
209-211: LGTM!The validator configuration correctly maps the new config flags to the OIDC verifier settings, replacing the previously hardcoded
falsevalues.config.go (2)
34-38: LGTM!The configuration fields are correctly defined with appropriate documentation.
318-320: Missing test coverage for security bypass flags.Verification confirms no tests exist for the new skip flags. Critical test coverage gaps:
- Environment variable parsing tests (
OIDC_SKIP_AUDIENCE_CHECK,OIDC_SKIP_ISSUER_CHECK,OIDC_SKIP_EXPIRY_CHECK)- Validation that flags default to
false(secure-by-default)- Independent flag behavior verification
- Combined flag scenarios
Add tests covering all above cases before merging, particularly to ensure security defaults are maintained.
bd04072 to
8d50963
Compare
8d50963 to
31b7df3
Compare
Signed-off-by: Christian Troelsen <christian.troelsen@tryg.dk>
31b7df3 to
5fbe515
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
config.go (2)
36-39: LGTM: Skip validation flags added correctly.The three boolean fields are well-named and properly integrated into the Config struct. They default to false (validation enabled), which is the safe default.
Optional: Consider adding doc comments to each field explaining the security implications of skipping these validation checks, especially for users who may not fully understand OIDC security requirements.
327-338: LGTM: Robust boolean parsing with safe defaults.The
parseBoolEnvhelper correctly usesstrconv.ParseBoolto handle standard boolean representations and safely falls back to the default value on parse errors or empty values. This fail-safe approach ensures validation remains enabled by default.Optional: Consider logging parse errors to aid debugging when users provide invalid boolean values (e.g., "yes" instead of "true"). However, the current silent fallback is safe and acceptable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
config.go(5 hunks)provider/provider.go(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- provider/provider.go
🧰 Additional context used
🧬 Code graph analysis (1)
config.go (2)
provider/provider.go (1)
Logger(24-29)logger.go (1)
Logger(22-27)
🔇 Additional comments (4)
config.go (4)
5-5: LGTM: Import added for boolean parsing.The
strconvimport is necessary for theparseBoolEnvhelper and is correctly placed.
127-135: LGTM: Skip flags correctly propagated to provider config.The mapping from
Configtoprovider.Configis correct, including the previously identified copy-paste error on line 135 which has been properly fixed (now correctly mapsSkipExpiryChecktocfg.SkipExpiryCheck).
235-251: LGTM: Builder methods follow the pattern correctly.The three new builder methods are properly implemented following the fluent builder pattern. Documentation comments are correct and consistent (previous typos have been fixed).
319-321: LGTM: Environment variable parsing implemented correctly.The skip flags are properly initialized from environment variables using the
parseBoolEnvhelper, which correctly handles boolean values. Safe defaults (false = validation enabled) are used, and the environment variable names follow clear naming conventions.
A work in progress
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.