Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ namespace UnitystationLauncher.ContentScanning.Scanners;
internal static class MemberReferenceScanner
{
// Using the Parallel implementation of this
internal static void CheckMemberReferences(SandboxConfig sandboxConfig, IEnumerable<MMemberRef> members, ConcurrentBag<SandboxError> errors)
internal static void CheckMemberReferences(SandboxConfig sandboxConfig,
IEnumerable<MMemberRef> members,
ConcurrentBag<SandboxError> errors,
string asmName
)
{
Parallel.ForEach(members, memberRef =>
{
Expand All @@ -28,7 +32,8 @@ internal static void CheckMemberReferences(SandboxConfig sandboxConfig, IEnumera
// Technically this error isn't necessary since we have an earlier pass
// checking all referenced types. That should have caught this
// We still need the typeCfg so that's why we're checking. Might as well.
errors.Add(new($"Access to type not allowed: {baseTypeReferenced}"));
errors.Add(new($"Access to type not allowed: {baseTypeReferenced} in Assembly {asmName}"));

return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public async Task<bool> CheckAssemblyTypesAsync(FileInfo diskPath, DirectoryInfo
LogMessage = $"Type abuse... {fullStopwatch.ElapsedMilliseconds}ms"
});

MemberReferenceScanner.CheckMemberReferences(loadedConfig, members, errors);
MemberReferenceScanner.CheckMemberReferences(loadedConfig, members, errors, asmName);
scanLog.Invoke(new()
{
LogMessage = errors.IsEmpty ? "No sandbox violations." : $"Total violations: {errors.Count}"
Expand Down
Loading