Skip to content

Commit f190123

Browse files
committed
Address review: bash backslash traversal guard, wheel packaging
- Reject backslash separators and Windows drive-letter paths in bash context_file validation (prevents traversal on Git-Bash/Windows) - Add extensions/agent-context to pyproject.toml force-include so the bundled extension is included in wheel builds
1 parent df18341 commit f190123

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

extensions/agent-context/scripts/bash/update-agent-context.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,15 @@ if [[ -z "$CONTEXT_FILE" ]]; then
9999
exit 0
100100
fi
101101

102-
# Reject absolute paths and '..' path segments in context_file
103-
if [[ "$CONTEXT_FILE" == /* ]]; then
102+
# Reject absolute paths, backslash separators, and '..' path segments in context_file
103+
if [[ "$CONTEXT_FILE" == /* ]] || [[ "$CONTEXT_FILE" =~ ^[A-Za-z]: ]]; then
104104
echo "agent-context: context_file must be a project-relative path; got '$CONTEXT_FILE'." >&2
105105
exit 1
106106
fi
107+
if [[ "$CONTEXT_FILE" == *\\* ]]; then
108+
echo "agent-context: context_file must not contain backslash separators; got '$CONTEXT_FILE'." >&2
109+
exit 1
110+
fi
107111
IFS='/' read -ra _cf_parts <<< "$CONTEXT_FILE"
108112
for _seg in "${_cf_parts[@]}"; do
109113
if [[ "$_seg" == ".." ]]; then

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ packages = ["src/specify_cli"]
4040
"scripts/powershell" = "specify_cli/core_pack/scripts/powershell"
4141
# Bundled extensions (installable via `specify extension add <name>`)
4242
"extensions/git" = "specify_cli/core_pack/extensions/git"
43+
"extensions/agent-context" = "specify_cli/core_pack/extensions/agent-context"
4344
# Bundled workflows (auto-installed during `specify init`)
4445
"workflows/speckit" = "specify_cli/core_pack/workflows/speckit"
4546
# Bundled presets (installable via `specify preset add <name>` or `specify init --preset <name>`)

0 commit comments

Comments
 (0)