Commit 4860988
fix(ci): use allowlist regex for backend_url validation
The previous blocklist regex `[^[:space:]/?#:]+` did not reject `$`, so a
backend_url like `https://evil.com/$GITHUB_TOKEN/` passed validation and was
written to .env.alpha as `VITE_ORIGIN=...`. Vite processes env files with
dotenv-expand, which would expand `$GITHUB_TOKEN` to the runner's secret and
bake it into the public gh-pages JS bundle.
Switch to positive character classes that only allow URL-safe chars for the
host (`a-zA-Z0-9._-`) and path (`a-zA-Z0-9._/~:%-`), blocking `$`, backticks,
parentheses, and other dotenv/shell metacharacters while still permitting
percent-encoded path segments like `%20`.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 25a2ec4 commit 4860988
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
0 commit comments