-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
146553f
commit e5cd0a4
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import java.util.*; | ||
|
||
public class A { | ||
private static final Set<String> SEPARATORS = | ||
Collections.unmodifiableSet( | ||
new HashSet<>(Arrays.asList("\t", "\n", ";"))); | ||
|
||
public static void sink(String s) { } | ||
|
||
private void checkSeparator(String separator) { | ||
if (SEPARATORS.contains(separator)) { | ||
sink(separator); | ||
} | ||
} | ||
|
||
public static final String URI1 = "yarn.io/gpu"; | ||
public static final String URI2 = "yarn.io/fpga"; | ||
|
||
public static final Set<String> SCHEMAS = Set.of(URI1, URI2, "s3a", "wasb"); | ||
|
||
private void checkSchema(String schema) { | ||
if (SCHEMAS.contains(schema)) { | ||
sink(schema); | ||
} | ||
} | ||
|
||
private void testAdd(String inp) { | ||
Set<String> s = new HashSet<>(); | ||
s.add("AA"); | ||
s.add("BB"); | ||
if (s.contains(inp.toUpperCase())) { | ||
sink(inp); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
| A.java:12:12:12:20 | separator | | ||
| A.java:23:12:23:17 | schema | | ||
| A.java:32:12:32:14 | inp | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import java | ||
import semmle.code.java.dataflow.FlowSteps | ||
// import semmle.code.java.security.ListOfConstantsSanitizer | ||
|
||
from DefaultTaintSanitizer e | ||
select e |