From dc6c8fba65b7da931e141ddf032d27f7bff2b28d Mon Sep 17 00:00:00 2001 From: Sebastian Erives Date: Sun, 27 Oct 2024 22:37:19 -0600 Subject: [PATCH] Fixing PluginClassLoader to handle blacklisting correctly --- .../eocvsim/gui/DialogFactory.java | 5 +- .../gui/component/visualizer/TopMenuBar.kt | 4 +- .../eocvsim/gui/dialog/PluginOutput.kt | 222 +++++++++++++++++- .../plugin/loader/PluginClassLoader.kt | 45 ++-- .../eocvsim/plugin/loader/PluginLoader.kt | 33 ++- .../eocvsim/plugin/loader/PluginManager.kt | 15 +- .../DynamicLoadingClassRestrictions.kt | 7 +- EOCV-Sim/src/main/resources/repository.toml | 3 +- 8 files changed, 290 insertions(+), 44 deletions(-) diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java index ab4149c..a1cd2f1 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java @@ -32,6 +32,7 @@ import com.github.serivesmejia.eocvsim.gui.dialog.source.CreateVideoSource; import com.github.serivesmejia.eocvsim.input.SourceType; import com.github.serivesmejia.eocvsim.util.event.EventHandler; +import io.github.deltacv.eocvsim.plugin.loader.PluginManager; import javax.swing.*; import javax.swing.filechooser.FileFilter; @@ -147,10 +148,10 @@ public static void createPipelineOutput(EOCVSim eocvSim) { }); } - public static AppendDelegate createMavenOutput(Runnable onContinue) { + public static AppendDelegate createMavenOutput(PluginManager manager, Runnable onContinue) { AppendDelegate delegate = new AppendDelegate(); - invokeLater(() -> new PluginOutput(delegate, onContinue)); + invokeLater(() -> new PluginOutput(delegate, manager, manager.getEocvSim(), onContinue)); return delegate; } diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/TopMenuBar.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/TopMenuBar.kt index f28a4b2..81af4fa 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/TopMenuBar.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/TopMenuBar.kt @@ -102,8 +102,8 @@ class TopMenuBar(visualizer: Visualizer, eocvSim: EOCVSim) : JMenuBar() { mFileMenu.add(editSettings) - val filePlugins = JMenuItem("Plugins") - filePlugins.addActionListener { eocvSim.pluginManager.appender.append(PluginOutput.SPECIAL_OPEN)} + val filePlugins = JMenuItem("Manage Plugins") + filePlugins.addActionListener { eocvSim.pluginManager.appender.append(PluginOutput.SPECIAL_OPEN_MGR)} mFileMenu.add(filePlugins) diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/PluginOutput.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/PluginOutput.kt index 41ba004..65ce7b7 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/PluginOutput.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/PluginOutput.kt @@ -23,8 +23,11 @@ package com.github.serivesmejia.eocvsim.gui.dialog +import com.github.serivesmejia.eocvsim.EOCVSim import com.github.serivesmejia.eocvsim.gui.dialog.component.BottomButtonsPanel import com.github.serivesmejia.eocvsim.gui.dialog.component.OutputPanel +import io.github.deltacv.eocvsim.plugin.loader.PluginManager +import io.github.deltacv.eocvsim.plugin.loader.PluginSource import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -34,6 +37,12 @@ import java.awt.Dimension import java.awt.Toolkit import java.awt.datatransfer.StringSelection import javax.swing.* +import java.awt.GridBagConstraints +import java.awt.GridBagLayout +import java.awt.event.ActionEvent +import java.awt.event.ActionListener +import javax.swing.event.ChangeEvent +import javax.swing.event.ChangeListener class AppendDelegate { private val appendables = mutableListOf() @@ -75,13 +84,16 @@ class AppendDelegate { class PluginOutput( appendDelegate: AppendDelegate, + val pluginManager: PluginManager, + val eocvSim: EOCVSim? = null, val onContinue: Runnable ) : Appendable { companion object { - private const val SPECIAL = "13mck" + private const val SPECIAL = "[13mck]" const val SPECIAL_OPEN = "$SPECIAL[OPEN]" + const val SPECIAL_OPEN_MGR = "$SPECIAL[OPEN_MGR]" const val SPECIAL_CLOSE = "$SPECIAL[CLOSE]" const val SPECIAL_CONTINUE = "$SPECIAL[CONTINUE]" const val SPECIAL_FREE = "$SPECIAL[FREE]" @@ -90,6 +102,7 @@ class PluginOutput( fun String.trimSpecials(): String { return this .replace(SPECIAL_OPEN, "") + .replace(SPECIAL_OPEN_MGR, "") .replace(SPECIAL_CLOSE, "") .replace(SPECIAL_CONTINUE, "") .replace(SPECIAL_SILENT, "") @@ -100,6 +113,8 @@ class PluginOutput( private val output = JDialog() private val tabbedPane: JTabbedPane + private var shouldAskForRestart = false + private val mavenBottomButtonsPanel: MavenOutputBottomButtonsPanel = MavenOutputBottomButtonsPanel(::close) { mavenOutputPanel.outputArea.text } @@ -114,11 +129,7 @@ class PluginOutput( tabbedPane = JTabbedPane() output.add(tabbedPane.apply { - addTab("Plugins", JPanel().apply { - layout = BoxLayout(this, BoxLayout.PAGE_AXIS) - - add(JLabel("Plugins output will be shown here")) - }) + addTab("Plugins", makePluginManagerPanel()) addTab("Output", mavenOutputPanel) }) @@ -135,14 +146,201 @@ class PluginOutput( @OptIn(DelicateCoroutinesApi::class) private fun registerListeners() = GlobalScope.launch(Dispatchers.Swing) { + output.addWindowListener(object : java.awt.event.WindowAdapter() { + override fun windowClosing(e: java.awt.event.WindowEvent?) { + if(mavenBottomButtonsPanel.continueButton.isEnabled) { + mavenBottomButtonsPanel.continueButton.doClick() + } + + checkShouldAskForRestart() + } + }) + mavenBottomButtonsPanel.continueButton.addActionListener { close() onContinue.run() - - output.defaultCloseOperation = WindowConstants.HIDE_ON_CLOSE mavenBottomButtonsPanel.continueButton.isEnabled = false mavenBottomButtonsPanel.closeButton.isEnabled = true } + + tabbedPane.addChangeListener(object: ChangeListener { + override fun stateChanged(e: ChangeEvent?) { + // remake plugin manager panel + if(tabbedPane.selectedIndex == tabbedPane.indexOfTab("Plugins")) { + tabbedPane.setComponentAt(0, makePluginManagerPanel()) + } + } + }) + } + + private fun checkShouldAskForRestart() { + if(shouldAskForRestart && eocvSim != null) { + val dialogResult = JOptionPane.showConfirmDialog( + output, + "You need to restart the application to apply the changes. Do you want to restart now?", + "Restart required", + JOptionPane.YES_NO_OPTION + ) + + if(dialogResult == JOptionPane.YES_OPTION) { + eocvSim.restart() + } + + shouldAskForRestart = false + } + } + + private fun makePluginManagerPanel(): JPanel { + val panel = JPanel() + panel.layout = GridBagLayout() + + if(pluginManager.loaders.isEmpty()) { + // center vertically and horizontally + val noPluginsLabel = JLabel("

Nothing to see here...

") + noPluginsLabel.horizontalAlignment = SwingConstants.CENTER + noPluginsLabel.verticalAlignment = SwingConstants.CENTER + + // Use GridBagConstraints to center the label + val constraints = GridBagConstraints().apply { + gridx = 0 // Center horizontally + gridy = 0 // Center vertically + weightx = 1.0 // Take up the entire horizontal space + weighty = 1.0 // Take up the entire vertical space + anchor = GridBagConstraints.CENTER // Center alignment + } + + // Add the label to the panel with the constraints + panel.add(noPluginsLabel, constraints) + } else { + val tabbedPane = JTabbedPane(JTabbedPane.LEFT) + + for((_, loader) in pluginManager.loaders) { + val pluginPanel = JPanel() + pluginPanel.layout = GridBagLayout() + + val pluginNameLabel = JLabel( + "

${loader.pluginName} v${loader.pluginVersion} by ${loader.pluginAuthor}

", + SwingConstants.CENTER + ) + + pluginPanel.add(pluginNameLabel, GridBagConstraints().apply { + gridx = 0 + gridy = 0 + weightx = 1.0 + fill = GridBagConstraints.HORIZONTAL + anchor = GridBagConstraints.CENTER + }) + + val authorEmail = if(loader.pluginAuthorEmail.isBlank()) + "The author did not provide contact information." + else "Contact the author at ${loader.pluginAuthorEmail}" + + val description = if(loader.pluginDescription.isBlank()) + "No description available." + else loader.pluginDescription + + val source = if(loader.pluginSource == PluginSource.REPOSITORY) + "Maven repository" + else "local file" + + val superAccess = if(loader.hasSuperAccess) + "This plugin has super access." + else "This plugin does not have super access." + + val wantsSuperAccess = if(loader.pluginToml.getBoolean("super-access", false)) + "It requests super access in its manifest." + else "It does not request super access in its manifest." + + val font = pluginNameLabel.font.deriveFont(13.0f) + + // add a text area for the plugin description + val pluginDescriptionArea = JTextArea(""" + $authorEmail + + ${if(loader.shouldEnable) "This plugin was loaded from a $source." else "This plugin is disabled, it comes from a $source."} + $superAccess $wantsSuperAccess + + $description + """.trimIndent()) + + pluginDescriptionArea.font = font + pluginDescriptionArea.isEditable = false + pluginDescriptionArea.lineWrap = true + pluginDescriptionArea.wrapStyleWord = true + pluginDescriptionArea.background = pluginPanel.background + + pluginPanel.add(JScrollPane(pluginDescriptionArea), GridBagConstraints().apply { + gridx = 0 + gridy = 1 + weightx = 1.0 + weighty = 1.0 + fill = GridBagConstraints.BOTH + }) + + val restartWarnLabel = JLabel("Restart to apply changes.") + restartWarnLabel.isVisible = false + + val disableButton = JButton("Disable") + val enableButton = JButton("Enable") + + fun refreshButtons() { + disableButton.isEnabled = loader.shouldEnable + enableButton.isEnabled = !loader.shouldEnable + + } + + refreshButtons() + + enableButton.addActionListener { + loader.shouldEnable = true + restartWarnLabel.isVisible = true + shouldAskForRestart = true + + refreshButtons() + } + disableButton.addActionListener { + loader.shouldEnable = false + restartWarnLabel.isVisible = true + shouldAskForRestart = true + + refreshButtons() + } + + // center buttons + val buttonsPanel = JPanel() + buttonsPanel.border = BorderFactory.createEmptyBorder(10, 0, 0, 0) + + buttonsPanel.layout = BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS) + + buttonsPanel.add(restartWarnLabel) + buttonsPanel.add(Box.createHorizontalGlue()) + buttonsPanel.add(disableButton) + buttonsPanel.add(Box.createRigidArea(Dimension(5, 0))) + buttonsPanel.add(enableButton) + + pluginPanel.add(buttonsPanel, GridBagConstraints().apply { + gridx = 0 + gridy = 2 + weightx = 1.0 + fill = GridBagConstraints.HORIZONTAL + anchor = GridBagConstraints.CENTER + }) + + pluginPanel.border = BorderFactory.createEmptyBorder(10, 10, 10, 10) + + tabbedPane.addTab(loader.pluginName, pluginPanel) + } + + panel.add(tabbedPane, GridBagConstraints().apply { + gridx = 0 + gridy = 0 + weightx = 1.0 + weighty = 1.0 + fill = GridBagConstraints.BOTH + }) + } + + return panel } fun close() { @@ -165,8 +363,14 @@ class PluginOutput( if(!text.startsWith(SPECIAL_SILENT) && text != SPECIAL_CLOSE && text != SPECIAL_FREE) { SwingUtilities.invokeLater { SwingUtilities.invokeLater { - tabbedPane.selectedIndex = tabbedPane.indexOfTab("Output") // focus on output tab + if(text == SPECIAL_OPEN_MGR) { + tabbedPane.selectedIndex = tabbedPane.indexOfTab("Plugins") // focus on plugins tab + } else { + tabbedPane.selectedIndex = tabbedPane.indexOfTab("Output") // focus on output tab + } } + + tabbedPane.setComponentAt(0, makePluginManagerPanel()) output.isVisible = true } } diff --git a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginClassLoader.kt b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginClassLoader.kt index 5f54b4f..f22231a 100644 --- a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginClassLoader.kt +++ b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginClassLoader.kt @@ -26,6 +26,7 @@ package io.github.deltacv.eocvsim.plugin.loader import com.github.serivesmejia.eocvsim.util.SysUtil import com.github.serivesmejia.eocvsim.util.extension.removeFromEnd import io.github.deltacv.eocvsim.sandbox.restrictions.MethodCallByteCodeChecker +import io.github.deltacv.eocvsim.sandbox.restrictions.dynamicLoadingExactMatchBlacklist import io.github.deltacv.eocvsim.sandbox.restrictions.dynamicLoadingMethodBlacklist import io.github.deltacv.eocvsim.sandbox.restrictions.dynamicLoadingPackageBlacklist import io.github.deltacv.eocvsim.sandbox.restrictions.dynamicLoadingPackageWhitelist @@ -92,10 +93,21 @@ class PluginClassLoader( fun loadClassStrict(name: String): Class<*> { if(!pluginContextProvider().hasSuperAccess) { for (blacklistedPackage in dynamicLoadingPackageBlacklist) { + for(whiteListedPackage in dynamicLoadingPackageWhitelist) { + // If the class is whitelisted, skip the blacklist check + if(name.contains(whiteListedPackage)) continue + } + if (name.contains(blacklistedPackage)) { throw IllegalAccessError("Plugins are blacklisted to use $name") } } + + for(blacklistedClass in dynamicLoadingExactMatchBlacklist) { + if(name == blacklistedClass) { + throw IllegalAccessError("Plugins are blacklisted to use $name") + } + } } return loadClass(zipFile.getEntry(name.replace('.', '/') + ".class") ?: throw ClassNotFoundException(name)) @@ -105,29 +117,30 @@ class PluginClassLoader( var clazz = loadedClasses[name] if(clazz == null) { - var inWhitelist = false - - for(whiteListedPackage in dynamicLoadingPackageWhitelist) { - if(name.contains(whiteListedPackage)) { - inWhitelist = true - break + try { + clazz = loadClassStrict(name) + } catch(_: Exception) { + val classpathClass = classFromClasspath(name) + if(classpathClass != null) { + clazz = classpathClass } } - if(!inWhitelist && !pluginContextProvider().hasSuperAccess) { - throw IllegalAccessError("Plugins are not whitelisted to use $name") - } + if(clazz == null) { + var inWhitelist = false - clazz = try { - Class.forName(name) - } catch (_: ClassNotFoundException) { - val classpathClass = classFromClasspath(name) + for (whiteListedPackage in dynamicLoadingPackageWhitelist) { + if (name.contains(whiteListedPackage)) { + inWhitelist = true + break + } + } - if(classpathClass != null) { - return classpathClass + if (!inWhitelist && !pluginContextProvider().hasSuperAccess) { + throw IllegalAccessError("Plugins are not whitelisted to use $name") } - loadClassStrict(name) + clazz = Class.forName(name) } if(resolve) resolveClass(clazz) diff --git a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginLoader.kt b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginLoader.kt index 183ced5..f8174fd 100644 --- a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginLoader.kt +++ b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginLoader.kt @@ -32,12 +32,10 @@ import com.github.serivesmejia.eocvsim.util.event.EventHandler import com.github.serivesmejia.eocvsim.util.extension.plus import com.github.serivesmejia.eocvsim.util.loggerForThis import com.moandjiezana.toml.Toml -import org.apache.logging.log4j.LogManager import io.github.deltacv.common.util.ParsedVersion import io.github.deltacv.eocvsim.plugin.EOCVSimPlugin import io.github.deltacv.eocvsim.sandbox.nio.SandboxFileSystem import net.lingala.zip4j.ZipFile -import org.apache.logging.log4j.core.LoggerContext import java.io.File import java.security.MessageDigest @@ -69,6 +67,15 @@ class PluginLoader( val pluginClassLoader: PluginClassLoader + var shouldEnable: Boolean + get() { + return eocvSim.config.flags.getOrDefault(hash(), true) + } + set(value) { + eocvSim.config.flags[hash()] = value + eocvSim.configManager.saveToFile() + } + lateinit var pluginToml: Toml private set @@ -77,6 +84,9 @@ class PluginLoader( lateinit var pluginVersion: String private set + lateinit var pluginDescription: String + private set + lateinit var pluginAuthor: String private set lateinit var pluginAuthorEmail: String @@ -124,6 +134,8 @@ class PluginLoader( pluginName = pluginToml.getString("name") ?: throw InvalidPluginException("No name in plugin.toml") pluginVersion = pluginToml.getString("version") ?: throw InvalidPluginException("No version in plugin.toml") + pluginDescription = pluginToml.getString("description", "") + pluginAuthor = pluginToml.getString("author") ?: throw InvalidPluginException("No author in plugin.toml") pluginAuthorEmail = pluginToml.getString("author-email", "") } @@ -138,12 +150,19 @@ class PluginLoader( fetchInfoFromToml() + if(!shouldEnable) { + appender.appendln("${PluginOutput.SPECIAL_SILENT}Plugin $pluginName v$pluginVersion is disabled") + return + } + appender.appendln("${PluginOutput.SPECIAL_SILENT}Loading plugin $pluginName v$pluginVersion by $pluginAuthor from ${pluginSource.name}") setupFs() - if(pluginToml.contains("api-version")) { - val parsedVersion = ParsedVersion(pluginToml.getString("api-version")) + if(pluginToml.contains("api-version") || pluginToml.contains("min-api-version")) { + // default to api-version if min-api-version is not present + val apiVersionKey = if(pluginToml.contains("api-version")) "api-version" else "min-api-version" + val parsedVersion = ParsedVersion(pluginToml.getString(apiVersionKey)) if(parsedVersion > EOCVSim.PARSED_VERSION) throw UnsupportedPluginException("Plugin requires a minimum api version of v${parsedVersion}, EOCV-Sim is currently running at v${EOCVSim.PARSED_VERSION}") @@ -155,7 +174,7 @@ class PluginLoader( val parsedVersion = ParsedVersion(pluginToml.getString("max-api-version")) if(parsedVersion < EOCVSim.PARSED_VERSION) - throw UnsupportedPluginException("Plugin requires a maximum api version of v${parsedVersion}, EOCV-Sim is currently running at v${EOCVSim.PARSED_VERSION}") + throw UnsupportedPluginException("Plugin requires a max api version of v${parsedVersion}, EOCV-Sim is currently running at v${EOCVSim.PARSED_VERSION}") logger.info("Plugin $pluginName requests max api version of v${parsedVersion}") } @@ -198,6 +217,8 @@ class PluginLoader( fun enable() { if(enabled || !loaded) return + if(!shouldEnable) return + appender.appendln("${PluginOutput.SPECIAL_SILENT}Enabling plugin $pluginName v$pluginVersion") plugin.enabled = true @@ -226,6 +247,7 @@ class PluginLoader( * @see EventHandler.banClassLoader */ fun kill() { + if(!loaded) return fileSystem.close() enabled = false EventHandler.banClassLoader(pluginClassLoader) @@ -236,6 +258,7 @@ class PluginLoader( * @param reason the reason for requesting super access */ fun requestSuperAccess(reason: String): Boolean { + if(!loaded) return false if(hasSuperAccess) return true return eocvSim.pluginManager.requestSuperAccessFor(this, reason) } diff --git a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginManager.kt b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginManager.kt index 9ce1a5a..0456e24 100644 --- a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginManager.kt +++ b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/plugin/loader/PluginManager.kt @@ -62,7 +62,7 @@ class PluginManager(val eocvSim: EOCVSim) { private val haltCondition = haltLock.newCondition() val appender by lazy { - val appender = DialogFactory.createMavenOutput { + val appender = DialogFactory.createMavenOutput(this) { haltLock.withLock { haltCondition.signalAll() } @@ -94,7 +94,8 @@ class PluginManager(val eocvSim: EOCVSim) { */ val pluginFiles get() = _pluginFiles.toList() - private val loaders = mutableMapOf() + private val _loaders = mutableMapOf() + val loaders get() = _loaders.toMap() private var isEnabled = false @@ -129,7 +130,7 @@ class PluginManager(val eocvSim: EOCVSim) { } for (pluginFile in pluginFiles) { - loaders[pluginFile] = PluginLoader( + _loaders[pluginFile] = PluginLoader( pluginFile, repositoryManager.resolvedFiles, if(pluginFile in repositoryManager.resolvedFiles) @@ -147,7 +148,7 @@ class PluginManager(val eocvSim: EOCVSim) { * @see PluginLoader.load */ fun loadPlugins() { - for ((file, loader) in loaders) { + for ((file, loader) in _loaders) { try { loader.fetchInfoFromToml() @@ -167,7 +168,7 @@ class PluginManager(val eocvSim: EOCVSim) { appender.appendln(e.message ?: "Unknown error") logger.error("Failure loading ${loader.pluginName} v${loader.pluginVersion}", e) - loaders.remove(file) + _loaders.remove(file) loader.kill() } } @@ -178,7 +179,7 @@ class PluginManager(val eocvSim: EOCVSim) { * @see PluginLoader.enable */ fun enablePlugins() { - for (loader in loaders.values) { + for (loader in _loaders.values) { try { loader.enable() } catch (e: Throwable) { @@ -197,7 +198,7 @@ class PluginManager(val eocvSim: EOCVSim) { fun disablePlugins() { if(!isEnabled) return - for (loader in loaders.values) { + for (loader in _loaders.values) { try { loader.disable() } catch (e: Throwable) { diff --git a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/sandbox/restrictions/DynamicLoadingClassRestrictions.kt b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/sandbox/restrictions/DynamicLoadingClassRestrictions.kt index fb8b3c5..dde92ba 100644 --- a/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/sandbox/restrictions/DynamicLoadingClassRestrictions.kt +++ b/EOCV-Sim/src/main/java/io/github/deltacv/eocvsim/sandbox/restrictions/DynamicLoadingClassRestrictions.kt @@ -25,10 +25,12 @@ package io.github.deltacv.eocvsim.sandbox.restrictions val dynamicLoadingPackageWhitelist = setOf( "java.lang", + "java.lang.RuntimeException", "java.util", "java.awt", "javax.swing", "java.nio", + "java.io.IOException", "java.io.File", "java.io.PrintStream", @@ -51,9 +53,12 @@ val dynamicLoadingPackageWhitelist = setOf( "com.formdev.flatlaf" ) +val dynamicLoadingExactMatchBlacklist = setOf( + "java.lang.Runtime" +) + val dynamicLoadingPackageBlacklist = setOf( // System and Runtime Classes - "java.lang.Runtime", "java.lang.ProcessBuilder", "java.lang.reflect", diff --git a/EOCV-Sim/src/main/resources/repository.toml b/EOCV-Sim/src/main/resources/repository.toml index 2a116d8..79e1b2a 100644 --- a/EOCV-Sim/src/main/resources/repository.toml +++ b/EOCV-Sim/src/main/resources/repository.toml @@ -7,5 +7,4 @@ jitpack = "https://jitpack.io/" [plugins] # Declare the plugin ID and the Maven coordinates of the plugin, similar to how you do it in Gradle. # (group:artifact:version) which will be used to download the plugin from one of Maven repositories. -# Any dependency that does not have a plugin.toml in its jar will not be considered after download. -PaperVision = "com.github.deltacv.PaperVision:EOCVSimPlugin:40a30a8965" \ No newline at end of file +# Any dependency that does not have a plugin.toml in its jar will not be considered after download. \ No newline at end of file