Java: Add test showing missing model for thenExpand

This commit is contained in:
idrissrio
2025-09-08 12:38:35 +02:00
parent 55ff71b760
commit 3aba4d3e1e
2 changed files with 14 additions and 0 deletions

View File

@@ -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
}
}

View File

@@ -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 |