[BUG] Error parsing multi-line secrets because the output contains "\n"
See original GitHub issueDescribe the bug
We currently have a vault secret that is a multi-line exported certificate. When setting it to an env variable, the output of vault-action contains \n
instead of new lines.
To Reproduce Store a multi line pub key, eg:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3
Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA
NrRFi9wrf+M7Q==
Notice that the key will be returned as
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU\nGPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3\nPbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA\nNrRFi9wrf+M7Q==
Expected behavior Since the key is being used to sign an app it needs to be returned without the line escaping.
By adding a result = JSON.parse(result)
before removing the quote we are able to get the expected value and our code sign task succeeds but I doubt that’s the correct fix.
https://github.com/hashicorp/vault-action/blob/master/src/secrets.js#L75
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
1649075 – Multiline secrets are not correctly parsed
The offending line appears to be: <FIRST LINE OF THE SSH KEY> <SECOND LINE OF THE SSH KEY> ^ here ``` This happens...
Read more >Eclipse CDT Custom Compiler Error Parsing Plugin
I have a make file setup which is nice, but I'd like IDE integration with the error / warning output of my compiler....
Read more >How do you fix the Azure DevOps Error: Secrets cannot ...
##[error]Error: Secrets cannot contain multiple lines. Looking in Secrets Manager in the AWS Console will not reveal the problem.
Read more >Multi-line secret value - Drone
In fact, If the value happens to be multi-line, the YAML should have it in quotes. Otherwise it should result in parsing error....
Read more >Resolve Secrets Manager secret access errors after ... - AWS
How can I resolve issues accessing an encrypted AWS Secrets Manager secret? ... Because AWS KMS managed key policies can't be edited, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the delay, we have a company wide shutdown for a few weeks in December and are just returning. We’ll take a look at this soon!
Fixed per #173.