|
| 1 | +/** Provides classes representing various flow sources for data flow / taint tracking. */ |
| 2 | + |
| 3 | +private import semmle.code.java.dataflow.ExternalFlow |
| 4 | +private import semmle.code.java.dataflow.FlowSources |
| 5 | + |
| 6 | +/** |
| 7 | + * A data flow source node. |
| 8 | + */ |
| 9 | +abstract class SourceNode extends DataFlow::Node { } |
| 10 | + |
| 11 | +/** |
| 12 | + * Module that adds all API like sources to `SourceNode`, excluding sources for cryptography based |
| 13 | + * queries, and queries where sources are not succifiently. |
| 14 | + */ |
| 15 | +private module ApiSources { |
| 16 | + private import FlowSources as FlowSources |
| 17 | + private import semmle.code.java.security.ArbitraryApkInstallation as ArbitraryApkInstallation |
| 18 | + private import semmle.code.java.security.CleartextStorageAndroidDatabaseQuery as CleartextStorageAndroidDatabaseQuery |
| 19 | + private import semmle.code.java.security.CleartextStorageAndroidFilesystemQuery as CleartextStorageAndroidFilesystemQuery |
| 20 | + private import semmle.code.java.security.CleartextStorageSharedPrefsQuery as CleartextStorageSharedPrefsQuery |
| 21 | + private import semmle.code.java.security.ImplicitPendingIntentsQuery as ImplicitPendingIntentsQuery |
| 22 | + private import semmle.code.java.security.ImproperIntentVerificationQuery as ImproperIntentVerificationQuery |
| 23 | + private import semmle.code.java.security.InsecureTrustManagerQuery as InsecureTrustManagerQuery |
| 24 | + private import semmle.code.java.security.MissingJWTSignatureCheckQuery as MissingJWTSignatureCheckQuery |
| 25 | + private import semmle.code.java.security.XSS as Xss |
| 26 | + private import semmle.code.java.security.StackTraceExposureQuery as StackTraceExposureQuery |
| 27 | + private import semmle.code.java.security.UnsafeCertTrustQuery as UnsafeCertTrustQuery |
| 28 | + private import semmle.code.java.security.ZipSlipQuery as ZipSlipQuery |
| 29 | + |
| 30 | + private class FlowSourcesSourceNode extends SourceNode instanceof FlowSources::SourceNode { } |
| 31 | + |
| 32 | + private class ArbitraryApkInstallationSources extends SourceNode instanceof ArbitraryApkInstallation::ExternalApkSource |
| 33 | + { } |
| 34 | + |
| 35 | + private class CleartextStorageAndroidDatabaseQuerySources extends SourceNode instanceof CleartextStorageAndroidDatabaseQuery::LocalDatabaseOpenMethodCallSource |
| 36 | + { } |
| 37 | + |
| 38 | + private class CleartextStorageAndroidFilesystemQuerySources extends SourceNode instanceof CleartextStorageAndroidFilesystemQuery::LocalFileOpenCallSource |
| 39 | + { } |
| 40 | + |
| 41 | + private class CleartextStorageSharedPrefsQuerySources extends SourceNode instanceof CleartextStorageSharedPrefsQuery::SharedPreferencesEditorMethodCallSource |
| 42 | + { } |
| 43 | + |
| 44 | + private class ImplicitPendingIntentsQuerySources extends SourceNode instanceof ImplicitPendingIntentsQuery::ImplicitPendingIntentSource |
| 45 | + { } |
| 46 | + |
| 47 | + private class ImproperIntentVerificationQuerySources extends SourceNode instanceof ImproperIntentVerificationQuery::VerifiedIntentConfigSource |
| 48 | + { } |
| 49 | + |
| 50 | + private class InsecureTrustManagerQuerySources extends SourceNode instanceof InsecureTrustManagerQuery::InsecureTrustManagerSource |
| 51 | + { } |
| 52 | + |
| 53 | + private class MissingJWTSignatureCheckQuerySources extends SourceNode instanceof MissingJWTSignatureCheckQuery::JwtParserWithInsecureParseSource |
| 54 | + { } |
| 55 | + |
| 56 | + private class XssSources extends SourceNode instanceof Xss::XssVulnerableWriterSourceNode { } |
| 57 | + |
| 58 | + private class StackTraceExposureQuerySources extends SourceNode instanceof StackTraceExposureQuery::GetMessageFlowSource |
| 59 | + { } |
| 60 | + |
| 61 | + private class UnsafeCertTrustQuerySources extends SourceNode instanceof UnsafeCertTrustQuery::SslConnectionInit |
| 62 | + { } |
| 63 | + |
| 64 | + private class ZipSlipQuerySources extends SourceNode instanceof ZipSlipQuery::ArchiveEntryNameMethodSource |
| 65 | + { } |
| 66 | + |
| 67 | + /** |
| 68 | + * Add all models as data sources. |
| 69 | + */ |
| 70 | + private class SourceNodeExternal extends SourceNode { |
| 71 | + SourceNodeExternal() { sourceNode(this, _) } |
| 72 | + } |
| 73 | +} |
0 commit comments