coder / coder/registry

mux: base64-encode additional_arguments before templating the start script

Open
#1,096 1 comment 0 reactions 0 assignees View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.