Skip to content

mux: base64-encode additional_arguments before templating the start script #1096

Description

@ibetitsmike

Follow-up from #1095 (review thread #1095 (comment)).

main.tf passes var.additional_arguments straight into scripts/start.sh.tftpl. The value is free-form: if it contains $(...), backticks or embedded double quotes, that text is spliced into the Bash source of the start script. Command substitutions then run while the script is evaluated, before xargs splits the intended arguments, and quotes can leave the launcher malformed.

AGENTS.md (template encoding rules) requires free-form strings to be passed as base64encode(var.foo) and decoded in the template with ARG_FOO=$(echo -n '${ARG_FOO}' | base64 -d).

Proposed change:

  • ADDITIONAL_ARGUMENTS : base64encode(var.additional_arguments) in main.tf
  • decode into a shell variable at the top of start.sh.tftpl and keep the existing xargs parsing on the decoded value
  • update the custom_additional_arguments tftest and the "parses custom additional_arguments" container test, and add a case with a quote and a $(...) literal that must be passed through verbatim

This predates #1095 (the same interpolation existed in run.sh) and was kept out of that PR to limit its scope to the persistent, version-aware install.

Xum acted on behalf of @ibetitsmike when filing this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions