mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Java: convert ImproperIntentVerification test to .qlref
It's a non-path query, so the InlineExpectationsTest postprocessor doesn't do anything.
This commit is contained in:
@@ -6,8 +6,8 @@ import android.content.BroadcastReceiver;
|
||||
class BootReceiverXml extends BroadcastReceiver {
|
||||
void doStuff(Intent intent) {}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context ctx, Intent intent) { // $hasResult
|
||||
@Override
|
||||
public void onReceive(Context ctx, Intent intent) { // $ Alert
|
||||
doStuff(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| BootReceiverXml.java:10:17:10:25 | onReceive | This reciever doesn't verify intents it receives, and $@ to receive $@. | AndroidManifest.xml:3:9:7:20 | receiver | it is registered | AndroidManifest.xml:5:17:5:79 | action | the system action action |
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import java
|
||||
import semmle.code.java.security.ImproperIntentVerificationQuery
|
||||
import utils.test.InlineExpectationsTest
|
||||
|
||||
module HasFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "hasResult" }
|
||||
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasResult" and
|
||||
exists(Method orm | unverifiedSystemReceiver(_, orm, _) |
|
||||
orm.getLocation() = location and
|
||||
element = orm.toString() and
|
||||
value = ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HasFlowTest>
|
||||
@@ -0,0 +1,4 @@
|
||||
query: Security/CWE/CWE-925/ImproperIntentVerification.ql
|
||||
postprocess:
|
||||
- utils/test/PrettyPrintModels.ql
|
||||
- utils/test/InlineExpectationsTestQuery.ql
|
||||
Reference in New Issue
Block a user