diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting/ForbiddenTypeAnalyzer.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting/ForbiddenTypeAnalyzer.cs index 67c617d..f69eed2 100644 --- a/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting/ForbiddenTypeAnalyzer.cs +++ b/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting/ForbiddenTypeAnalyzer.cs @@ -63,7 +63,10 @@ public static class ForbiddenTypeAnalyzer "System.Net", "System.Diagnostics", // catches Process, ProcessStartInfo, EventLog, Trace/Debug file sinks "System.Reflection", - "System.Threading.Thread", // raw Thread — blocks the thread-pool + // System.Threading.Thread is NOT in this list: Thread's containing namespace is + // "System.Threading" (not "System.Threading.Thread"), so a prefix check on + // "System.Threading.Thread" never matches. Thread is denied type-granularly via + // ForbiddenFullTypeNames instead so the check actually fires. "System.Threading.Tasks", // Task.Run / Parallel — scripts are synchronous predicates // and have no legitimate need to start background work; // a Task fan-out outlives the evaluation timeout entirely @@ -92,6 +95,11 @@ public static class ForbiddenTypeAnalyzer /// System.ActivatorCreateInstance is a /// reflection-equivalent escape that constructs a forbidden type by name /// without ever naming it syntactically. + /// System.Threading.Thread — raw thread creation bypasses the + /// per-evaluation timeout; denied type-granularly because its containing + /// namespace is System.Threading (shared with allowed types like + /// CancellationToken), so a namespace-prefix rule cannot reach it + /// without blocking unrelated types. (Core.Scripting-010.) /// /// public static readonly IReadOnlyList ForbiddenFullTypeNames = @@ -100,6 +108,11 @@ public static class ForbiddenTypeAnalyzer "System.AppDomain", "System.GC", "System.Activator", + // System.Threading.Thread lives in the System.Threading namespace (shared with + // CancellationToken, SemaphoreSlim, etc.), so a namespace-prefix deny-list cannot + // target it without blocking those legitimate types. Denied type-granularly here. + // (Core.Scripting-010.) + "System.Threading.Thread", ]; ///