-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathImproperAccessControl.ql
More file actions
32 lines (30 loc) · 1004 Bytes
/
ImproperAccessControl.ql
File metadata and controls
32 lines (30 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* @name Improper Access Control
* @description The access control mechanism is not properly implemented, allowing untrusted code to be executed in a privileged context.
* @kind problem
* @problem.severity error
* @precision high
* @security-severity 9.3
* @id actions/improper-access-control
* @tags actions
* security
* external/cwe/cwe-285
*/
import codeql.actions.security.UntrustedCheckoutQuery
import codeql.actions.security.ControlChecks
from LocalJob job, LabelCheck check, PRHeadCheckoutStep checkout, Event event
where
job.isPrivileged() and
job.getAStep() = checkout and
check.dominates(checkout) and
(
job.getATriggerEvent() = event and
event.getName() = "pull_request_target" and
event.getAnActivityType() = "synchronize"
or
not exists(job.getATriggerEvent())
or
checkout instanceof MutableRefCheckoutStep
)
select checkout, "The checked-out code can be modified after the authorization check $@.", check,
check.toString()