Merge pull request #14199 from github/koesie10/add-java-model-editor-queries

Java: Add VS Code model editor queries
This commit is contained in:
Koen Vlaswinkel
2023-09-28 10:13:13 +02:00
committed by GitHub
16 changed files with 354 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
| com/github/codeql/test/NonPublicClass.java:5:5:5:28 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:8:5:8:27 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:12:5:12:27 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:16:5:16:45 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:16:24:16:44 | get(...) | java.nio.file | Paths | get | (String,String[]) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:16:24:16:44 | get(...) | java.nio.file | Paths | get | (String,String[]) | true | rt.jar | | summary | source |
| com/github/codeql/test/PublicClass.java:20:5:20:68 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:20:24:20:47 | getDefault(...) | java.nio.file | FileSystems | getDefault | () | false | rt.jar | | | source |
| com/github/codeql/test/PublicClass.java:20:24:20:67 | getPath(...) | java.nio.file | FileSystem | getPath | (String,String[]) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicClass.java:20:24:20:67 | getPath(...) | java.nio.file | FileSystem | getPath | (String,String[]) | true | rt.jar | | summary | source |
| com/github/codeql/test/PublicClass.java:24:5:24:27 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicGenericClass.java:7:5:7:27 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicGenericClass.java:11:5:11:27 | println(...) | java.io | PrintStream | println | (Object) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicGenericInterface.java:8:7:8:29 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source |
| com/github/codeql/test/PublicInterface.java:7:7:7:29 | println(...) | java.io | PrintStream | println | (String) | true | rt.jar | | sink | source |

View File

@@ -0,0 +1 @@
utils/modeleditor/ApplicationModeEndpoints.ql

View File

@@ -0,0 +1,14 @@
| com/github/codeql/test/PublicClass.java:7:15:7:19 | stuff | com.github.codeql.test | PublicClass | stuff | (String) | false | test | |
| com/github/codeql/test/PublicClass.java:11:22:11:32 | staticStuff | com.github.codeql.test | PublicClass | staticStuff | (String) | false | test | |
| com/github/codeql/test/PublicClass.java:15:18:15:31 | protectedStuff | com.github.codeql.test | PublicClass | protectedStuff | (String) | false | test | |
| com/github/codeql/test/PublicClass.java:27:17:27:28 | summaryStuff | com.github.codeql.test | PublicClass | summaryStuff | (String) | true | test | summary |
| com/github/codeql/test/PublicClass.java:31:17:31:27 | sourceStuff | com.github.codeql.test | PublicClass | sourceStuff | () | true | test | source |
| com/github/codeql/test/PublicClass.java:35:15:35:23 | sinkStuff | com.github.codeql.test | PublicClass | sinkStuff | (String) | true | test | sink |
| com/github/codeql/test/PublicClass.java:39:15:39:26 | neutralStuff | com.github.codeql.test | PublicClass | neutralStuff | (String) | true | test | neutral |
| com/github/codeql/test/PublicGenericClass.java:6:15:6:19 | stuff | com.github.codeql.test | PublicGenericClass | stuff | (Object) | false | test | |
| com/github/codeql/test/PublicGenericClass.java:10:20:10:25 | stuff2 | com.github.codeql.test | PublicGenericClass | stuff2 | (Object) | false | test | |
| com/github/codeql/test/PublicGenericInterface.java:4:17:4:21 | stuff | com.github.codeql.test | PublicGenericInterface | stuff | (Object) | false | test | |
| com/github/codeql/test/PublicGenericInterface.java:5:22:5:27 | stuff2 | com.github.codeql.test | PublicGenericInterface | stuff2 | (Object) | false | test | |
| com/github/codeql/test/PublicGenericInterface.java:7:24:7:34 | staticStuff | com.github.codeql.test | PublicGenericInterface | staticStuff | (String) | false | test | |
| com/github/codeql/test/PublicInterface.java:4:17:4:21 | stuff | com.github.codeql.test | PublicInterface | stuff | (String) | false | test | |
| com/github/codeql/test/PublicInterface.java:6:24:6:34 | staticStuff | com.github.codeql.test | PublicInterface | staticStuff | (String) | false | test | |

View File

@@ -0,0 +1,24 @@
extensions:
- addsTo:
pack: codeql/java-all
extensible: sourceModel
data:
- ["com.github.codeql.test","PublicClass",true,"sourceStuff","()","","ReturnValue","remote","manual"]
- addsTo:
pack: codeql/java-all
extensible: sinkModel
data:
- ["com.github.codeql.test","PublicClass",true,"sinkStuff","(String)","","Argument[0]","sql-injection","manual"]
- addsTo:
pack: codeql/java-all
extensible: summaryModel
data:
- ["com.github.codeql.test","PublicClass",true,"summaryStuff","(String)","","Argument[0]","ReturnValue","taint","manual"]
- addsTo:
pack: codeql/java-all
extensible: neutralModel
data:
- ["com.github.codeql.test","PublicClass","neutralStuff","(String)","summary","manual"]

View File

@@ -0,0 +1 @@
utils/modeleditor/FrameworkModeEndpoints.ql

View File

@@ -0,0 +1,7 @@
package com.github.codeql.test;
class NonPublicClass {
public void noCandidates(String here) {
System.out.println(here);
}
}

View File

@@ -0,0 +1,42 @@
package com.github.codeql.test;
import java.nio.file.FileSystems;
import java.nio.file.Paths;
public class PublicClass {
public void stuff(String arg) {
System.out.println(arg);
}
public static void staticStuff(String arg) {
System.out.println(arg);
}
protected void protectedStuff(String arg) {
System.out.println(Paths.get("foo", arg));
}
private void privateStuff(String arg) {
System.out.println(FileSystems.getDefault().getPath("foo", arg));
}
void packagePrivateStuff(String arg) {
System.out.println(arg);
}
public String summaryStuff(String arg) {
return arg;
}
public String sourceStuff() {
return "stuff";
}
public void sinkStuff(String arg) {
// do nothing
}
public void neutralStuff(String arg) {
// do nothing
}
}

View File

@@ -0,0 +1,13 @@
package com.github.codeql.test;
import java.nio.file.Paths;
public class PublicGenericClass<T, T2> implements PublicGenericInterface<T> {
public void stuff(T arg) {
System.out.println(arg);
}
public <T3> void stuff2(T3 arg) {
System.out.println(arg);
}
}

View File

@@ -0,0 +1,10 @@
package com.github.codeql.test;
public interface PublicGenericInterface<T> {
public void stuff(T arg);
public <T2> void stuff2(T2 arg);
public static void staticStuff(String arg) {
System.out.println(arg);
}
}

View File

@@ -0,0 +1,9 @@
package com.github.codeql.test;
public interface PublicInterface {
public void stuff(String arg);
public static void staticStuff(String arg) {
System.out.println(arg);
}
}