-
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
unseal with wrong key returns HTTP 500 instead of 400 (again?) #17792
Comments
I had a go at this. I don't think that this was fixed in 1.11.x as the referenced ticket mentions. |
Thanks for filing this ticket. I just checked the response error code going back to Vault 1.8, and we have always returned 500 error code if the unseal key is a properly b64 encoded key, however, it is invalid. On the other hand, providing an improper key, like
I am going to close this ticket for now. Please reopen this issue or open a new one for further discussions. |
Based on the previous comment, it sounds like this was never actually fixed, and looking at the 1.8.0 behavior confirms that. Looking at the 1.0.0 behavior, it seems like it used to.
|
@hghaf099 Doesn't seem like I can re-open this issue, but I still feel like this is a bug worth fixing. The response return, be it status code or message, is inadequate to inform the user of the actual issue -- that the specified key is invalid. A 500 error suggests the server encountered something that was an unexpected condition -- but an invalid key should be an expected condition and return a non-500 error like it used to. |
@arusso One thing I would note is that Vault has not always returned the "expected" error or code, as a defense against fuzzing. There are no right or wrong answers here, so please assume positive intent on my part when I ask what your expectations may be, for both a positive user experience and a negative fuzzing experience? I am genuinely curious, and I know Hamid and all of our engineering and product crew are too. Thanks! |
I understand the point about fuzzing, but in this case unsealing happens infrequently and once unsealed, attempting to further unseal isn't useful. I wouldn't expect vaults to be in an unsealed state for a long time. I think given that assumption on my part, that the returning of a 400 is still acceptable since it only reveals what's already obvious, either the unseal worked or it didn't. By returning a 500 error, you're only confusing the vault admin because they've got a generic server side error that, at least to me, seems to indicate the inability to unseal their vault, implying some sort of corruption / etc. |
Thank you for your input - genuinely! This is always a bit of a gray area for how the Vault engineering teams handle these kinds of cases. There are always arguments both pro and con. Please rest assured that I'll make sure we have a discussion about this with all our stakeholders. I appreciate your patience! |
My use case is that I have several Vault clusters, each with their own unseal keys. When accidentally unsealing a cluster with the wrong unseal key, you get back a cryptic error that seems like it is a temporary issue, so you should retry. Of course, by now I have internalized that 'HTTP 500 - message authentication failed' is an user error and actually means the unseal key is wrong. But still, I think UX takes a hit here. |
Thanks again for filing this issue. The above discussion make sense and we discussed it internally, and we would like to get the issue fixed. |
Describe the bug
Attempting to unseal with an incorrect but valid key (ie. old key) returns a 500 instead of a 400.
To Reproduce
Steps to reproduce the behavior:
vault server -dev
VAULT_ADDR=http://localhost:8200 vault operator seal
VAULT_ADDR=http://localhost:8200 vault operator unseal
and pass in an invalid token.Expected behavior
The error returns is a 400 error, clearly indicating a client/request issue and not a server error.
Environment:
vault status
):vault version
):Vault server configuration file(s):
N/A (default in-memory database with no config)
Additional context
We encountered this on an update from 1.10.3 -> 1.12.1. I confirmed issue is present on both versions.
Looks like this might be a regression? This was previously an issue and fixed in #8425.
The text was updated successfully, but these errors were encountered: