Skip to content

bug: variable export does not handle newline characters #9

Description

@wiggels

Variable export does not handle newlines when passed in from kv store.
This is shown when attempting to grab a pem certificate from kv store when the kv contains newline characters:

/scripts-2258-127217/step_script: line 159: export: `KEY-----': not a valid identifier
/scripts-2258-127217/step_script: line 159: export: `9rm46[redacted]I22LQ3T': not a valid identifier
/scripts-2258-127217/step_script: line 159: export: `p/W7s[redacted]eyxKvbj': not a valid identifier
/scripts-2258-127217/step_script: line 159: export: `6uHak[redacted]GY5S9j': not a valid identifier
/scripts-2258-127217/step_script: line 159: export: `YoZAJ[redacted]L0khZ6': not a valid identifier
...
/scripts-2258-127217/step_script: line 159: export: `-----END': not a valid identifier
/scripts-2258-127217/step_script: line 159: export: `KEY-----': not a valid identifier

This could be solved with wrapping the variable in quotes like in this commit; however, that would also introduce the possibility of truncating any secret that contains " ' " unless we create another function that does single quote escaping before piping to printf.

Activity

  1. oulman commented on Jun 2, 2022

    @oulman
    Owner

    Sorry for the delay in responding. I have a couple of possible ideas here but let me get back to you shortly. Thanks!

  2. self-assigned this
    on Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions