-
Notifications
You must be signed in to change notification settings - Fork 665
OCPBUGS-64943: Make GetUserFromRequestContext more nil safe #15711
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
|
@TheRealJon: This pull request references Jira Issue OCPBUGS-64943, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
afff9b4 to
23f29e6
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Leo6Leo, TheRealJon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
QE verification |
|
I'm still seeing the runtime errors
|
Hello @yapei , I think this error is not caused by @TheRealJon 's PR, since I can reproduce it on other branches. I have identified the issue, and opened a PR. #15746 |
|
@Leo6Leo Is this nil pointer dereference error in https://issues.redhat.com//browse/OCPBUGS-64943 the same with https://issues.redhat.com//browse/OCPBUGS-65804? (they look pretty similar even same) |
23f29e6 to
c18e689
Compare
|
New changes are detected. LGTM label has been removed. |
WalkthroughRefactored GetUserFromRequestContext in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (1)
pkg/auth/user.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
pkg/auth/user.go
🔇 Additional comments (2)
pkg/auth/user.go (2)
17-20: Good defensive check for missing context value.The nil check for
userValueproperly handles the case whereUserContextKeyis not present in the context.
22-25: LGTM: Explicit type assertion prevents panics.The explicit type assertion with the
okcheck safely handles cases where the context value is not of type*User, preventing potential panics from failed type assertions.
c18e689 to
7baea63
Compare
|
@yapei I believe the comment has been addressed, I'm not sure how we're ever getting nil passed into that function, but apparently it's happening! |
|
Thanks for catching it @yapei, you are right! I didn't read deeper into that function. I figured that the call stack is:
The PR #15746 I opened only solves the surface But that PR fix still apply, as nil pointer shouldn't be passed in |
|
@TheRealJon: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
No description provided.