-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java: Deprecate experimental queries. #18299
Open
michaelnebel
wants to merge
5
commits into
github:main
Choose a base branch
from
michaelnebel:java/deprecateexperimental
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
84559e3
Java: Deprecate experimental queries.
michaelnebel c7f2454
Java: Deprecate experimental model activation.
michaelnebel aeb12cf
Java: Add change-note.
michaelnebel de27511
Java: Accept expected test output.
michaelnebel 1e92baa
Java: Deprecate MyBatisMapperXML as it is only used by experimental q…
michaelnebel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: minorAnalysis | ||
--- | ||
* All *experimental* queries have been deprecated. The queries are instead available as part of the *default* query suite in [CodeQL-Community-Packs](https://github.com/GitHubSecurityLab/CodeQL-Community-Packs). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
java/ql/src/experimental/Security/CWE/CWE-016/SpringBootActuators.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
java/ql/src/experimental/Security/CWE/CWE-073/JFinalController.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
deprecated module; | ||
|
||
import java | ||
private import semmle.code.java.dataflow.FlowSources | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
java/ql/src/experimental/Security/CWE/CWE-078/CommandInjectionRuntimeExec.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,13 @@ | |
*/ | ||
|
||
import java | ||
import MyBatisCommonLib | ||
import MyBatisAnnotationSqlInjectionLib | ||
deprecated import MyBatisAnnotationSqlInjectionLib | ||
import semmle.code.java.dataflow.FlowSources | ||
import semmle.code.java.dataflow.TaintTracking | ||
Check warning Code scanning / CodeQL Redundant import Warning
Redundant import, the module is already imported inside
MyBatisCommonLib Error loading related location Loading Redundant import, the module is already imported inside MyBatisAnnotationSqlInjectionLib. |
||
private import semmle.code.java.security.Sanitizers | ||
import MyBatisAnnotationSqlInjectionFlow::PathGraph | ||
deprecated import MyBatisAnnotationSqlInjectionFlow::PathGraph | ||
|
||
private module MyBatisAnnotationSqlInjectionConfig implements DataFlow::ConfigSig { | ||
deprecated private module MyBatisAnnotationSqlInjectionConfig implements DataFlow::ConfigSig { | ||
predicate isSource(DataFlow::Node source) { source instanceof ActiveThreatModelSource } | ||
|
||
predicate isSink(DataFlow::Node sink) { sink instanceof MyBatisAnnotatedMethodCallArgument } | ||
|
@@ -37,22 +36,27 @@ | |
} | ||
} | ||
|
||
private module MyBatisAnnotationSqlInjectionFlow = | ||
deprecated private module MyBatisAnnotationSqlInjectionFlow = | ||
TaintTracking::Global<MyBatisAnnotationSqlInjectionConfig>; | ||
|
||
from | ||
MyBatisAnnotationSqlInjectionFlow::PathNode source, | ||
MyBatisAnnotationSqlInjectionFlow::PathNode sink, IbatisSqlOperationAnnotation isoa, | ||
MethodCall ma, string unsafeExpression | ||
where | ||
MyBatisAnnotationSqlInjectionFlow::flowPath(source, sink) and | ||
ma.getAnArgument() = sink.getNode().asExpr() and | ||
myBatisSqlOperationAnnotationFromMethod(ma.getMethod(), isoa) and | ||
unsafeExpression = getAMybatisAnnotationSqlValue(isoa) and | ||
( | ||
isMybatisXmlOrAnnotationSqlInjection(sink.getNode(), ma, unsafeExpression) or | ||
isMybatisCollectionTypeSqlInjection(sink.getNode(), ma, unsafeExpression) | ||
) | ||
select sink.getNode(), source, sink, | ||
"MyBatis annotation SQL injection might include code from $@ to $@.", source.getNode(), | ||
"this user input", isoa, "this SQL operation" | ||
deprecated query predicate problems( | ||
DataFlow::Node sinkNode, MyBatisAnnotationSqlInjectionFlow::PathNode source, | ||
MyBatisAnnotationSqlInjectionFlow::PathNode sink, string message1, DataFlow::Node sourceNode, | ||
string message2, IbatisSqlOperationAnnotation isoa, string message3 | ||
) { | ||
exists(MethodCall ma, string unsafeExpression | | ||
MyBatisAnnotationSqlInjectionFlow::flowPath(source, sink) and | ||
ma.getAnArgument() = sinkNode.asExpr() and | ||
myBatisSqlOperationAnnotationFromMethod(ma.getMethod(), isoa) and | ||
unsafeExpression = getAMybatisAnnotationSqlValue(isoa) and | ||
( | ||
isMybatisXmlOrAnnotationSqlInjection(sinkNode, ma, unsafeExpression) or | ||
isMybatisCollectionTypeSqlInjection(sinkNode, ma, unsafeExpression) | ||
) | ||
) and | ||
sinkNode = sink.getNode() and | ||
message1 = "MyBatis annotation SQL injection might include code from $@ to $@." and | ||
sourceNode = source.getNode() and | ||
message2 = "this user input" and | ||
message3 = "this SQL operation" | ||
} |
1 change: 1 addition & 0 deletions
1
java/ql/src/experimental/Security/CWE/CWE-089/MyBatisAnnotationSqlInjectionLib.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
java/ql/src/experimental/Security/CWE/CWE-089/MyBatisCommonLib.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Using 'toString' in query logic Warning