Skip to content

Validate inputs in OAuthBearerSetToken #2444

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danwkennedy
Copy link

What

The documentation for OAuthBearerSetToken notes that tokenValue and principalName are required parameters but doesn't check them for null values. As seen in this issue, if principalName is null, the underlying library call will segfault (and do so silently in a Docker/Kubernetes environment. To keep from segfaulting, we can simply check those values for null and throw accordingly.

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

Issue: #2158

Test & Review

Open questions / Follow-ups

@Copilot Copilot AI review requested due to automatic review settings April 2, 2025 18:18
@danwkennedy danwkennedy requested review from a team as code owners April 2, 2025 18:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces null checks for the required parameters of OAuthBearerSetToken to prevent a segmentation fault when invalid arguments are provided.

  • Adds checks to ensure tokenValue and principalName are not null.
  • Throws an ArgumentNullException if either parameter is null.

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@rayokota
Copy link
Member

rayokota commented Apr 4, 2025

/sem-approve

@rayokota
Copy link
Member

rayokota commented Apr 4, 2025

/sem-approve

Copy link
Contributor

@Havret Havret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's would be nice to have a test for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants