Bug fixing OIDCPolicy#2032
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds listener port in the proto and reconciler; introduces OIDCPolicy.GetBaseURL; preserves request.query in the target-cookie CEL expression; centralises OPA rego generation using indexof/substring for robust cookie parsing; and adds unit tests for these behaviours. ChangesOIDC Policy redirect URI, cookie, and query fixes
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
59198ee to
188e6a5
Compare
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2032 +/- ##
==========================================
+ Coverage 74.90% 75.00% +0.10%
==========================================
Files 127 127
Lines 12528 12619 +91
==========================================
+ Hits 9384 9465 +81
- Misses 2655 2668 +13
+ Partials 489 486 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
188e6a5 to
20b2966
Compare
* Using indexof and substring to split only on the first = character. This correctly handles JWT tokens with base64 padding (= or ==). * Extracted to function in order to be more testable and maintainable. Signed-off-by: dd <4183971+didierofrivia@users.noreply.github.com>
* using CEL's ternary operator: request.path + (request.query != "" ? "?" + request.query : "") Signed-off-by: dd <4183971+didierofrivia@users.noreply.github.com>
20b2966 to
c14f482
Compare
Signed-off-by: dd <4183971+didierofrivia@users.noreply.github.com>
Signed-off-by: dd <4183971+didierofrivia@users.noreply.github.com>
|
👀 |
Signed-off-by: dd <4183971+didierofrivia@users.noreply.github.com>
* It has omitempty prop https://github.com/Kuadrant/authorino/blob/c8fde6d394ffe10c73a98d7450116ec862d4d6ca/pkg/service/well_known_attributes.go#L67 Signed-off-by: dd <4183971+didierofrivia@users.noreply.github.com>
| return fmt.Sprintf(` | ||
| "target=" + request.path + (has(request.query) && request.query != "" ? "?" + request.query : "") + "; domain=%s; HttpOnly; %s SameSite=Lax; Path=/; Max-Age=3600"`, hostname, getSecureFlag(protocol)) | ||
| } |
There was a problem hiding this comment.
The issue is that request.path in Authorino's CEL context already includes the query string (it's the full request URI, e.g. /get?foo=bar&baz=qux). Appending "?" + request.query on top of that duplicates the query parameters: e.g target=/get?foo=bar&baz=qux?foo=bar&baz=qux
Closes #2017
Verification Steps
Bug 1 Verification:
Should return: True
Look for the redirectURI in the token request body CEL expression - it should include the port, In the metadata.token.http.body expression
You should see:
"&redirect_uri=http%3A%2F%2Fexample.com%3A8001%2Fauth%2Fcallback"Note the %3A8001 (URL-encoded :8001)
Look in .spec.overrides.authScheme.response.unauthenticated.headers.location.value
the redirect_uri parameter should include :8001
Should see: domain=example.com (not example.com:8001)
Bug 2 Verification:
Should return: indexof(trimmed (confirming the fix is present)
Should return nothing (empty)
Should contain:
Bug 3 Verification:
Should contain:
Should return nothing (empty)
Summary by CodeRabbit
New Features
Tests