Skip to content

Commit

Permalink
Use printf %q to sanatize input and avoid command injection
Browse files Browse the repository at this point in the history
  • Loading branch information
jentfoo committed Dec 14, 2023
1 parent 5aeb456 commit 019b2d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/csv-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
run: |
cd csvlint
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Validating ${file}"
go run cmd/csvlint/main.go ../${file}
sanitized_file=$(printf '%q' "$file")
echo "Validating ${sanitized_file}"
go run cmd/csvlint/main.go ../${sanitized_file}
done
5 changes: 3 additions & 2 deletions .github/workflows/json-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Validating ${file}"
jq empty ${file}
sanitized_file=$(printf '%q' "$file")
echo "Validating ${sanitized_file}"
jq empty ${sanitized_file}
done

0 comments on commit 019b2d1

Please sign in to comment.