Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/ci/strix_quick_gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ if "\\" in relative_path_str:
normalized = posixpath.normpath(relative_path_str)
if normalized in (".", "") or normalized.startswith("../") or normalized == "..":
raise SystemExit(1)
if not re.fullmatch(r"[A-Za-z0-9_./ -]+", normalized):
if not re.fullmatch(r"[A-Za-z0-9_./ \[\]-]+", normalized):
raise SystemExit(1)
relative_path = Path(normalized)
if relative_path.is_absolute():
Expand Down Expand Up @@ -506,7 +506,7 @@ target_path = Path(raw_target)
if not target_path.is_absolute():
target_path = repo_root / target_path

resolved = target_path.resolve(strict=False)
resolved = target_path.resolve(strict=True)
print(resolved)
PY
})" || {
Expand Down Expand Up @@ -538,7 +538,7 @@ import sys

raw_target = sys.argv[1]
target_path = Path(raw_target)
resolved = target_path.resolve(strict=False)
resolved = target_path.resolve(strict=True)
print(resolved)
PY
})" || {
Expand Down
7 changes: 7 additions & 0 deletions scripts/ci/test_strix_quick_gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ assert_strix_workflow_pr_trigger_hardened() {
assert_strix_gate_target_scope_separated() {
assert_file_not_contains "$GATE_SCRIPT" "or generated PR scope directories" "strix gate keeps user target validation separate from internal PR scopes"
assert_file_contains "$GATE_SCRIPT" "TARGET_PATH_IS_INTERNAL_PR_SCOPE" "strix gate marks internally generated PR scan scopes explicitly"
assert_file_not_contains "$GATE_SCRIPT" "resolved = target_path.resolve(strict=False)" "strix gate must resolve scan targets strictly"
}

assert_internal_pr_scope_targets() {
Expand Down Expand Up @@ -2748,6 +2749,12 @@ run_pull_request_target_head_scope_case \
"BASE_CONTENT_WITH_SPACE_SHOULD_NOT_BE_SCANNED" \
"HEAD_CONTENT_WITH_SPACE_SHOULD_BE_SCANNED"

run_pull_request_target_head_scope_case \
"pull-request-target-nextjs-bracket-route-uses-head-blob" \
"frontend/src/app/labels/[slug]/page.tsx" \
"BASE_BRACKET_ROUTE_CONTENT_SHOULD_NOT_BE_SCANNED" \
"HEAD_BRACKET_ROUTE_CONTENT_SHOULD_BE_SCANNED"

run_pull_request_target_rejects_unsafe_changed_path_case \
"pull-request-target-parent-directory-changed-path-fails-closed" \
"../outside.py"
Expand Down
Loading