Skip to content

Commit de7afca

Browse files
authored
Merge pull request #21976 from JarLob/patch-1
Update regex for GitHub hosted runner matching
2 parents ad18659 + bea5522 commit de7afca

3 files changed

Lines changed: 53 additions & 4 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: fix
3+
---
4+
* The query `actions/pr-on-self-hosted-runner` was updated to the latest standard runner labels reducing false positive results.

actions/ql/lib/codeql/actions/security/SelfHostedQuery.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import actions
22

33
bindingset[runner]
44
predicate isGithubHostedRunner(string runner) {
5-
// list of github hosted repos: https://github.com/actions/runner-images/blob/main/README.md#available-images
6-
runner
7-
.toLowerCase()
8-
.regexpMatch("^(ubuntu-([0-9.]+|latest)|macos-([0-9]+|latest)(-x?large)?|windows-([0-9.]+|latest))$")
5+
// The list of github hosted repos:
6+
// https://github.com/actions/runner-images/blob/main/README.md#available-images
7+
// https://docs.github.com/en/enterprise-cloud@latest/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories
8+
runner.toLowerCase().regexpMatch("^ubuntu-([0-9.]+|latest|slim)(-arm)?$") or
9+
runner.toLowerCase().regexpMatch("^macos-([0-9]+|latest)(-x?large|-intel)?$") or
10+
runner.toLowerCase().regexpMatch("^windows-([0-9.]+|latest)(-vs[0-9.]+)?(-arm)?$")
911
}
1012

1113
bindingset[runner]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: test
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os:
12+
- ubuntu-latest
13+
- ubuntu-24.04
14+
- ubuntu-24.04-arm
15+
- ubuntu-22.04
16+
- ubuntu-22.04-arm
17+
- ubuntu-26.04
18+
- ubuntu-26.04-arm
19+
- ubuntu-slim
20+
- macos-26
21+
- macos-26-xlarge
22+
- macos-26-intel
23+
- macos-26-large
24+
- macos-latest-large
25+
- macos-15-large
26+
- macos-15
27+
- macos-15-intel
28+
- macos-latest
29+
- macos-15
30+
- macos-15-xlarge
31+
- macos-14-large
32+
- macos-14
33+
- macos-14-xlarge
34+
- windows-2025-vs2026
35+
- windows-latest
36+
- windows-2025
37+
- windows-2022
38+
- windows-11
39+
- windows-11-arm
40+
- windows-11-vs2026-arm
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- run: cmd

0 commit comments

Comments
 (0)