mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Java: Add some source/sink examples where lifting is applied.
This commit is contained in:
@@ -14,6 +14,12 @@ public class Sources {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Defined as a source in the model file next to the test.
|
||||
// neutral=p;Sources;source2;();summary;df-generated
|
||||
public String source2() {
|
||||
return "";
|
||||
}
|
||||
|
||||
// source=p;Sources;true;readUrl;(URL);;ReturnValue;remote;df-generated
|
||||
// sink=p;Sources;true;readUrl;(URL);;Argument[0];request-forgery;df-generated
|
||||
// neutral=p;Sources;readUrl;(URL);summary;df-generated
|
||||
@@ -79,4 +85,27 @@ public class Sources {
|
||||
public String manualSourceAlreadyDefined() {
|
||||
return source();
|
||||
}
|
||||
|
||||
public abstract class DataReader {
|
||||
// neutral=p;Sources$DataReader;read;();summary;df-generated
|
||||
public abstract String read();
|
||||
}
|
||||
|
||||
public class DataReaderKind1 extends DataReader {
|
||||
// source=p;Sources$DataReader;true;read;();;ReturnValue;test-source;df-generated
|
||||
// neutral=p;Sources$DataReaderKind1;read;();summary;df-generated
|
||||
@Override
|
||||
public String read() {
|
||||
return source();
|
||||
}
|
||||
}
|
||||
|
||||
public class DataReaderKind2 extends DataReader {
|
||||
// source=p;Sources$DataReader;true;read;();;ReturnValue;test-source2;df-generated
|
||||
// neutral=p;Sources$DataReaderKind2;read;();summary;df-generated
|
||||
@Override
|
||||
public String read() {
|
||||
return source2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user