Repository navigation
test(sweep): execute the param-env loop instead of reading it - #703
Merged
Merged
Conversation
#531's fix — single-quoting spawn:param:* tag values into /etc/profile.d/spawn-params.sh — was already in place and verified only by reading. #680 showed why that is insufficient: its nested-quote rendering was syntactically valid and silently wrong. The test extracts the real loop from the generated bootstrap (not a restatement, which would verify the copy), runs it against values including $HOME/out, run "A", it's, $(id -u) and a path with a space, then bash -n's the output and sources it. Every value must round-trip byte for byte, with HOME set to a sentinel that would show expansion. Confirmed to fail when double-quoting is restored. Also verified with no change needed: param names cannot inject, because shellIdentifier rejects learning-rate, x;id, spaces and $(...) before launch.
scttfrdmn
force-pushed
the
test/531-execute-param-env
branch
from
October 5, 2026 01:33
eebb6b1 to
3239807
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #531 as already fixed — with the verification it never had.
The fix was in; nothing had run it
The generated bootstrap already single-quotes
spawn:param:*tag values into/etc/profile.d/spawn-params.sh, using the close/escape/reopen idiom, and the code comment cites this issue. So the reported bug — a value of$HOME/outbeing expanded by every login shell, and a value containing"breaking the generated line outright — is fixed.But it had only ever been verified by reading, and #680 just demonstrated why that is not enough: its nested-quote rendering (
echo "export EFS_MOUNT="/efs"") was syntactically valid, passed review, and silently produced the wrong value for any path with a space. Reading shell you have written is the weakest possible check on it.So this adds the test that runs it.
What the test does
It extracts the real export loop from the generated bootstrap and rewrites only its output path — rather than restating the loop in the test, which would verify the copy and not the shipped script. Then it feeds a tag stream through the actual
aws ec2 describe-tags --output textshape (key<TAB>value, one per line):$HOME/outrun "A"it's$(id -u)`id`a'b"c$de``/a b/cand then checks three things: the generated file parses (
bash -n), sourcing it returns every value byte for byte, and$HOME— set to/SHOULD-NOT-APPEAR— never expands.Confirmed to fail when I restore the double-quoted form: the file stops parsing and the shape gate names the cause.
The parse check matters independently. A quoting bug corrupts the rest of the file, not just the one variable — so a single bad value takes out every parameter after it, which is why #531 described it as corrupting the environment for the whole instance.
Param names: checked, no change needed
I went looking for the adjacent hole, since the name is interpolated unquoted too:
A name like
x;idwould end the statement and leaveid='v'as a second command in a file every login shell sources. I demonstrated that in a scratch shell before checking whether it was reachable — and it is not.resolveParamNamevalidates againstshellIdentifier=^[A-Za-z_][A-Za-z0-9_]*$, so these are all rejected before launch with a message explaining that parameters becomePARAM_<key>variables:learning-rateis the realistic one — a hyphen is natural in a config key — and rejecting it up front with that message is better than the alternative, which would have beenexport: not a valid identifieron every login and a workload seeing no parameter at all.Values containing a newline are rejected too, since they cannot survive an EC2 tag.
Gates
gofmt -lempty,go vet ./...,go test -short ./...(whole module), changelog gate,semgrep→ 0 findings. Also ranmake changelog-fix— this and #702 each added an### Addedgroup.