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

Add error handling for malformed auth headers #858

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

reweeden
Copy link
Contributor

@reweeden reweeden commented Jan 6, 2025

Currently if we send an auth header without the string Bearer we'll see an error like this:

$ curl -X GET --header "Authorization: foobar" http://...
{"Code":"InternalServerError","Message":"An internal server error occurred."}

With these changes:

$ curl -X GET --header "Authorization: foobar" http://...
{"status_code":400,"error_description":"Malformed Authorization header"}

NOTE: CMR accepts an authorization header containing just the token, so it is reasonable that some users might see that and try the same approach with TEA.

@reweeden reweeden marked this pull request as ready for review January 6, 2025 23:27
@reweeden reweeden force-pushed the rew/auth-header-bad-request branch from c320e44 to fbb3916 Compare January 10, 2025 18:22
thin_egress_app/app.py Outdated Show resolved Hide resolved
@reweeden reweeden force-pushed the rew/auth-header-bad-request branch from fbb3916 to 52e3c1d Compare January 13, 2025 18:20
@reweeden reweeden force-pushed the rew/auth-header-bad-request branch from 52e3c1d to 936f709 Compare January 13, 2025 19:01
@reweeden reweeden merged commit fa681ac into devel Jan 13, 2025
10 of 12 checks passed
@reweeden reweeden deleted the rew/auth-header-bad-request branch January 13, 2025 19:38
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.

4 participants