File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,22 @@ jobs:
2424 env :
2525 CHANGED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
2626 run : |
27+ # Function to sanitize file paths
28+ sanitize_file_path() {
29+ local file_path="$1"
30+ # Allow only alphanumeric characters, _ . / and -
31+ if [[ ! "$file_path" =~ ^[a-zA-Z0-9._/-]+$ ]]; then
32+ echo "Invalid file path detected: $file_path" >&2
33+ exit 1
34+ fi
35+ }
36+
2737 new_links=""
2838 base_link='https://deploy-preview-${{ github.event.number }}--mongodb-docs-csharp.netlify.app'
2939 files=$(echo "$CHANGED_FILES" | tr "," "\n")
3040 for file in $files; do
3141 echo "processing ${file}"
42+ sanitize_file_path "$file"
3243 if (! grep -s "includes/" <<< $file) &&
3344 (! grep -s "images/" <<< $file) &&
3445 (! grep -s "examples/" <<< $file); then
You can’t perform that action at this time.
0 commit comments