mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: harden GitHub Actions against script injection patterns (#50512) * fix: harden GitHub Actions against script injection vulnerabilities Replace direct ${{ }} expression interpolation in run: blocks with environment variables to prevent script injection attacks. Changes: - archaeologist-dig.yml: move clone_url, head.sha, base.ref to env vars - non-maintainer-dependency-change.yml: move user.login to env var - issue-unlabeled.yml: move toJSON(labels) to env var - issue-labeled.yml: move issue.number to env var - pipeline-electron-lint.yml: validate chromium_revision format - cipd-install/action.yml: move all inputs to env vars and quote them - set-chromium-cookie/action.yml: reference secrets via $ENV_VAR - Add security comments to all 5 pull_request_target workflows https://claude.ai/code/session_01UUWmLxn5hyyxrhK8rGxU2s * fix: allow version strings in chromium_revision validation The previous regex `^[a-f0-9]+$` only matched git SHAs but chromium_revision is a version string like `148.0.7741.0`. Broaden to `^[a-zA-Z0-9._-]+$` which still blocks shell metacharacters. https://claude.ai/code/session_01UUWmLxn5hyyxrhK8rGxU2s --------- Co-authored-by: Claude <noreply@anthropic.com>
43 lines
1.5 KiB
YAML
43 lines
1.5 KiB
YAML
name: Issue Unlabeled
|
|
|
|
on:
|
|
issues:
|
|
types: [unlabeled]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
issue-unlabeled-blocked:
|
|
name: All blocked/* labels removed
|
|
if: startsWith(github.event.label.name, 'blocked/') && github.event.issue.state == 'open'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Check for any blocked labels
|
|
id: check-for-blocked-labels
|
|
env:
|
|
LABELS_JSON: ${{ toJSON(github.event.issue.labels.*.name) }}
|
|
run: |
|
|
set -eo pipefail
|
|
BLOCKED_LABEL_COUNT=$(echo "$LABELS_JSON" | jq '[ .[] | select(startswith("blocked/")) ] | length')
|
|
if [[ $BLOCKED_LABEL_COUNT -eq 0 ]]; then
|
|
echo "NOT_BLOCKED=1" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Generate GitHub App token
|
|
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
|
|
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
|
id: generate-token
|
|
with:
|
|
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
|
org: electron
|
|
- name: Set status
|
|
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
|
|
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
|
with:
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
project-number: 90
|
|
field: Status
|
|
field-value: 📥 Was Blocked
|
|
fail-if-item-not-found: false
|