Skip to content
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

builtin.Authenticate panics if the Authorization header is missing or empty #619

Closed
mansam opened this issue Mar 28, 2024 · 2 comments
Closed
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/normal Higher priority than priority/minor. Nice to have. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@mansam
Copy link
Collaborator

mansam commented Mar 28, 2024

// Authenticate the token
func (r *Builtin) Authenticate(request *Request) (jwToken *jwt.Token, err error) {
	token := strings.Replace(request.Token, "Bearer", "", 1)
	token = strings.Fields(token)[0]

If the Authorization header is missing or the string after replacement is nothing but whitespace, then strings.Fields will return an empty slice, and the attempt to index into it will panic. This should be fixed to return an auth failure.

@mansam mansam added kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. priority/normal Higher priority than priority/minor. Nice to have. labels Mar 28, 2024
@konveyor-ci-bot
Copy link

This issue has been marked 'good first issue'
Please, make sure it aligns with the criteria found here

@jortel jortel added this to the v0.4.0 milestone Apr 1, 2024
@jortel
Copy link
Contributor

jortel commented Apr 2, 2024

I do not think changes to the AUTH layer is a good first issue.

@jortel jortel modified the milestones: v0.4.0, v0.5.0 Jun 6, 2024
jortel pushed a commit that referenced this issue Jun 11, 2024
fix for issue / #619 
Missing Bearer token return error instead of panicking. 
Also updated [Client.send()
method](https://github.com/konveyor/tackle2-hub/blob/main/binding/client.go#L639)
to work with bearer tokens.

---------

Signed-off-by: Ross <ross@roceb.xyz>
Co-authored-by: Ross <ross@roceb.xyz>
@jortel jortel closed this as completed Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/normal Higher priority than priority/minor. Nice to have. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants