-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Panic when token is null for /v1/auth/token/lookup, /v1/auth/token/renew, /v1/auth/token/revoke, /v1/auth/token/revoke-orphan #13225
Comments
Hi @ludovicianul! Thanks for this report, interesting stuff! I'll get some engineers on it next week (most are out today). Thanks again! |
Hi, I've taken a look at this issue and was able to reproduce and fix it on my local environment. According to the stack trace the error/panic occurs in the According to a Stack Overflow thread and Golang documentation: "x.(T) asserts that x is not nil and that the value stored in x is of type T" I was able to fix this error by adding a condition that checks if the interface is nil before doing any type assertions and it now returns a proper error response. |
Would I be able to submit a PR for this @hsimon-hashicorp @ludovicianul? |
Describe the bug
Making a
POST
at any of the 4 URLs withtoken = null
results in no HTTP response and the following stacktrace:To Reproduce
Steps to reproduce the behavior:
curl -X POST -H 'Content-Type: application/json' -H "X-Vault-Token: $token" -d '{"token": null}' http://localhost:8200/v1/auth/token/lookup
Same steps to reproduce for all paths.
This was discovered while running a fuzzing tool I wrote for OpenAPI specs: https://github.com/Endava/cats. You can replay all the tests using:
./cats.jar replay --testCases="Test386.json,Test1618.json,Test3540.json,Test4288.json"
TestCases.zip
Expected behavior
A proper HTTP response:
400
with someerrors
details.Environment:
vault status
): 1.9.0vault version
): Vault v1.9.0The text was updated successfully, but these errors were encountered: