Skip to content

Add Decoding to Secrets#408

Merged
brewgator merged 3 commits into
mainfrom
secret-decoding
Jan 17, 2023
Merged

Add Decoding to Secrets#408
brewgator merged 3 commits into
mainfrom
secret-decoding

Conversation

@brewgator

Copy link
Copy Markdown

Adds support for encoded Vault secrets.
Example usage:

        with:
          namespace: ${{ secrets.VAULT_NAMESPACE }}
          url: ${{ secrets.VAULT_ADDR }}
          method: token
          token: ${{ secrets.VAULT_TOKEN }}
          tlsSkipVerify: false
          secretEncoding: "hex"
          secrets: |
            kv/test foohex | FOOHEX;

Resolves #105

@jasonodonnell
jasonodonnell requested review from a team and removed request for davidadeleon, elliesterner and jasonodonnell January 13, 2023 19:54

@austingebauer austingebauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally looks good! Left a few small comments.

Comment thread src/action.js Outdated
const secretsInput = core.getInput('secrets', { required: false });
const secretRequests = parseSecretsInput(secretsInput);

const secretEncoding = core.getInput('secretEncoding', { required: false });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does anything validate that the given encoding is one of "base64", "hex", "utf8"? Are their other encodings that could work via the buffer.From API that we'd want to prevent from using?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good note. I will add a check for supported encoding type.

Comment thread action.yml Outdated
required: false
default: 3600
secretEncoding:
description: 'Encoding of the secret value. Can be "base64", "hex", "utf8".'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When I first read this, I thought it would encode the secret value. I see that at actually decodes based on the encoding set here. Perhaps we can improve the description to make that more obvious?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is true. Reading it again now I can see how it is fairly confusing. Will work on making that clearer

Comment thread src/action.js
@@ -17,6 +17,8 @@ async function exportSecrets() {
const secretsInput = core.getInput('secrets', { required: false });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be worth dropping a test case in here to cover the behavior. Not sure how challenging that is (still learning about vault-action myself 🙂).

@austingebauer austingebauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@brewgator
brewgator merged commit 0f409d4 into main Jan 17, 2023
@brewgator
brewgator deleted the secret-decoding branch January 17, 2023 16:42
@austingebauer austingebauer mentioned this pull request Jan 26, 2023
TomNorth pushed a commit to TomNorth/vault-action that referenced this pull request Mar 25, 2023
* Add decoding to secrets

* remove index.js

* Add test case, and other updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add base64 decoding[FEAT]

2 participants