[security] Harden workflows against script injection#1812
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR hardens the benchmark GitHub Actions workflows by reducing the risk of shell script injection when propagating the bencherProject workflow input into the SLANG_BENCHER_PROJECT environment variable used by the infra bencher integration.
Changes:
- Pass
inputs.bencherProjectvia a stepenv:entry instead of directly interpolating it into the shell script. - Quote the
$GITHUB_ENVpath when appendingSLANG_BENCHER_PROJECT.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/benchmark_npm.yml | Moves bencherProject into step env and writes SLANG_BENCHER_PROJECT into $GITHUB_ENV for npm benchmarks. |
| .github/workflows/benchmark_cargo_slang.yml | Same hardening for the cargo slang benchmark workflow. |
| .github/workflows/benchmark_cargo_slang_v2.yml | Same hardening for the cargo slang-v2 benchmark workflow. |
| .github/workflows/benchmark_cargo_cmp.yml | Same hardening for the cargo comparison benchmark workflow. |
|
| Branch | ci/bencher-project-env-indirection |
| Testbed | ci |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🚨 4 Alerts
🐰 View full continuous benchmarking report in Bencher
|
| Branch | ci/bencher-project-env-indirection |
| Testbed | ci |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
🚨 6 Alerts
🐰 View full continuous benchmarking report in Bencher
|
| Branch | ci/bencher-project-env-indirection |
| Testbed | ci |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🐰 View full continuous benchmarking report in Bencher
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
|
| Branch | ci/bencher-project-env-indirection |
| Testbed | ci |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🐰 View full continuous benchmarking report in Bencher
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
039925e to
d72d315
Compare
Closes the residual env-file injection vector (a newline in the value could append extra env entries) Copilot flagged on the echo-based approach. Step env is set directly in the process, never parsed as a shell or env-file. Infra now treats an empty SLANG_BENCHER_PROJECT as unset so the built-in default still applies on non-dispatch runs.
…shell conditional Mirrors the bencherProject change: instead of a bash array + if to omit '--check-binder' when 'none', the binary now accepts '--check-binder=none' (a new CheckBinderMode::None variant, the default). The workflow passes the value as a quoted env var, so there's no injection surface and no shell logic. Also aligns the CLI values with the workflow_dispatch choice options (none/v1/v2/compare).
`echo '<json>' > file` would break out of the single quotes on any single quote in the aggregated shard results. Pass the JSON via env and printf it instead. (Results are first-party, so not exploitable, but it's the same class this PR hardens.)
Per review: default_value = "none" is a runtime-parsed string that would silently drift if the CheckBinderMode::None variant is renamed. Switch to default_value_t = CheckBinderMode::None so the compiler keeps it in sync.
d72d315 to
c33f277
Compare
Small security fixes to not allow injection of
bencherProjectandcheck_bindervariables. Relatively low risk, but easy fix.