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:
24
24
env :
25
25
CHANGED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
26
26
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
+
27
37
new_links=""
28
38
base_link='https://deploy-preview-${{ github.event.number }}--mongodb-docs-csharp.netlify.app'
29
39
files=$(echo "$CHANGED_FILES" | tr "," "\n")
30
40
for file in $files; do
31
41
echo "processing ${file}"
42
+ sanitize_file_path "$file"
32
43
if (! grep -s "includes/" <<< $file) &&
33
44
(! grep -s "images/" <<< $file) &&
34
45
(! grep -s "examples/" <<< $file); then
You can’t perform that action at this time.
0 commit comments