-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java: Identify more APIs as supported in the telemetry queries. #16297
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
Merged
michaelnebel
merged 7 commits into
github:main
from
michaelnebel:java/improveapitelemetry
May 3, 2024
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
06f987a
Java: Add test example of a supported sink defined in QL.
michaelnebel acb2bbb
Java: Identify more APIs as supported in the telemetry queries (as QL…
michaelnebel 9db32f4
Java: Identify more APIs as supported in the telemetry queries (as QL…
michaelnebel b754706
Java: Update SupportedExternalApi expected test output.
michaelnebel f95b330
Java: Improve the Api sources and sinks implementation.
michaelnebel 8def1c2
Java: Address review comments and some other code quality improvements.
michaelnebel c07bf65
Update java/ql/lib/semmle/code/java/dataflow/FlowSources.qll
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 hidden or 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,39 @@ | ||
/** Provides classes representing various flow sinks for data flow / taint tracking. */ | ||
|
||
private import semmle.code.java.dataflow.FlowSinks as FlowSinks | ||
|
||
final class SinkNode = FlowSinks::ApiSinkNode; | ||
|
||
/** | ||
* Module that adds all API like sinks to `SinkNode`, excluding sinks for cryptography based | ||
* queries, and queries where sinks are not succifiently defined (eg. using broad method name matching). | ||
*/ | ||
private module AllApiSinks { | ||
private import semmle.code.java.security.AndroidSensitiveCommunicationQuery | ||
private import semmle.code.java.security.ArbitraryApkInstallation | ||
private import semmle.code.java.security.CleartextStorageAndroidDatabaseQuery | ||
private import semmle.code.java.security.CleartextStorageAndroidFilesystemQuery | ||
private import semmle.code.java.security.CleartextStorageCookieQuery | ||
private import semmle.code.java.security.CleartextStorageSharedPrefsQuery | ||
private import semmle.code.java.security.ExternallyControlledFormatStringQuery | ||
private import semmle.code.java.security.InsecureBasicAuth | ||
private import semmle.code.java.security.IntentUriPermissionManipulation | ||
private import semmle.code.java.security.InsecureLdapAuth | ||
private import semmle.code.java.security.InsecureTrustManager | ||
private import semmle.code.java.security.JndiInjection | ||
private import semmle.code.java.security.JWT | ||
private import semmle.code.java.security.OgnlInjection | ||
private import semmle.code.java.security.SensitiveResultReceiverQuery | ||
private import semmle.code.java.security.SensitiveUiQuery | ||
private import semmle.code.java.security.SpelInjection | ||
private import semmle.code.java.security.SpelInjectionQuery | ||
private import semmle.code.java.security.QueryInjection | ||
private import semmle.code.java.security.TempDirLocalInformationDisclosureQuery | ||
private import semmle.code.java.security.UnsafeAndroidAccess | ||
private import semmle.code.java.security.UnsafeContentUriResolution | ||
private import semmle.code.java.security.UnsafeDeserializationQuery | ||
private import semmle.code.java.security.UrlRedirect | ||
private import semmle.code.java.security.WebviewDebuggingEnabledQuery | ||
private import semmle.code.java.security.XPath | ||
private import semmle.code.java.security.XSS | ||
} |
This file contains hidden or 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,23 @@ | ||
/** Provides classes representing various flow sources for data flow / taint tracking. */ | ||
|
||
private import semmle.code.java.dataflow.FlowSources as FlowSources | ||
|
||
final class SourceNode = FlowSources::ApiSourceNode; | ||
|
||
/** | ||
* Module that adds all API like sources to `SourceNode`, excluding some sources for cryptography based | ||
* queries, and queries where sources are not succifiently defined (eg. using broad method name matching). | ||
*/ | ||
private module AllApiSources { | ||
private import semmle.code.java.security.ArbitraryApkInstallation | ||
private import semmle.code.java.security.CleartextStorageAndroidDatabaseQuery | ||
private import semmle.code.java.security.CleartextStorageAndroidFilesystemQuery | ||
private import semmle.code.java.security.CleartextStorageCookieQuery | ||
private import semmle.code.java.security.CleartextStorageSharedPrefsQuery | ||
private import semmle.code.java.security.ImplicitPendingIntentsQuery | ||
private import semmle.code.java.security.ImproperIntentVerificationQuery | ||
private import semmle.code.java.security.InsecureTrustManager | ||
private import semmle.code.java.security.JWT | ||
private import semmle.code.java.security.StackTraceExposureQuery | ||
private import semmle.code.java.security.ZipSlipQuery | ||
} |
This file contains hidden or 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,18 @@ | ||
/** Provides classes representing various flow sinks for data flow / taint tracking. */ | ||
|
||
private import java | ||
private import semmle.code.java.dataflow.ExternalFlow | ||
private import semmle.code.java.dataflow.DataFlow | ||
|
||
/** | ||
* A data flow sink node for an API, which should be considered | ||
* supported for a modeling perspective. | ||
*/ | ||
abstract class ApiSinkNode extends DataFlow::Node { } | ||
|
||
|
||
/** | ||
* Add all models as data sinks. | ||
*/ | ||
private class ApiSinkNodeExternal extends ApiSinkNode { | ||
ApiSinkNodeExternal() { sinkNode(this, _) } | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
12 changes: 9 additions & 3 deletions
12
java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringQuery.qll
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.