-
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
Transit byok import endpoints #15414
Conversation
a82449d
to
6633769
Compare
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.
Pretty good overall, just a few comments. Appreciate the thorough test coverage.
…nvert Transit wrapping key endpoint to use shared wrapping key retrieval method. Disallow import of convergent keys to Transit via BYOK process.
…specify OAEP random oracle hash function used to wrap ephemeral AES key.
… panic in Transit import. Proactively zero out ephemeral AES key used in Transit imports.
…ral key is of the size specified byt the RFC.
…n to avoid errors on BYOK keys with allow_rotation=false.
…d Transit import unit tests. Added unit tests for Transit import_version endpoint.
… but reject with an error when the field is provided.
6633769
to
d8d310a
Compare
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.
Sorry late to the review party, a few comments but overall 👍
AllowImportedKeyRotation: allowRotation, | ||
} | ||
|
||
switch keyType { |
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.
nit: since we test within parseHashFn in a case-insensitive fashion, should we do the same here?
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.
Might as well!
lm.cache.Store(req.Name, p) | ||
} | ||
|
||
lock.Unlock() |
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.
Shouldn't this have been written as a deferred statement after the lock.Lock() on line 466? If we error out we aren't releasing the lock correct?
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.
Yep, good catch. If this errored, it'd deadlock that policy.
Summary
This adds two new endpoints to the Transit backend that enable BYOK (bring your own key):
keys/:name/import
, which imports an external key into a new Transit key for use within Vault.keys/:name/import_version
, which imports an external key into a new version of an existing Transit key for use within Vault.The intended use cases for Transit BYOK are seamless migration to Vault from legacy HSM/KMS solutions and import of externally-generated shared keys into an organization that already uses Transit. Since the security of imported keys cannot be guaranteed, and because the import process is complicated, this feature is not recommended for use without a full understanding of security implications.