-
Notifications
You must be signed in to change notification settings - Fork 292
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
bug(vault): Correctly handle credential stores with expired tokens #2399
Conversation
d1bbd4c
to
9ec7ec1
Compare
internal/db/schema/migrations/oss/postgres/48/01_vault_credentials.up.sql
Outdated
Show resolved
Hide resolved
Boundary makes use of a database view to perform CRUD operations on Vault credential stores and libraries. This view did not include credential stores with tokens that have expired in Vault, causing errors when attempting to perform any action against them.
8c8465a
to
191a854
Compare
@mgaffney PTAL, please note I did rebase on main and force pushed. The original implementation is completely different so no need to see what changed since the last time you looked. But if you pull locally you will have a conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
internal/db/schema/migrations/oss/postgres/48/01_vault_credentials.up.sql
Outdated
Show resolved
Hide resolved
internal/db/schema/migrations/oss/postgres/48/01_vault_credentials.up.sql
Outdated
Show resolved
Hide resolved
cert.certificate_key as ct_client_key, -- encrypted | ||
cert.key_id as client_key_id | ||
from credential_vault_store store | ||
left join credential_vault_token token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this view need to return a value when there is no current
vault token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This view is used in the update path of the store, so it needs to return the store to update even if the token is expired.
It is also reused in the credential_vault_library_issue_credentials
view, when issuing credentials we return an error if the any of the requested libraries have an expired token. We could modify this to do a len compare and validate the number of requests and returned libraries are equal, but the expired error is probably more clear.
internal/db/schema/migrations/oss/postgres/48/01_vault_credentials.up.sql
Outdated
Show resolved
Hide resolved
Deployment failed with the following error:
|
@louisruch Note that you'll need to renumber the migration |
internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Fixes #2349 and fixes #2179
Results from some manual testing:
Read expired store:
Update expired store:
Read after update: