mirror of
https://github.com/corda/corda.git
synced 2025-06-04 08:30:52 +00:00
Kotlin tests
This commit is contained in:
parent
6b7da055f3
commit
0f4eae15c6
@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
|
id 'kotlin'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'signing'
|
id 'signing'
|
||||||
@ -32,6 +33,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
testImplementation "com.google.guava:guava:$guava_version"
|
testImplementation "com.google.guava:guava:$guava_version"
|
||||||
testImplementation "org.yaml:snakeyaml:1.33"
|
testImplementation "org.yaml:snakeyaml:1.33"
|
||||||
|
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 8
|
sourceCompatibility = 8
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
/* 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 Kotlin blocking.
|
||||||
|
*/
|
||||||
|
public class CVE_2020_29582 {
|
||||||
|
@AfterAll
|
||||||
|
public static void uninstallAgent() throws Exception {
|
||||||
|
System.clearProperty("aegis4j.additional.args");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDir() throws Exception {
|
||||||
|
TestUtils.installAgent("path=../resources/test/kotlin-mods.properties");
|
||||||
|
try {
|
||||||
|
new KotlinStdLibUtils().kotlinCreateTempDir();
|
||||||
|
fail("Exception expected");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
assertEquals("Kotlin createTempDir blocked by aegis4j", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFile() throws Exception {
|
||||||
|
TestUtils.installAgent("path=../resources/test/kotlin-mods.properties");
|
||||||
|
try {
|
||||||
|
new KotlinStdLibUtils().kotlinCreateTempFile();
|
||||||
|
fail("Exception expected");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
assertEquals("Kotlin createTempFile blocked by aegis4j", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package net.gredler.aegis4j
|
||||||
|
|
||||||
|
class KotlinStdLibUtils {
|
||||||
|
|
||||||
|
fun kotlinCreateTempDir() {
|
||||||
|
createTempDir()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun kotlinCreateTempFile() {
|
||||||
|
createTempFile()
|
||||||
|
}
|
||||||
|
}
|
4
tools/aegis4j/src/test/resources/kotlin-mods.properties
Normal file
4
tools/aegis4j/src/test/resources/kotlin-mods.properties
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# format: <feature>.<class-name>.<method-name>=<replacement-code>
|
||||||
|
# CVE-2020-29582
|
||||||
|
KOTLIN.kotlin.io.FilesKt__UtilsKt.createTempDir=throw new java.lang.RuntimeException("Kotlin createTempDir blocked by aegis4j");
|
||||||
|
KOTLIN.kotlin.io.FilesKt__UtilsKt.createTempFile=throw new java.lang.RuntimeException("Kotlin createTempFile blocked by aegis4j");
|
@ -1,8 +1,3 @@
|
|||||||
# format: <feature>.<class-name>.<method-name>=<replacement-code>
|
# format: <feature>.<class-name>.<method-name>=<replacement-code>
|
||||||
# CVE-2022-1471
|
# CVE-2022-1471
|
||||||
SNAKEYAML.org.yaml.snakeyaml.constructor.Constructor.Constructor=throw new java.lang.RuntimeException("SnakeYAML Constructor blocked by aegis4j");
|
SNAKEYAML.org.yaml.snakeyaml.constructor.Constructor.Constructor=throw new java.lang.RuntimeException("SnakeYAML Constructor blocked by aegis4j");
|
||||||
# CVE-2020-29582
|
|
||||||
#KOTLIN.kotlin.io.FilesKt__UtilsKt.createTempDir=throw new java.lang.RuntimeException("Kotlin createTempDir blocked by aegis4j");
|
|
||||||
#KOTLIN.kotlin.io.FilesKt__UtilsKt.createTempFile=throw new java.lang.RuntimeException("Kotlin createTempFile blocked by aegis4j");
|
|
||||||
# CVE-2020-8908
|
|
||||||
#GUAVA.com.google.common.io.Files.createTempDir=throw new java.lang.RuntimeException("Guava createTempDir blocked by aegis4j");
|
|
Loading…
x
Reference in New Issue
Block a user