Skip to content

Commit

Permalink
Update PolymodHandler.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
cyn0x8 committed Feb 24, 2025
1 parent 0fad14d commit 6b6a7a0
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions source/funkin/modding/PolymodHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class PolymodHandler
"openfl.utils.Assets" => funkin.Assets
];

// Add blacklisting for prohibited classes and packages.
// Add blacklisting for prohibited classes.
final importBlacklist:Array<String> = [
// `Sys`
// Sys.command() can run malicious processes
Expand Down Expand Up @@ -309,20 +309,22 @@ class PolymodHandler
'sys.FileSystem'
];

// `polymod.*`
// Contains functions which may allow for un-blacklisting other modules.
for (cls in ClassMacro.listClassesInPackage('polymod'))
{
if (cls == null) continue;
importBlacklist.push(Type.getClassName(cls));
}
// Add blacklisting for prohibited packages.
final importBlacklistPackages:Array<String> = [
// Contains functions which may allow for un-blacklisting other modules.
'polymod',

// Access to the file system as well as `Process` which can run malicious processes
'sys.io'
];

// `sys.io.*`
// Access to the file system as well as `Process` which can run malicious processes
for (cls in ClassMacro.listClassesInPackage('sys.io'))
for (packageName in importBlacklistPackages)
{
if (cls == null) continue;
importBlacklist.push(Type.getClassName(cls));
for (cls in ClassMacro.listClassesInPackage(packageName, true))
{
if (cls == null) continue;
importBlacklist.push(Type.getClassName(cls));
}
}

// apply to Polymod
Expand Down

0 comments on commit 6b6a7a0

Please sign in to comment.