forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImproperAccessControl.ql
More file actions
30 lines (28 loc) · 961 Bytes
/
Copy pathImproperAccessControl.ql
File metadata and controls
30 lines (28 loc) · 961 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
/**
* @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, MutableRefCheckoutStep checkout, Event event
where
job.isPrivileged() and
job.getAStep() = checkout and
check.dominates(checkout, event) and
(
job.getATriggerEvent() = event and
event.getName() = "pull_request_target" and
event.getAnActivityType() = "synchronize"
or
not exists(job.getATriggerEvent())
)
select checkout, "The checked-out code can be modified after the authorization check $@.", check,
check.toString()