Limit pack modules to the API, the JDK and their own pack

The pack class loader's parent is now ApiAndJdkClassLoader: com.volmit.
classes and resources come from the API's loader, everything else from
the platform loader, so modules no longer see Iris internals or the
libraries Iris bundles.

Before any class is defined, a pack load now fails when a jar holds a
com.volmit. class, and when a class references a class that is not in
the API, the JDK or a jar of the pack (read with java.lang.classfile).
Linkage errors while installing name the module's jar. ModuleInfo names
and versions reject line breaks and other control characters.
This commit is contained in:
piexel committed 2026-10-05 18:24:53 +02:00
1 parent 862f4d19be
commit 1553959cf4
11 files changed
+563 -60

No files matched your search

@@ -41,6 +41,16 @@ class ApiValuesTest {
assertThrows(NullPointerException.class, () -> ModuleInfo.of("example:moss", null, "1.0.0"));
}
@Test
void moduleInfoTextFitsOnOneLogLine() {
for (var broken : List.of("Moss\nINFO forged line", "Moss\r", "Moss\tTabbed", "Moss\u2028Next")) {
var failure = assertThrows(IllegalArgumentException.class, () -> ModuleInfo.of("example:moss", broken, "1.0.0"));
assertEquals("Module name of example:moss contains a line break or other control character", failure.getMessage());
}
assertThrows(IllegalArgumentException.class, () -> ModuleInfo.of("example:moss", "Moss", "1.0\n"));
assertEquals("Mosß é", ModuleInfo.of("example:moss", "Mosß é", "1.0.0").name());
}
@Test
void sparseObjectsCopySortAndRejectDuplicateOrOutOfBoundsBlocks() {
var a = new ObjectBlock(new BlockPosition(-1, 0, 0), new BlockState("minecraft:stone"));