Skip to content

Commit 215bcdf

Browse files
fix: pass inputs via env vars instead of direct interpolation to prevent command injection
Agent-Logs-Url: https://github.com/SuffolkLITLab/ALActions/sessions/78ea72fc-6e6b-408a-9683-624ed558179e Co-authored-by: nonprofittechy <7645641+nonprofittechy@users.noreply.github.com>
1 parent a962a84 commit 215bcdf

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

da_build/action.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,42 +42,50 @@ runs:
4242
shell: bash
4343

4444
- name: Run YAML Checker
45+
env:
46+
SKIP_URL_CHECK: ${{ inputs.skip-url-check }}
47+
SKIP_TEMPLATES: ${{ inputs.skip-templates }}
48+
IGNORE_URLS: ${{ inputs.ignore-urls }}
4549
run: |
4650
# necessary because dayamlchecker.check_questions_urls isn't a binary.
4751
source $(uv tool dir)/dayamlchecker/bin/activate
4852
4953
args=()
50-
if [ "${{ inputs.skip-url-check }}" = "true" ]; then
54+
if [ "$SKIP_URL_CHECK" = "true" ]; then
5155
args+=(--no-url-check)
5256
fi
5357
54-
if [ "${{ inputs.skip-templates }}" = "true" ]; then
58+
if [ "$SKIP_TEMPLATES" = "true" ]; then
5559
args+=(--url-check-skip-templates)
5660
fi
5761
58-
if [ -n "${{ inputs.ignore-urls }}" ]; then
59-
args+=(--url-check-ignore-urls "${{ inputs.ignore-urls }}")
62+
if [ -n "$IGNORE_URLS" ]; then
63+
args+=(--url-check-ignore-urls "$IGNORE_URLS")
6064
fi
6165
6266
find . -name "*.yml" -path "*/questions/*" -print0 | xargs -0 python -m dayamlchecker "${args[@]}"
6367
shell: bash
6468

6569
- name: Check URLs in question/template files
70+
env:
71+
SKIP_URL_CHECK: ${{ inputs.skip-url-check }}
72+
SKIP_TEMPLATES: ${{ inputs.skip-templates }}
73+
IGNORE_URLS: ${{ inputs.ignore-urls }}
6674
run: |
6775
# necessary because dayamlchecker.check_questions_urls isn't a binary.
6876
source $(uv tool dir)/dayamlchecker/bin/activate
69-
if [ "${{ inputs.skip-url-check }}" = "true" ]; then
77+
if [ "$SKIP_URL_CHECK" = "true" ]; then
7078
echo "Skipping URL checks"
7179
exit 0
7280
fi
7381
7482
args=()
75-
if [ "${{ inputs.skip-templates }}" = "true" ]; then
83+
if [ "$SKIP_TEMPLATES" = "true" ]; then
7684
args+=(--skip-templates)
7785
fi
7886
79-
if [ -n "${{ inputs.ignore-urls }}" ]; then
80-
args+=(--ignore-urls "${{ inputs.ignore-urls }}")
87+
if [ -n "$IGNORE_URLS" ]; then
88+
args+=(--ignore-urls "$IGNORE_URLS")
8189
fi
8290
8391
output_file="$(mktemp)"

0 commit comments

Comments
 (0)