Repository navigation
fix: keep following cd past a plain command substitution (0.7.3) - #15
Merged
Merged
Conversation
The guard hook stopped following directory changes at any parenthesis, so `cd <project> && ... && cd .sdlc/changes/<slug> && D=$(date +%F) && cat > spec.md` counted spec.md as a project write. A `$(...)` with no cd and no nested parenthesis cannot move the shell, so it no longer stops the following; its inner commands are still scanned. Subshells, groups, nested shells, quoted substitutions, outside directories, and .sdlc/.. traversal are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Guard hook false denial, follow-up 4 of #14. Hook-only patch:
0.7.2 -> 0.7.3, changelog entry## 0.7.3 - 2026-11-08, both manifests bumped.Cause
The denied command in the 0.7.2 manual-harness run was
cd "<project>" && mkdir -p .sdlc/changes/<slug> && cd .sdlc/changes/<slug> && D=$(date +%Y-%m-%d) && cat > spec.md <<'EOF' .... The trigger was the$(date ...)between the twocds, not the absolutecd. Any parenthesis madeshellWritesOutsideSdlcstop following directory changes, sospec.mdcounted as a project file. The abstract chain (absolutecd, other commands, relativecd) already passed on 0.7.2; those cases are in the tests as regression pins.Change
hooks/edit_guard.py: before the parenthesis check, a$(...)that holds no directory change and no nested parenthesis is dropped from the text checked. It cannot move the shell, and its inner commands are still scanned as segments, so a write inside it is still seen. One regex, two lines.Still denied (tested)
.sdlc/, or in.sdlc/../traversalcdto a directory outside the projectcdin a subshell( ... ), a group, a nested shell, or inside a$(...).sdlc/Known limit
A
$(...)in quotes (D="$(date +%F)") still stops the following, because quoted text is hidden from the scan and the substitution inside it cannot be checked. Documented in the changelog.Checks
python scripts/test_edit_guard.py: red on the real-shape command before the change, green after. Dropping the "nocdinside" condition makes an existing negative fail.python scripts/check_version.py,--self-test,python scripts/test_behavior_check.py,claude plugin validate .: pass.🤖 Generated with Claude Code