Repository navigation
test: make the verifier's fake curl robust to whitespace in sys.executable - #5362
Open
mehdikarimi55 wants to merge 2 commits into
Open
mehdikarimi55 wants to merge 2 commits into
mehdikarimi55 wants to merge 2 commits into
Conversation
…table
On macOS the kernel splits a shebang line on whitespace, so the fixture's
"#!{sys.executable}" shebang fails with ENOENT whenever the checkout
lives under a path containing a space (e.g. "GitHub Contribution/"),
producing 4 test failures. Route the fake curl through /bin/sh with a
shlex.quote'd interpreter, matching the existing pattern in
tests/extensions/test_extension_agent_context.py; with -c, sys.argv[1:]
stays exactly the curl argument list, so the assertions are unchanged.
Fixes github#5360
AI disclosure: agent-authored commit — OpenCode running GLM 5.3 Flash
(Z.ai), agent mode under human supervision by mehdikarimi55; root-cause
analysis, code change, and test execution performed by the agent.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the fixture change preserves the existing security assertions while addressing interpreter paths containing whitespace.
No open issues 🎉
What changed in this PR
This test-only PR hardens the workflow-step submission verifier’s fake curl fixture so it works when sys.executable is located under a path containing whitespace, particularly on macOS.
Changes:
- Replaces the whitespace-sensitive Python shebang with a
/bin/shwrapper. - Uses
shlex.quoteto safely invoke Python while preserving the originalcurlargument list. - Retains the existing malicious-input and injection-prevention assertions.
| File | Description |
|---|---|
| tests/test_workflow_step_submission.py | Updates the fake curl fixture to safely invoke Python from interpreter paths containing whitespace. |
Review effort: Lite (auto)
Collaborator
|
Please address Copilot feedback |
Copilot review noted the regression test still ran with the ambient sys.executable, whose path has no whitespace on CI, so restoring the old direct shebang would not fail there. Reach the interpreter through a symlink inside a directory whose name contains a space, making the direct-shebang fixture fail with ENOENT on every machine and locking in the /bin/sh fix. Assisted-by: GLM (model: GLM 5.3 Flash, supervised by mehdikarimi55) AI disclosure: agent-authored commit - GLM 5.3 Flash, supervised by mehdikarimi55; test change and red/green verification performed by the agent.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the fixture change addresses interpreter paths containing whitespace while preserving argument-integrity coverage.
No open issues 🎉
1 resolved since last review
Review effort: Lite (auto)
This branch has not been deployed
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.

Fixes #5360
Problem
tests/test_workflow_step_submission.py::test_fetch_keeps_malicious_text_in_one_argument_even_if_validation_is_bypassedfails 4 times (one per parametrized suffix) when the spec-kit checkout lives under a path containing whitespace — e.g.~/Downloads/GitHub Contribution/spec-kit:Root cause
The fixture writes its fake
curlwith a#!{sys.executable}shebang. On macOS the XNU kernel splits the shebang line on whitespace, so an interpreter path like/Users/me/Downloads/GitHub Contribution/spec-kit/.venv/bin/pythonis parsed as interpreter/Users/me/Downloads/GitHubwith argumentContribution/....execvefails with ENOENT and the test reports "No such file or directory: 'curl'". GitHub CI never sees this (runner paths have no spaces), but desktop checkouts with a space in the path hit it deterministically.Fix
Route the fake
curlthrough#!/bin/shwith ashlex.quoted interpreter — the same established pattern as_ensure_test_python_on_path()intests/extensions/test_extension_agent_context.pyandmake_python3_path_shim()intests/parity_helpers.py. With-c,sys.argv[1:]is exactly the argument listcurlwas invoked with, so the test's assertions (len(args) == 14,args[-1] == url) are unchanged.Test-only change; no product code touched.
Evidence
Reproduction of the kernel behavior outside the suite:
And in the suite, in the affected environment (macOS 15 arm64, checkout under a path with a space):
.venv/bin/python -m pytest tests/test_workflow_step_submission.py -q # before: 4 failed after: 271 passedAI disclosure
Agent-authored commit and PR — OpenCode running GLM 5.3 Flash (Z.ai), agent mode under human supervision by @mehdikarimi55. The agent performed reproduction, root-cause analysis, the code change, and test execution; changes were reviewed by the account owner before submission.