Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Improve Credential Errors #223

Merged
merged 16 commits into from
Dec 15, 2020
Merged

Conversation

Marton6
Copy link
Member

@Marton6 Marton6 commented Nov 11, 2020

This PR:

  • improves the error returned when the credential is password-protected, but no passphrase reader is provided.
  • wraps all errors that occur when loading a credential with a message that includes the credential's source
  • adds the SECRETHUB_CREDENTIAL_PASSPHRASE environment variable, which is checked if no passphrase reader is provided, but the credential is password-protected

This interface is meant to be implemented by credential readers and
add more information to credential-related errors. If implemented by
a credential reader, every credential parsing, decoding and decrypting
error will also include the source of the credential (path to credential
file or environment variable name).
pkg/secrethub/credentials/readers.go Outdated Show resolved Hide resolved
pkg/secrethub/credentials/providers.go Outdated Show resolved Hide resolved
SimonBarendse
SimonBarendse previously approved these changes Nov 16, 2020
Copy link
Member

@SimonBarendse SimonBarendse left a comment

Choose a reason for hiding this comment

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

Awesome! Big improvement 😄

pkg/secrethub/credentials/key.go Outdated Show resolved Hide resolved
pkg/secrethub/credentials/providers.go Outdated Show resolved Hide resolved
pkg/secrethub/credentials/providers.go Outdated Show resolved Hide resolved
pkg/secrethub/credentials/encoding.go Outdated Show resolved Hide resolved
Marton6 and others added 4 commits December 2, 2020 16:04
Co-authored-by: Simon Barendse <SimonBarendse@users.noreply.github.com>
Co-authored-by: Simon Barendse <SimonBarendse@users.noreply.github.com>
Co-authored-by: Simon Barendse <SimonBarendse@users.noreply.github.com>
@Marton6
Copy link
Member Author

Marton6 commented Dec 2, 2020

Apparently the errors are still not wrapped correctly. For example in case of an invalid credential supplied through the SECRETHUB_CREDENTIAL environment variable. I'll investigate the issue.

@Marton6
Copy link
Member Author

Marton6 commented Dec 4, 2020

It seems that the issue with errors not being wrapped correctly was related to the CLI code. I implemented the necessary changes in: secrethub/secrethub-cli#358

pkg/secrethub/credentials/key.go Outdated Show resolved Hide resolved
pkg/secrethub/credentials/readers.go Outdated Show resolved Hide resolved
jpcoenen and others added 4 commits December 15, 2020 13:55
…key credential

This allows setting a passphrase without having to provide a credential itself, which can be used to make configuring the Terraform provider easier.
Add option set set a default passphrase reader
Co-authored-by: Marton Soos <marton.soos@secrethub.io>
@Marton6 Marton6 merged commit 2ff078d into develop Dec 15, 2020
@Marton6 Marton6 deleted the feature/improve-credential-errors branch December 15, 2020 16:20
@SimonBarendse SimonBarendse mentioned this pull request Feb 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants