Add routine to ensure k8s svc URL used for internal token retrieval#153
Add routine to ensure k8s svc URL used for internal token retrieval#153
Conversation
📝 WalkthroughWalkthroughTwo files modified: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip Flake8 can be used to improve the quality of Python code reviews.Flake8 is a Python linter that wraps PyFlakes, pycodestyle and Ned Batchelder's McCabe script. To configure Flake8, add a '.flake8' or 'setup.cfg' file to your project root. See Flake8 Documentation for more details. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
hub_adapter/oidc.py (1)
43-58: Edge case:provided_urlmay include the.well-known/openid-configurationpath.If the caller passes a URL already ending with
.well-known/openid-configuration,provided_urlwill include that path. When used in_rewrite_url_origin, the netloc extraction is still correct (path is not part of netloc), so the rewriting should work properly. However, consider documenting thatoidc_urlshould be the base issuer URL when usingrewrite_endpoints=True.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@hub_adapter/oidc.py` around lines 43 - 58, The code uses provided_url (set from oidc_url) when rewriting endpoints, which may itself include the ".well-known/openid-configuration" path; normalize provided_url before rewriting by stripping any trailing slash and removing a trailing ".well-known/openid-configuration" if present so _rewrite_url_origin receives the base issuer origin; modify the block that sets provided_url/oidc_url to normalize provided_url (while still ensuring oidc_url becomes the full well-known endpoint), and keep references to provided_url, oidc_url, rewrite_endpoints, _OIDC_ENDPOINT_FIELDS, and _rewrite_url_origin when implementing this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@hub_adapter/oidc.py`:
- Around line 43-58: The code uses provided_url (set from oidc_url) when
rewriting endpoints, which may itself include the
".well-known/openid-configuration" path; normalize provided_url before rewriting
by stripping any trailing slash and removing a trailing
".well-known/openid-configuration" if present so _rewrite_url_origin receives
the base issuer origin; modify the block that sets provided_url/oidc_url to
normalize provided_url (while still ensuring oidc_url becomes the full
well-known endpoint), and keep references to provided_url, oidc_url,
rewrite_endpoints, _OIDC_ENDPOINT_FIELDS, and _rewrite_url_origin when
implementing this change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d4c01b04-fabf-402d-b686-f8c4bcf48340
📒 Files selected for processing (2)
hub_adapter/auth.pyhub_adapter/oidc.py
Summary by CodeRabbit
New Features
Documentation