mirror of
https://github.com/github/codeql.git
synced 2026-04-20 14:34:04 +02:00
Java: Add test showing missing model for thenExpand
This commit is contained in:
@@ -71,4 +71,17 @@ public class KDFDataflowTest {
|
||||
byte[] cleanResult = kdf.deriveData(spec);
|
||||
sink(cleanResult); // Safe - no taint
|
||||
}
|
||||
|
||||
public static void testThenExpand(byte[] cleanIKM) throws Exception {
|
||||
String userInput = source("");
|
||||
byte[] taintedInfo = userInput.getBytes();
|
||||
|
||||
HKDFParameterSpec.Builder builder = HKDFParameterSpec.ofExtract();
|
||||
builder.addIKM(cleanIKM);
|
||||
HKDFParameterSpec spec = builder.thenExpand(taintedInfo, 32);
|
||||
|
||||
KDF kdf = KDF.getInstance("HKDF-SHA256");
|
||||
byte[] result = kdf.deriveData(spec);
|
||||
sink(result); // $ hasTaintFlow
|
||||
}
|
||||
}
|
||||
@@ -87,3 +87,4 @@ nodes
|
||||
| KDFDataflowTest.java:60:14:60:19 | result | semmle.label | result |
|
||||
subpaths
|
||||
testFailures
|
||||
| KDFDataflowTest.java:85:23:85:39 | // $ hasTaintFlow | Missing result: hasTaintFlow |
|
||||
|
||||
Reference in New Issue
Block a user