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

Return a 403 for a bad SSCT instead of 500 #16112

Merged
merged 5 commits into from
Jun 23, 2022
Merged

Return a 403 for a bad SSCT instead of 500 #16112

merged 5 commits into from
Jun 23, 2022

Conversation

raskchanky
Copy link
Contributor

Closes #16102

if err != nil {
return nil, fmt.Errorf("server side consistent token check failed: %w", err)
return logical.ErrorResponse(fmt.Sprintf("bad token: %s", err.Error())), logical.ErrPermissionDenied
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure it's a good idea to put the actual error message into the response, helpful though it would be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can log it instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure we should log it either. Since this can be done without authentication, it could allow a bad actor to fill up log devices.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ncabatoff we already have logs being generated as part of the SSCT checks if those checks fail. I'm not too sure what to do here, since on one hand we don't want to leak data about the token, but on the other hand debugging failing requests will be much more difficult if we don't have the information in the logs that point to exactly what is failing (lagging WALs, wrong key, etc.). What do you suggest we do?

Copy link
Collaborator

Choose a reason for hiding this comment

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

All I can say is that, in general, Vault requests, especially unauthenticated ones, should not result in logging. We sometimes make exceptions, particularly when we discover something surprising/concerning about the state of vault. In this case the problem can be purely user-side though, so I think the risk of harm is more important than the help for debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll remove the logging.

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.

Error code 500 when looking up bad token
3 participants