From 55d7f2ddce5ffbc7e78cb3bdeb58871d6f69da18 Mon Sep 17 00:00:00 2001 From: vaishnavikedar1511 Date: Tue, 1 Dec 2026 11:42:48 +0530 Subject: [PATCH] fix(ci): stop shell injection through the routing-evals runs input The workflow_dispatch input `runs` was pasted into the run: script with ${{ inputs.runs }}, so text typed into it ran as shell in a job that holds ANTHROPIC_API_KEY. Pass it through an env var, accept only 1-99, and make the input a number field. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/routing-evals.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/routing-evals.yml b/.github/workflows/routing-evals.yml index 8b481a2..e78c918 100644 --- a/.github/workflows/routing-evals.yml +++ b/.github/workflows/routing-evals.yml @@ -8,8 +8,9 @@ on: workflow_dispatch: inputs: runs: - description: Runs per case - default: "3" + description: Runs per case (1-99) + type: number + default: 3 permissions: contents: read @@ -35,10 +36,17 @@ jobs: run: npm install -g @anthropic-ai/claude-code - name: Run routing evals if: env.ANTHROPIC_API_KEY != '' - run: >- - claude plugin eval . --tag routing --ablation none - --runs ${{ inputs.runs || '1' }} -j 6 --max-cost-usd 40 - --trust-plugin --no-publish --json evals/results/routing.json + # Pass the input through an env var, never ${{ }} inside run:, so its text is never parsed as shell. + env: + RUNS: ${{ inputs.runs || 1 }} + run: | + if ! [[ "$RUNS" =~ ^[1-9][0-9]?$ ]]; then + echo "::error::runs must be a whole number from 1 to 99, got: $RUNS" + exit 1 + fi + claude plugin eval . --tag routing --ablation none \ + --runs "$RUNS" -j 6 --max-cost-usd 40 \ + --trust-plugin --no-publish --json evals/results/routing.json - uses: actions/upload-artifact@v4 if: always() && env.ANTHROPIC_API_KEY != '' with: