fix: confine event hook script paths to the project tree - #4133
Open
SebTardif wants to merge 1 commit into
Open
Conversation
Event dispatch joined the first scripts: token onto the .specify or extension base with Path. An absolute token discarded the base and ran a host binary. Reject anchored tokens and require the resolved path to stay inside the project root. Assisted-by: Grok (model: grok-4.6, supervised) Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
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.
Description
Event hook script resolution joined the first
scripts:token onto the.specifyor extension base withPath. An absolute token discarded that base and ran a host binary.This rejects anchored tokens (absolute, drive, UNC) and requires the resolved path to stay inside the project root. Relative
..walks that remain in the project still work, including documented extension../../scripts/...references to core scripts. The same check is in the CLI resolver and the generated stdlib dispatcher.Introduced in #3704 (
f8e474d, 2026-07-29).Same-repo path confinement: #3088, #2296, #3869.
Closes #4131
Testing
uv run specify --helpuv sync && uv run pytest(tests/integrations/test_events.py, 121 passed)Added resolver tests for absolute tokens, a walk out of the project, Windows-anchored tokens, extension
../../scripts/..., symlink escape, and an inline-dispatcher run that refuses an absolute host script.AI Disclosure
Code and tests written with Grok (model: grok-4.6) under direct supervision. Reviewed and tested locally before opening this PR.
Posted on behalf of @SebTardif by Grok (model: grok-4.6).