|
9 | 9 | merge_group: |
10 | 10 | types: [checks_requested] |
11 | 11 |
|
| 12 | +# Least privilege: every job below escalates only where it needs to. |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
12 | 16 | jobs: |
| 17 | + dependency-review: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + # Only meaningful for PRs — validates the dependency diff of the pull |
| 20 | + # request against GitHub's advisory database before merge. |
| 21 | + if: github.event_name == 'pull_request' |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 25 | + with: |
| 26 | + # This job never pushes — don't persist the GITHUB_TOKEN. |
| 27 | + persist-credentials: false |
| 28 | + - name: Dependency review |
| 29 | + uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 |
| 30 | + |
| 31 | + invisible-chars: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + # Reject invisible / homoglyph Unicode that GitHub's diff UI renders |
| 34 | + # invisibly and most editors hide. These compile fine, which is the |
| 35 | + # risk: identifier-splitting, string-literal injection, and the |
| 36 | + # "Trojan Source" bidi-override attack (U+202A-U+202E). Scanning raw |
| 37 | + # bytes catches them in strings, identifiers, and comments alike. |
| 38 | + steps: |
| 39 | + - name: Checkout code |
| 40 | + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 41 | + with: |
| 42 | + # This job never pushes — don't persist the GITHUB_TOKEN. |
| 43 | + persist-credentials: false |
| 44 | + - name: Reject invisible / homoglyph Unicode |
| 45 | + run: | |
| 46 | + # zero-width (U+200B-200F), word joiner (U+2060), BOM (U+FEFF), |
| 47 | + # bidi overrides (U+202A-202E), soft hyphen (U+00AD). |
| 48 | + # Covers source, release-adjacent executable scripts |
| 49 | + # (*.sh / *.cjs / *.cts / *.mts), and the executable shell |
| 50 | + # blocks inside GitHub workflow/action YAML. |
| 51 | + if grep -rnP '[\x{200B}-\x{200F}\x{202A}-\x{202E}\x{2060}\x{FEFF}\x{00AD}]' \ |
| 52 | + --include='*.ts' --include='*.tsx' --include='*.js' --include='*.mjs' \ |
| 53 | + --include='*.cjs' --include='*.cts' --include='*.mts' --include='*.sh' \ |
| 54 | + --include='*.yml' --include='*.yaml' \ |
| 55 | + --exclude-dir=node_modules --exclude-dir=dist --exclude-dir=out \ |
| 56 | + --exclude-dir=coverage --exclude-dir=.turbo --exclude-dir=.vinxi \ |
| 57 | + src webview-ui packages apps .github; then |
| 58 | + echo "::error::Found invisible or homoglyph Unicode characters (zero-width / bidi-override / BOM / soft hyphen)" |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | +
|
13 | 62 | check-translations: |
14 | 63 | runs-on: ubuntu-latest |
15 | 64 | steps: |
|
0 commit comments