hashicorp / hashicorp/vault-action

[BUG] Key names with hyphens (-) are improperly normalized when exported

Open
#577 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
513
Forks
166
Avg merge
6d 4h
Merged PRs (30d)
1

Description

## Vault server version
Vault v1.15.6

## vault-action version
v3.2.0

## Describe the bug
I have encountered an issue in the Vault Action where key-pairs with hyphens (-) in their names are being normalized incorrectly during export. Instead of preserving the hyphen in the key names, the hyphens are removed, which changes the intended key name.

For example:

Expected behavior: The key test-123 should remain as test-123.

Actual behavior: The key test-123 is exported as test123.

## To Reproduce
- name: Authenticate to Vault
id: import-secrets
uses: hashicorp/vault-action@4b1f32b3950e4f24c67ba6ffac1f047ea60707f1 # v3.2.0
with:
url: ${{ steps.get-config-variables.outputs.vault_endpoint }}
method: jwt
path: xx
role: ${{ steps.get-config-variables.outputs.vault_role }}
jwtGithubAudience: ${{steps.vault_auth.outputs.audience}}
exportEnv: false
secrets: |
${{env.HASHICORP_VAULT_BASE_PATH}}/${{ matrix.pair.hc_kv_name }} *

- name: Fetch outputs
run: |
touch secrets.json
echo '${{ toJson(steps.import-secrets.outputs) }}' >> secrets.json
cat secrets.json

output: secrets.json
{
"test123": "***"
}

## Additional context
Relevant code of the normalizeOutputKey function causing issue https://github.com/hashicorp/vault-action/blob/main/src/utils.js#L9.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.