-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathdevMode.ql
More file actions
25 lines (22 loc) · 817 Bytes
/
devMode.ql
File metadata and controls
25 lines (22 loc) · 817 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
/**
* @name Apache Struts development mode enabled
* @description Enabling struts development mode in production environment
* can lead to remote code execution.
* @kind problem
* @problem.severity error
* @precision high
* @id java/struts-development-mode
* @tags security
* experimental
* external/cwe/cwe-489
*/
import java
deprecated import experimental.semmle.code.xml.StrutsXML
bindingset[path]
predicate isLikelyDemoProject(string path) { path.regexpMatch("(?i).*(demo|test|example).*") }
deprecated query predicate problems(ConstantParameter c, string message) {
c.getNameValue() = "struts.devMode" and
c.getValueValue() = "true" and
not isLikelyDemoProject(c.getFile().getRelativePath()) and
message = "Enabling development mode in production environments is dangerous."
}