feat: do not show oidc consent screen every time - #989
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesOIDC authorization now validates client configuration, signs approved scopes into a per-client cookie, verifies that cookie on later requests, and derives OIDC scope consent flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Browser
participant OIDCController
participant OIDCService
participant OIDCClient
Browser->>OIDCController: Send authorize request
OIDCController->>OIDCService: Verify approved scope cookie
OIDCService-->>OIDCController: Return verification result
OIDCController->>OIDCClient: Get client configuration
OIDCClient-->>OIDCController: Return client
OIDCController-->>Browser: Return consent response and signed scope cookie
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/service/oidc_service.go (1)
310-328: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winOIDC startup now rejects legacy client configs
internal/service/oidc_service.go:310-328
NewOIDCServicenow hard-fails on any client that doesn't use a UUIDclientIdand a 32+ char secret. The repo still has OIDC fixtures usingsome-client-id/some-client-secret, so add a migration path or keep accepting legacy values with a warning.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/service/oidc_service.go` around lines 310 - 328, Update NewOIDCService’s client validation to preserve backward compatibility with legacy client IDs and secrets used by existing fixtures. Replace the unconditional UUID and 32-character secret failures around uuid.Validate and the client-secret length check with a migration or compatibility path that accepts legacy values while emitting clear warnings, while retaining strict validation for newly configured clients where appropriate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/controller/oidc_controller.go`:
- Around line 247-259: Bind the consent cookie to the authenticated user in the
OIDC prompt handling around VerifySignedValue: include the current user's stable
identity, such as the `sub` claim, in the signed payload and validate that same
identity before skipping consent. Update the consent-cookie creation logic to
sign the identical user-bound value, and clear or invalidate the cookie during
logout so it cannot survive account changes.
In `@internal/service/oidc_service.go`:
- Around line 995-997: Replace the regular string comparison in
OIDCService.VerifySignedValue with hmac.Equal, comparing the generated signature
and signedValue as byte slices to ensure constant-time verification.
---
Outside diff comments:
In `@internal/service/oidc_service.go`:
- Around line 310-328: Update NewOIDCService’s client validation to preserve
backward compatibility with legacy client IDs and secrets used by existing
fixtures. Replace the unconditional UUID and 32-character secret failures around
uuid.Validate and the client-secret length check with a migration or
compatibility path that accepts legacy values while emitting clear warnings,
while retaining strict validation for newly configured clients where
appropriate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 90bd38a8-adfa-4101-b24a-c7a3dd3a322e
📒 Files selected for processing (6)
frontend/src/pages/authorize-page.tsxinternal/bootstrap/app_bootstrap.gointernal/controller/oidc_controller.gointernal/model/constants.gointernal/model/runtime.gointernal/service/oidc_service.go
# Conflicts: # internal/controller/oidc_controller.go # internal/model/runtime.go
Summary by CodeRabbit
New Features
Bug Fixes