20 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, estimate, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | estimate | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| quick-261008-k7s | 01 | execute | 1 |
|
true |
|
|
|
Purpose: a fish user who pastes today's export PATH=... line gets a session-only change and is told to edit a profile that fish does not read. The hint should be one correct line per shell.
Output: updated modules/sunrise/new.sh, its behaviour tests, the gated end-to-end test, the sunrise README and the installation docs page, all in one commit (project rule: code and its README/docs change together). No tag, push or deploy.
<execution_context>
@/.claude/gsd-core/workflows/execute-plan.md
@/.claude/gsd-core/templates/summary.md
</execution_context>
Facts established while planning (do not re-derive):
- Bash fills an unset
SHELLfrom the passwd entry:env -u SHELL bash -c 'declare -p SHELL'printsdeclare -- SHELL="/usr/bin/fish"on this host. The test harness builds the environment from scratch withoutSHELL, so without a harness default every case would see the developer's login shell and the existingexport PATHassertions would fail on a fish machine.SHELL=(set, empty) survives: bash keeps an existing variable. - Go's
exec.Cmdkeeps the last value whenEnvholds a key twice, so a default appended beforeh.envis overridden by a per-case entry inh.env. scripts/check-phase14.3.sh(acceptance and production stages, near line 306) grepsexport PATH="/root/go/bin:$PATH"from a node:24-bookworm container. ThereSHELLis not in the environment, so bash fills it from root's passwd entry (/bin/bash), and the bash branch prints exactly that export line. The gate keeps working unchanged; do not edit it. The site repo's TestTerminalCommands puts GOBIN first on PATH, so it never sees a hint..planning/phases/14.3-.../14.3-SECURITY-REVIEW.mdsays new.sh is shellcheck clean "except one deliberate SC2016 for the literal$PATHin the hint". Keep that true: no new shellcheck disable directives.- The
--forbiddengate stage fails if new.sh contains the framework configuration prefix (the upper-case word SUMMER followed by an underscore). The script's ownSUMMERCMS_names do not match it. Do not add new variable names with that prefix. - The docs checker only checks
pkg.Identcode spans andsummer/./bin/<app>commands in shell fences, sofish_add_path,~/.zshrcand a fish line inside anshfence are safe.shis the only shell fence language the docs use; do not add afishfence. - macOS still ships bash 3.2 for
curl | bash, and bash 5.2 turned onpatsub_replacement, which changes how&and backslashes behave in the replacement part of the substitution expansion. A per-character loop behaves the same on both.
-
Add a function, defined above
mainlike every other helper so the truncation guarantee holds (name itdq_escapeor similar, with a one-line comment in the file's style). It prints its first argument escaped for use inside double quotes of the shell named by its second argument. For every shell: a backslash before each backslash, double quote and dollar sign. For any shell other than fish, also a backslash before each backtick, and each!replaced by close-quote, single-quoted!, reopen-quote (the three characters"'!'"around nothing else), so interactive bash and zsh do not history-expand a pasted line. Fish double quotes treat backtick and!literally, and a backslash before them would stay in the path, so the fish form leaves them alone. Build the result with a per-character loop over${#s}/${s:i:1}and acaseon the character, not the substitution expansion (see the bash 3.2 / 5.2 fact in context). Only builtins, all locals declaredlocal. -
Replace the hint block at the end of
main(theif [[ :${PATH:-}: != *":$gobin:"* ]]block; the PATH test itself stays as it is). Inside it: take the login shell name as the basename of${SHELL:-}by parameter expansion (##*/), always via${SHELL:-}becausemainruns underset -u. Choose a note and a form by acaseon the name:fishgives the notefish_add_path also keeps it for new fish sessions;zshgivesand add it to ~/.zshrc;bashgivesand add it to ~/.bashrc; anything else, empty included, givesand add it to your shell profile. Print the header with the existing format,\n==> summer is installed in %s, which is not on your PATH. Run this (%s):\n, fed the raw gobin and the note. Then for fish printfish_add_path "%s"\nwith the fish-escaped dir; for every other shell keep the single existingexport PATH="%s:$PATH"\nprintf, now fed the POSIX-escaped dir, with its existing SC2016 disable comment and the "$PATH stays literal" comment. That stays the only disable directive in the file. Store notes in variables or format strings, never as a bare quoted word that starts with a tilde, because shellcheck SC2088 flags those. -
In the header comment, after the environment overrides block, add one line saying the login shell named by SHELL only picks the form of the PATH hint printed at the end (fish, zsh, bash, or a generic export line). Leave the "Only bash builtins and the git, go and docker commands are used" sentence true.
In modules/sunrise/script_behavior_test.go:
-
In
run(), add"SHELL="to the environment beforeh.envis appended, with a comment saying bash fills an unset SHELL from the passwd entry, so the default keeps cases independent of the developer's login shell and a case sets its own SHELL throughh.env. -
Add a harness field
unsetShell bool. When it is true,run()starts bash with-cand a command string that unsets SHELL and then sources the script given as$0with the remaining arguments (h.scriptas$0, the case args after it), so the script runs with SHELL truly unset underset -u. All otherrun()behaviour (dir, env, stdin probe, result) stays the same. -
Add two Go helpers:
expectLacks(the mirror ofexpectContains) and a function that returns the expected escaped dir for the POSIX or the fish form, built withstrings.NewReplacerusing exactly the mapping from step 1. Use it for every expected hint line so the expectations do not depend on characters in the temp root. -
Replace the "GOBIN off PATH prints the hint" case and add cases so the table covers each bullet in
<behavior>: empty SHELL (harness default), unset (h.unsetShell = true), unknown (/bin/tcsh), fish, zsh, bash (/usr/local/bin/bash, a path that differs from the common default), and the two metacharacter cases. For the metacharacter cases, seth.gobinto a new dir underh.rootwhose name holds a space, backslash, double quote, dollar, backtick and!, create it withos.MkdirAllbeforeh.mustRun("demo"), and assert the exact full command line, for example the export line with the escaped dir followed by:$PATH". Extend "GOBIN on PATH prints no hint": set SHELL=/usr/bin/fish and also rejectfish_add_path. "empty GOBIN installs into GOPATH/bin" keeps its export assertion (it runs with the empty default). Raise thelen(cases) < 18floor to the new total.
In modules/sunrise/sunrise_test.go TestBootstrapEndToEnd:
- Drop SHELL from the inherited environment (add
key == "SHELL"to the skip list) and add"SHELL=/bin/bash"to the initial env slice, with a short comment that the hint form follows SHELL. Keep the existingexport PATH="+gobin+:$PATH"assertion and also require(and add it to ~/.bashrc):.
Do not commit in this task. Task 2 commits code and docs together.
cd /media/nvme/dev/golem15/summercms.io/summercms/summercms.go && set -o pipefail && shellcheck -s bash modules/sunrise/new.sh && test "$(grep -c 'shellcheck disable' modules/sunrise/new.sh)" -eq 1 && bash -n modules/sunrise/new.sh && go vet ./modules/sunrise/ && go test ./modules/sunrise/ -short -count=1 -v -run '^(TestScriptEmbedded|TestScriptShape|TestScriptTruncationRunsNothing|TestScriptBehavior|TestScriptShellcheck)$' 2>&1 | grep -E '^(--- |ok|FAIL|panic)'
shellcheck prints nothing, the file has exactly one disable directive, and go vet passes. The go test output shows --- PASS: for TestScriptEmbedded, TestScriptShape, TestScriptTruncationRunsNothing, TestScriptBehavior and TestScriptShellcheck (not SKIP), with no --- FAIL. Every new TestScriptBehavior subtest passes, and the generic-hint output is byte-identical to the pre-change text.
-
docs/setup/installation.md:- Step 3 of "What the script does" (around line 33): replace "the script ends with the
export PATH=...line to run and to add to your shell profile" with the per-shell description: the script reads your login shell fromSHELLand ends withfish_add_path <dir>in fish, which keeps the directory for new sessions, or withexport PATH="<dir>:$PATH", to add to~/.zshrcin zsh,~/.bashrcin bash or your shell profile in any other shell. - "Install the summer CLI" (around lines 102-106): keep the
export PATH="$(go env GOPATH)/bin:$PATH"fence for bash and zsh, saying to add it to~/.bashrcor~/.zshrcto keep it. Then add a fish sentence and a secondshfence containingfish_add_path (go env GOPATH)/bin, noting that fish keeps it for new sessions without a profile edit. Useshas the fence language (see context). - Leave the frontmatter
descriptionunchanged.
- Step 3 of "What the script does" (around line 33): replace "the script ends with the
-
Run the full gates (the verify command below).
go test ./... -shortcan take several minutes, so run it with a generous timeout. Then confirm the gate's pinned hint still holds without editing the gate:grep -nF 'export PATH="/root/go/bin:$PATH"' scripts/check-phase14.3.shstill matches, and the bash branch of new.sh prints that shape (Task 1 covers this). Do not editscripts/check-phase14.3.shor14.3-SECURITY-REVIEW.md. -
Optional, when network and time allow:
SUMMERCMS_BOOTSTRAP_CHECK=1 go test ./modules/sunrise/ -run TestBootstrapEndToEnd -count=1 -timeout 20m. It is not part of the acceptance. -
Make one commit holding exactly the five files in
files_modified, for examplefeat(sunrise): print the PATH hint for the user's login shell, with a body naming the fish, zsh, bash and generic forms and the escaping. Add no co-author or attribution trailer (user and project rule). Do not tag, push or deploy. cd /media/nvme/dev/golem15/summercms.io/summercms/summercms.go && grep -qF 'fish_add_path (go env GOPATH)/bin' docs/setup/installation.md && grep -qF 'fish_add_path' modules/sunrise/README.md && grep -qF '~/.zshrc' docs/setup/installation.md && grep -qF 'export PATH="/root/go/bin:$PATH"' scripts/check-phase14.3.sh && go vet ./... && go test ./cmd/summer -run '^TestDocsTree$' -count=1 && go run ./cmd/summer docs:build --check && bash scripts/check-phase14.3.sh --forbidden && go test ./... -short -count=1 go vet ./... and go test ./... -short are green. TestDocsTree passes,summer docs:build --checkreports no problems, and the--forbiddenstage prints "Phase 14.3 forbidden-surface scan passed". The README and installation page describe the fish, zsh, bash and generic forms, and the manual section showsfish_add_path (go env GOPATH)/bin. scripts/check-phase14.3.sh is unchanged. One commit holds the five files, with no co-author trailer. Nothing is tagged, pushed or deployed.
<threat_model>
Trust Boundaries
| Boundary | Description |
|---|---|
| script output → user's interactive shell | The user pastes the printed hint line into fish, zsh or bash, so whatever the line contains runs there. |
| environment → script | SHELL, GOBIN and GOPATH come from the user's own environment and Go config. |
STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|---|---|---|---|---|---|
| T-k7s-01 | Elevation of Privilege | new.sh hint line (install dir interpolated into a pasted command) | medium | mitigate | The escaping helper backslash-escapes backslash, double quote and dollar for every shell, plus backtick for POSIX shells, and isolates ! in single quotes for bash and zsh, so command substitution or history expansion in the dir cannot run when pasted. Pinned by the two metacharacter TestScriptBehavior cases. |
| T-k7s-02 | Tampering | SHELL value |
low | accept | Used only as a case pattern subject after basename stripping. It is never printed, executed or used as a path, and an unknown value falls back to the generic hint. |
| T-k7s-03 | Denial of Service | set -u with SHELL unset |
low | mitigate | Read via ${SHELL:-}. Pinned by the unset-SHELL harness case. |
| T-k7s-04 | Tampering | newline inside GOBIN/GOPATH | low | accept | Pathological Go configuration that the user controls. The printed line would wrap but stays quoted, and nothing is executed by the script itself. |
| T-k7s-SC | Tampering | npm/pip/cargo installs | low | accept | This plan installs no packages and adds no Go module requirement. The --forbidden stage confirms go.mod gained no require. |
| </threat_model> |
<success_criteria>
A fish user running the one-liner with GOBIN off PATH sees fish_add_path "<dir>" and is told fish keeps it. zsh and bash users see the export line with ~/.zshrc or ~/.bashrc. Everyone else sees today's exact text. The tests are deterministic regardless of the developer's login shell, the docs match, and the change lands as one commit with no tag, push or deploy.
</success_criteria>