-
Notifications
You must be signed in to change notification settings - Fork 138
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
[BUG] v2.1.2 breaks secrets in JSON format #194
Comments
His @dlavrenuek, this is unfortunate due to the change made on parsing secrets from Vault. We're taking a look at this. |
Hi @jasonodonnell, do you know what the use case for this PR was #173 and how this was tested? From what I can see in the code is that even tho the secret is parsed with |
@jasonodonnell this issue is open for quite some time now, is it planned to fix it? |
Any updates on this, I am unable to use this functionality, and would very much like to. |
Hi @dlavrenuek or @MattPumphrey I have been unable to capture this in the e2e tests. See my PR here: #466 If you can help me recreate this issue then I can try to get it fixed. Manual repro steps would be fine too if you can't provide pointers on my tests. Thanks! |
@fairclothjm I think the case (as mentioned above) is if you use 'unquoted' json secret stored in vault such as: In your tests you are wrapping the json in single quotes, which is not the exact case here Try to store the unquoted json in Vault/env and run the test btw, yes I can also confirm that when storing the unquoted json, you will get env variable with double quotes being removed from the secret. |
Released Vault GitHub Action v2.7.0 which should fix this regression! |
Released Vault GitHub Action v2.7.2 which should (finally) fix this regression! |
As noted above, this has to do with how the secret is stored in Vault. The solution for this as of Vault Action v2.7.3 is to access the secret via the environment variable that is set by Vault Action. For example, with the following setup jobs:
build:
# ...
steps:
# ...
- name: Import Secrets
id: import-secrets
uses: hashicorp/vault-action@v2
with:
url: https://vault.mycompany.com:8200
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
secret/data/json-data jwt_data | MY_JWT ;
# ... We can access the environment variables like #...
- name: Step following 'Import Secrets'
run: |
echo "$JWT_DATA"
echo "$MY_JWT"
# ... The JSON will be properly formatted. |
Describe the bug
vault-action
v2.1.2
breaks the secrets that are stored as json, for example json web token keys, because the values are now parsed as json instead of a string REF.To Reproduce
Example secret that is stored as json:
Was in
v2.1.1
passed to the application in the correct JSON format asIn
v2.1.2
it is passed to the application as JavaScript object representation, which is not valid JSON:This results in a fatal error in the application due to invalid formatting.
Expected behavior
The secrets in JSON format should not be modified and passed to the application in valid JSON format.
The text was updated successfully, but these errors were encountered: