summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ai-validation.yml16
1 files changed, 16 insertions, 0 deletions
diff --git a/.github/workflows/ai-validation.yml b/.github/workflows/ai-validation.yml
index 18671c9d..8e254dcc 100644
--- a/.github/workflows/ai-validation.yml
+++ b/.github/workflows/ai-validation.yml
@@ -54,6 +54,22 @@ jobs:
# target path, never the target's content.
mkdir _changed_md
while IFS= read -r -d '' path; do
+ # Path-traversal hardening: even though git's tree machinery
+ # rejects `..` segments and absolute paths in committed entries
+ # at the porcelain level, treat fork-controlled diff input as
+ # untrusted and validate explicitly. A path like
+ # `docs/../../outside.md` would otherwise let `git show`
+ # write outside _changed_md/.
+ if [[ "$path" == /* \
+ || "$path" == *"/../"* \
+ || "$path" == "../"* \
+ || "$path" == *"/.." \
+ || "$path" == ".." ]]; then
+ echo "::warning::Skipping unsafe path with traversal/absolute prefix: $path"
+ continue
+ fi
+ # Skip non-regular tree entries (symlinks, submodules) per the
+ # commit immediately preceding this one.
mode=$(git ls-tree HEAD -- "$path" | awk '{print $1}')
case "$mode" in
100644|100755) ;;