mirror of
https://github.com/corda/corda.git
synced 2025-01-01 18:56:44 +00:00
Guava tests
This commit is contained in:
parent
e3440dc2f6
commit
6b7da055f3
@ -30,7 +30,6 @@ dependencies {
|
||||
testImplementation('log4j:apache-log4j-extras:1.2.17') {
|
||||
exclude group: 'log4j', module: 'log4j'
|
||||
}
|
||||
// testImplementation group: 'com.ea.agentloader', name: 'ea-agent-loader', version: '1.0.3'
|
||||
testImplementation "com.google.guava:guava:$guava_version"
|
||||
testImplementation "org.yaml:snakeyaml:1.33"
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
/* Copyright (c) 2022, Daniel Gredler. All rights reserved. */
|
||||
|
||||
package net.gredler.aegis4j;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* Tests Guava blocking.
|
||||
*/
|
||||
public class CVE_2020_8908 {
|
||||
@AfterAll
|
||||
public static void uninstallAgent() throws Exception {
|
||||
System.clearProperty("aegis4j.additional.args");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
TestUtils.installAgent("path=../resources/test/guava-mods.properties");
|
||||
try {
|
||||
com.google.common.io.Files.createTempDir();
|
||||
fail("Exception expected");
|
||||
} catch (RuntimeException e) {
|
||||
assertEquals("Guava createTempDir blocked by aegis4j", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
3
tools/aegis4j/src/test/resources/guava-mods.properties
Normal file
3
tools/aegis4j/src/test/resources/guava-mods.properties
Normal file
@ -0,0 +1,3 @@
|
||||
# format: <feature>.<class-name>.<method-name>=<replacement-code>
|
||||
# CVE-2020-8908
|
||||
GUAVA.com.google.common.io.Files.createTempDir=throw new java.lang.RuntimeException("Guava createTempDir blocked by aegis4j");
|
Loading…
Reference in New Issue
Block a user