Files
openide/jvm/jvm-analysis-java-tests/testData/codeInspection/sourceToSinkFlow/SecureCustomInheritance.java
Mikhail Pyltsin 5c632ee060 [uast-inspections] Non-safe string: configuration for method with context awareness
GitOrigin-RevId: 108a4e8f5beaa951dbe1be64c578d39b7a82163b
2023-09-20 18:30:13 +00:00

29 lines
663 B
Java

package com.test;
import org.checkerframework.checker.tainting.qual.Untainted;
class Random {
public int nextInt(int t) {
return t;
}
}
class SecureRandom extends Random {
}
public class SecureCustomInheritance {
public void test() {
int randNumber = new Random().nextInt(99);
int secureRandNumber = new SecureRandom().nextInt(99);
String secureRememberMeKey = Integer.toString(secureRandNumber);
String rememberMeKey = Integer.toString(randNumber);
sink(secureRememberMeKey);
sink(<warning descr="Unsafe string is used as safe parameter">rememberMeKey</warning>);
}
private void sink(@Untainted String clean) {
}
}