mirror of
https://github.com/github/codeql.git
synced 2025-12-28 06:36:33 +01:00
Merge pull request #61 from github/missing_permissions
fix(queries): Fix Missing Permissions query
This commit is contained in:
@@ -13,11 +13,13 @@
|
||||
|
||||
import actions
|
||||
|
||||
from Workflow workflow, Job job
|
||||
from Job job
|
||||
where
|
||||
job = workflow.getAJob() and
|
||||
(
|
||||
not exists(workflow.getPermissions()) and
|
||||
not exists(job.getPermissions())
|
||||
not exists(job.getPermissions()) and
|
||||
not exists(job.getEnclosingWorkflow().getPermissions()) and
|
||||
// exists a trigger event that is not a workflow_call
|
||||
exists(Event e |
|
||||
e = job.getATriggerEvent() and
|
||||
not e.getName() = "workflow_call"
|
||||
)
|
||||
select job, "Actions Job or Workflow does not set permissions"
|
||||
|
||||
16
ql/test/query-tests/Security/CWE-275/.github/workflows/perms2.yml
vendored
Normal file
16
ql/test/query-tests/Security/CWE-275/.github/workflows/perms2.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
on:
|
||||
pull_request
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
test:
|
||||
name: Build and test
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
11
ql/test/query-tests/Security/CWE-275/.github/workflows/perms4.yml
vendored
Normal file
11
ql/test/query-tests/Security/CWE-275/.github/workflows/perms4.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
||||
12
ql/test/query-tests/Security/CWE-275/.github/workflows/perms5.yml
vendored
Normal file
12
ql/test/query-tests/Security/CWE-275/.github/workflows/perms5.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
| .github/workflows/missing_perms.yml:6:5:9:32 | Job: build | Actions Job or Workflow does not set permissions |
|
||||
| .github/workflows/perms1.yml:6:5:9:32 | Job: build | Actions Job or Workflow does not set permissions |
|
||||
| .github/workflows/perms2.yml:6:5:10:2 | Job: build | Actions Job or Workflow does not set permissions |
|
||||
| .github/workflows/perms5.yml:7:5:10:32 | Job: build | Actions Job or Workflow does not set permissions |
|
||||
|
||||
Reference in New Issue
Block a user