mux: base64-encode additional_arguments before templating the start script
- Dominant language
- HCL
- Stars
- 79
- Forks
- 161
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 38
Description
Follow-up from https://github.com/coder/registry/pull/1095 (review thread https://github.com/coder/registry/pull/1095#discussion_r3928942890).
`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.
Contributor guide
Assessment
This issue has not been assessed yet.