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

The default value of token_validate will change from True to False in version 4.0.0 #248

Closed
briantist opened this issue Apr 24, 2022 · 0 comments · Fixed by #317
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@briantist
Copy link
Collaborator

briantist commented Apr 24, 2022

SUMMARY

As a holdover from the original hashi_vault lookup, token auth does a lookup-self on the given token as a way to try to determine if the token is valid.

Later an option token_validate was added to control this (so that it could be turned off), because in some cases, tokens don't have permission to perform that operation.

But its default was set to true to match previous behavior.

However, this lookup is a largely unnecessary extra round-trip for everything that uses token auth, that's on by default.

The only real advantage of doing this lookup is that we can provide a more specific error message if this fails. Without this lookup, the token will attempt to be used for whatever operation is being performed, and if it's not valid, the failure returned will depend on the operation somewhat, and so it may look like a different error (permission denied for example).

The disadvantages of doing this "validation" are:

  • It's not actually validating the validity of the token
  • It does not determine whether the token has the permission needed to perform the operation it needs to perform
  • It could prevent unauthenticated endpoints from working if an old inferred token is read (from the sink file for example), unless none auth is explicitly chosen (arguably, you should be choosing none if you are hitting an unauthenticated endpoint)
  • It's an extra round-trip

The only other area where this matters is in the vault_login lookup/module. Using token auth in vault_login returns the token itself (there is no login operation to perform), but it has to use lookup-self to get any additional information about the token, otherwise it will only return the token value (in the familiar structure).

So I have two options for vault_login:

  1. Let the default change (keep inheriting from the global definition)
  2. Change the default globally, but override the default in vault_login to be true.

I am leaning toward option 1; the other information returned is the information least likely to be used, the option can be set explicitly, and there will be sufficient announcement of the change.

After some testing, I will go with option 2. The issue is larger than just "extra" information, it's that with vault_login there is no "actual" operation to perform with a "token" login that will fail. So if you call vault_login with "token" auth and a bad/expired token, it will just return that (it will "succeed"). So I think validation defaulting to true for vault_login only makes sense.

ISSUE TYPE
  • Feature Idea
@briantist briantist added the enhancement New feature or request label Apr 24, 2022
@briantist briantist self-assigned this Apr 24, 2022
@briantist briantist added this to the v4.0.0 milestone Apr 24, 2022
@briantist briantist changed the title Change default value of token_validate, announce deprecation/breaking change The default value of token_validate will change from True to False in version 4.0.0 May 8, 2022
@briantist briantist pinned this issue May 8, 2022
@briantist briantist unpinned this issue Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant