Skip to content

Commit 09651e4

Browse files
feffijknack
authored andcommitted
Taint analysis (#1192)
* updated: org.jsoup:jsoup ...................................... 1.8.2 -> 1.11.3 * added output sanitization hint TODOs * reverted update for clean PR
1 parent eab6860 commit 09651e4

File tree

9 files changed

+21
-4
lines changed

9 files changed

+21
-4
lines changed

jooby/src/main/java/org/jooby/Jooby.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,11 +3311,14 @@ private Config envConf(final Config source, final String env) {
33113311
* @return A config for the file name.
33123312
*/
33133313
static Config fileConfig(final String fname) {
3314+
// TODO: sanitization of arguments
33143315
File dir = new File(System.getProperty("user.dir"));
3316+
// TODO: sanitization of arguments
33153317
File froot = new File(dir, fname);
33163318
if (froot.exists()) {
33173319
return ConfigFactory.parseFile(froot);
33183320
} else {
3321+
// TODO: sanitization of arguments
33193322
File fconfig = new File(new File(dir, "conf"), fname);
33203323
if (fconfig.exists()) {
33213324
return ConfigFactory.parseFile(fconfig);
@@ -3485,6 +3488,7 @@ static String logback(final Config conf) {
34853488
} else {
34863489
String env = conf.hasPath("application.env") ? conf.getString("application.env") : null;
34873490
ImmutableList.Builder<File> files = ImmutableList.builder();
3491+
// TODO: sanitization of arguments
34883492
File userdir = new File(System.getProperty("user.dir"));
34893493
File confdir = new File(userdir, "conf");
34903494
if (env != null) {

jooby/src/main/java/org/jooby/internal/RequestImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public Mutant body() throws Exception {
464464
if (length > 0) {
465465
MediaType type = type();
466466
Config conf = require(Config.class);
467-
467+
// TODO: sanitization of arguments
468468
File fbody = new File(conf.getString("application.tmpdir"),
469469
Integer.toHexString(System.identityHashCode(this)));
470470
files.add(fbody);

modules/jooby-assets-clean-css/src/test/java/org/jooby/assets/Generator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
public class Generator {
1111

1212
private static final String NODE = "/usr/local/bin/node";
13-
13+
// TODO: sanitization of arguments
1414
private static final String NPM = new File(System.getProperty("user.home")).toPath()
1515
.resolve(".node").resolve("lib").resolve("node_modules").resolve("npm").resolve("bin")
1616
.resolve("npm-cli.js").toString();
17-
17+
// TODO: sanitization of arguments
1818
private static final File workDir = new File(System.getProperty("user.dir"), "target");
1919

2020
static File log = new File(workDir, "log.log");
@@ -91,11 +91,13 @@ public static Path install(final String name) throws Exception {
9191
}
9292

9393
public static Path localFile(final String name) {
94+
// TODO: sanitization of arguments
9495
return new File(System.getProperty("user.dir")).toPath().resolve("src").resolve("test")
9596
.resolve("resources").resolve(name);
9697
}
9798

9899
public static Path module(final String name) {
100+
// TODO: sanitization of arguments
99101
return new File(System.getProperty("user.home")).toPath().resolve("node_modules").resolve(name);
100102
}
101103
}

modules/jooby-assets-svg-sprites/src/main/java/org/jooby/assets/SvgSprites.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public void run(final Config conf) throws Exception {
321321
if (!spriteElementPath.exists()) {
322322
throw new FileNotFoundException(spriteElementPath.toString());
323323
}
324-
324+
// TODO: sanitization of arguments
325325
File workdir = new File(Try.apply(() -> conf.getString("application.tmpdir"))
326326
.orElse(System.getProperty("java.io.tmpdir")));
327327

modules/jooby-assets/src/main/java/org/jooby/internal/assets/AssetWriter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ private Stream<String> patterns(final Predicate<String> filter) {
272272

273273
public void write(String path, String chunk) throws IOException {
274274
if (bundle == null) {
275+
// TODO: sanitization of arguments
275276
File output = new File(outDir, path);
276277
writeFile(output, chunk);
277278
result.add(output);
@@ -285,6 +286,7 @@ public void write(String path, String chunk) throws IOException {
285286
public List<File> getResult() throws IOException {
286287
try {
287288
if (bundle != null && bundle.length() > 0) {
289+
// TODO: sanitization of arguments
288290
Path filename = Paths.get(fset + "." + sha1(bundle) + ext);
289291
Path filepath = patterns(filter).findFirst()
290292
.map(p -> Paths.get(p).resolve(filename))
@@ -322,6 +324,7 @@ private void writeFile(File output, String chunk) throws IOException {
322324

323325
public void add(String path) {
324326
if (bundle == null) {
327+
// TODO: sanitization of arguments
325328
result.add(new File(outDir, path));
326329
}
327330
}

modules/jooby-netty/src/main/java/org/jooby/internal/netty/NettySslContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,12 @@ static SslContext build(final Config conf) throws IOException, CertificateExcept
258258
}
259259

260260
static File toFile(final String path, final String tmpdir) throws IOException {
261+
// TODO: sanitization of arguments
261262
File file = new File(path);
262263
if (file.exists()) {
263264
return file;
264265
}
266+
// TODO: sanitization of arguments
265267
file = new File(tmpdir, Paths.get(path).getFileName().toString());
266268
// classpath resource?
267269
InputStream in = NettyServer.class.getClassLoader().getResourceAsStream(path);

modules/jooby-pac4j/src/main/java/org/jooby/internal/pac4j/AuthSerializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public static final Object strToObject(final String value) {
222222
}
223223
return Try.apply(() -> {
224224
byte[] bytes = BaseEncoding.base64().decode(value.substring(PREFIX.length()));
225+
// TODO: sanitization of arguments
225226
return new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
226227
})
227228
.wrap(x -> new IllegalArgumentException("Can't de-serialize value " + value, x))

modules/jooby-pac4j2/src/main/java/org/jooby/internal/pac4j2/Pac4jSessionStore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ static final Object strToObject(final String value) {
275275
}
276276
return Try.apply(() -> {
277277
byte[] bytes = base64().decode(value.substring(PREFIX.length()));
278+
// TODO: sanitization of arguments
278279
return new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
279280
}).get();
280281
}

modules/jooby-run/src/main/java/org/jooby/run/Main.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,18 @@ public static void main(final String[] args) throws Exception {
327327
excludes = option[1];
328328
break;
329329
case "props":
330+
// TODO: sanitization of arguments
330331
setSystemProperties(new File(option[1]));
331332
break;
332333
case "deps":
334+
// TODO: sanitization of arguments
333335
String[] deps = option[1].split(File.pathSeparator);
334336
for (String dep : deps) {
335337
cp.add(new File(dep));
336338
}
337339
break;
338340
case "watchdirs":
341+
// TODO: sanitization of arguments
339342
String[] dirs = option[1].split(File.pathSeparator);
340343
for (String dir : dirs) {
341344
watch.add(new File(dir));
@@ -349,6 +352,7 @@ public static void main(final String[] args) throws Exception {
349352
logLevel();
350353

351354
if (cp.isEmpty()) {
355+
// TODO: sanitization of arguments
352356
cp.add(new File(System.getProperty("user.dir")));
353357
}
354358

0 commit comments

Comments
 (0)