-
Notifications
You must be signed in to change notification settings - Fork 9
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
def: support secret encryption + decryption #155
Conversation
f0f044f
to
2aeb566
Compare
2aeb566
to
0239480
Compare
This is ready for review. PTAL. |
eval/crypt.go
Outdated
// decryptSecret decrypts a single ciphertext string into its plaintext value. | ||
func decryptSecret(ctx context.Context, decrypter Decrypter, base64Ciphertext string) (string, error) { | ||
// Decode and decrypt the ciphertext. | ||
ciphertext, err := base64.StdEncoding.DecodeString(base64Ciphertext) |
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.
Does the encrypter also handle b64 encoding?
` | ||
|
||
_, err := EncryptSecrets(context.Background(), "doc", []byte(doc), broken{}) | ||
assert.NoError(t, err) |
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 is this NoError rather than Error? Same for the matching decrypt test.
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.
Ah--malformed secrets are ignored by the encrypt/decrypt paths. Error reporting will happen if/when the environment is parsed.
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.
I'll add a comment to that effect
7f83b69
to
c9ca96e
Compare
These changes add support for encrypting and decrypting static secrets in environment definitions. Encryprtion and decryption is handled as a pre-evaluation pass. The parser expects secrets to be decrypted prior to parsing, and will issue errors if it detects encrypted secrets. Encrypted secrets are represented in the document by calls to `fn::secret` of the form ```yaml fn::secret: ciphertext: <base64-encoded value> ``` In order to support this representation, `fn::secret` now requires that its argument is a boolean, number, or string literal.
c9ca96e
to
2fa5852
Compare
These changes add support for encrypting and decrypting static secrets in environment definitions. Encryprtion and decryption is handled as a pre-evaluation pass. The parser expects secrets to be decrypted prior to parsing, and will issue errors if it detects encrypted secrets.
Encrypted secrets are represented in the document by calls to
fn::secret
of the formIn order to support this representation,
fn::secret
now requires that its argument is a string literal.