-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move project to Forge namespace, and rename to SecureModules
Rewrite the ClassLoader to properly find resources from parent layers, support supplying a parent class loader and be easier to understand. Compatibility with cpw land SecureJarHandler is kept until next major breaking window. Targeting MC 1.21 if I don't forget. This project will need to be re-evaluated on if it even is necessary in the MC runtime at all. Yes, Jar signatures/code signers are great. However we exist in a world of coremods and runtime bytecode manipulation. There is no possible runtime security need for this. Things should be addressed in the MC universe using static analysis of the jar files themselves not runtime. Which can be done in a FAR simpler manor.
- Loading branch information
Showing
56 changed files
with
1,135 additions
and
618 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,72 @@ | ||
import groovy.json.JsonSlurper | ||
import net.steppschuh.markdowngenerator.table.Table | ||
|
||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
import java.math.RoundingMode | ||
|
||
@GrabResolver(name='jitpack.io', root='https://jitpack.io/') | ||
@GrabResolver(name = 'central', root='https://repo1.maven.org/maven2/') | ||
@Grapes([ | ||
@Grab('org.apache.groovy:groovy-json:4.0.13'), | ||
@Grab('com.github.Steppschuh:Java-Markdown-Generator:1.3.2') | ||
]) | ||
|
||
final versions = [] as SortedSet | ||
final javas = [:] as TreeMap | ||
final results = [:] as TreeMap | ||
|
||
final resultsPath = Path.of('build/test_artifacts') | ||
for (def dir : Files.list(Path.of('build/test_artifacts'))) { | ||
def dirName = dir.fileName.toString() | ||
def file = dir.resolve('jmh_results.json') | ||
if (!dirName.startsWith('jmh-') || !Files.exists(file)) | ||
continue | ||
(javaName,javaVersion) = dirName.substring('jmh-'.length()).split('-') | ||
javas.computeIfAbsent(javaName, { [] }).add(javaVersion) | ||
versions.add(javaVersion) | ||
|
||
def json = new JsonSlurper().parse(file.toFile()) | ||
for (def bench : json) { | ||
def byJava = results.computeIfAbsent(bench.benchmark, { [:] }) | ||
def byVersion = byJava.computeIfAbsent(javaName, { [:] }) | ||
|
||
def result = bench.primaryMetric.score.setScale(3, RoundingMode.CEILING) | ||
if (!bench.primaryMetric.scoreError.equals('NaN')) | ||
result += ' ± ' + bench.primaryMetric.scoreError.setScale(3, RoundingMode.CEILING) | ||
//result += bench.primaryMetric.scoreUnit | ||
|
||
byVersion.put(javaVersion, result) | ||
} | ||
} | ||
def output = "" | ||
results.forEach { bench, byJava -> | ||
final table = new Table.Builder() | ||
.withAlignments(Table.ALIGN_RIGHT, Table.ALIGN_RIGHT) | ||
.addRow((['Vendor'] + versions).toArray()) | ||
|
||
javas.forEach { javaName, javaVersions -> | ||
def row = [javaName] | ||
if (!byJava.containsKey(javaName)) { | ||
versions.forEach { javaVersion -> | ||
row.add(javaVersions.contains(javaVersion) ? "MISSING" : "") | ||
} | ||
} else { | ||
def byVersion = byJava.get(javaName) | ||
versions.forEach { javaVersion -> | ||
if (javaVersions.contains(javaVersion)) { | ||
row.add(byVersion.containsKey(javaVersion) ? byVersion.get(javaVersion) : "MISSING") | ||
} else { | ||
row.add("") | ||
} | ||
} | ||
} | ||
table.addRow(row.toArray()) | ||
} | ||
|
||
output += '### `' + bench + '` results\n' + | ||
table.build() + '\n' + | ||
'\n' | ||
} | ||
|
||
new File('jmh_results.md').text = output |
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
sjh-test/src/test/java/net/minecraftforge/securejarhandler/test/TestClassLoader.java
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,5 @@ | ||
module net.minecraftforge.securemodules.jmh { | ||
requires cpw.mods.securejarhandler; // TODO: [SM][Deprecation] Remove CPW compatibility | ||
requires jmh.core; | ||
requires jdk.unsupported; // Needed by jmh.core | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...securejarhandler/jmh/benchmarks/Main.java → ...ge/securemodules/jmh/benchmarks/Main.java
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
2 changes: 1 addition & 1 deletion
2
.../benchmarks/UnionFileSystemBenchmark.java → .../benchmarks/UnionFileSystemBenchmark.java
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,12 @@ | ||
module net.minecraftforge.securemodules.test { | ||
requires cpw.mods.securejarhandler; // TODO: [SM][Deprecation] Remove CPW compatibility | ||
|
||
requires jdk.unsupported; | ||
requires java.base; | ||
requires org.junit.jupiter.api; | ||
requires org.objectweb.asm; | ||
requires org.objectweb.asm.tree; | ||
requires net.minecraftforge.unsafe; | ||
|
||
opens net.minecraftforge.securemodules.test to org.junit.platform.commons; | ||
} |
Oops, something went wrong.