Java: tests for automodel application mode positive example extraction

This commit is contained in:
Stephan Brandauer
2023-07-21 15:30:05 +02:00
parent 2e89a11949
commit 1bc222ec40
3 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
| Test.java:17:4:17:9 | source | path-injection\nrelated locations: $@.\nmetadata: $@, $@, $@, $@, $@, $@. | Test.java:16:3:20:3 | copy(...) | CallContext | file://java.nio.file:1:1:1:1 | java.nio.file | package | file://Files:1:1:1:1 | Files | type | file://false:1:1:1:1 | false | subtypes | file://copy:1:1:1:1 | copy | name | file://(Path,Path,CopyOption[]):1:1:1:1 | (Path,Path,CopyOption[]) | signature | file://Argument[0]:1:1:1:1 | Argument[0] | input |
| Test.java:18:4:18:9 | target | path-injection\nrelated locations: $@.\nmetadata: $@, $@, $@, $@, $@, $@. | Test.java:16:3:20:3 | copy(...) | CallContext | file://java.nio.file:1:1:1:1 | java.nio.file | package | file://Files:1:1:1:1 | Files | type | file://false:1:1:1:1 | false | subtypes | file://copy:1:1:1:1 | copy | name | file://(Path,Path,CopyOption[]):1:1:1:1 | (Path,Path,CopyOption[]) | signature | file://Argument[1]:1:1:1:1 | Argument[1] | input |

View File

@@ -0,0 +1 @@
Telemetry/AutomodelApplicationModeExtractPositiveExamples.ql

View File

@@ -0,0 +1,22 @@
package com.github.codeql.test;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
class AutomodelApplicationModeExtractPositiveExamples {
public static void callSupplier(Supplier<String> supplier) {
supplier.get(); // not an example
}
public static void copyFiles(Path source, Path target, CopyOption option) throws Exception {
Files.copy(
source, // positive example
target, // positive example
option // no example
);
}
}