Skip to content

Secret values containing leading or trailing space characters cause plan to fail #1303

@talentedmrjones

Description

@talentedmrjones

This issue has affected several tests as well as a real user (@helderco ). In some cases #SecretExec may fix this with echo -n. In other cases like gitpull.go we had to use strings.TrimSpace before using the secret plain text value. In some cases it seems the presence of trailing space characters (including \n) doesn't matter but on other cases it does.

A quick test of these scenarios proved that adding strings.TrimSpace to plancontext.New() solved the issue across the board.

PROPOSAL

Add a flag to engine._#inputSecret:

trimSpace: *true | false

plancontext.New() will then user strings.TrimSpace() if trimSpace=true

This solves for all secret types (env var, file, and exec) and gives the user the ability to opt out of trimming for any scenario where a space may actually be included in the secret value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions