-
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
Fix transit panic with invalid PEM #22753
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When an invalid (non-PEM) public key is given to Transit's import, this fails with a panic in server logs: 2023-09-05T08:11:11.526-0400 [INFO] http: panic serving 127.0.0.1:42414: runtime error: invalid memory address or nil pointer dereference goroutine 950 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb9 panic({0x8371620?, 0x1050b390?}) /usr/local/go/src/runtime/panic.go:920 +0x270 github.com/hashicorp/vault/sdk/helper/keysutil.(*Policy).ImportPublicOrPrivate(0xc003fff440, {0xaf02918, 0xc004509920}, {0xaf03670, 0xc0032e4180}, {0xc004532ea0, 0x188, 0x1a0}, 0x0, {0xae7f5e0, ...}) /home/cipherboy/GitHub/cipherboy/vault/sdk/helper/keysutil/policy.go:1538 +0x687 github.com/hashicorp/vault/sdk/helper/keysutil.(*LockManager).ImportPolicy(0xc001a29410, {0xaf02918, 0xc004509920}, {{0xaf03670, 0xc0032e4180}, {0xc003eb5ab5, 0xb}, 0x3, 0x0, 0x0, ...}, ...) /home/cipherboy/GitHub/cipherboy/vault/sdk/helper/keysutil/lock_manager.go:517 +0x38a This is unfortunate and doesn't reveal the cause of the failure: input was not provided in PEM format, per docs. Signed-off-by: Alexander Scheel <[email protected]>
Signed-off-by: Alexander Scheel <[email protected]>
cipherboy
added
bug
Used to indicate a potential bug
secret/transit
backport/1.14.x
labels
Sep 5, 2023
github-actions
bot
added
the
hashicorp-contributed-pr
If the PR is HashiCorp (i.e. not-community) contributed
label
Sep 5, 2023
Build Results: |
stevendpclark
approved these changes
Sep 5, 2023
This should probably have a changelog associated with it? |
CI Results: |
Signed-off-by: Alexander Scheel <[email protected]>
stevendpclark
approved these changes
Sep 5, 2023
kitography
approved these changes
Sep 5, 2023
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.
Looks Great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Used to indicate a potential bug
hashicorp-contributed-pr
If the PR is HashiCorp (i.e. not-community) contributed
secret/transit
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When an invalid (non-PEM) public key is given to Transit's import, this fails with a panic in server logs:
This is unfortunate and doesn't reveal the cause of the failure: input was not provided in PEM format, per docs.