fix(script-analysis): forbid System.AppDomain in scripts (CMN-2, WP1 task 1.2)
AppDomain's assembly-loading members (ExecuteAssembly[ByName], Load, CreateInstanceFrom[AndUnwrap], CreateInstanceAndUnwrap) were neither a forbidden scope nor exact gateway names, so a script could load and run an external assembly (even from a UNC path) in the host process. The whole type is now a forbidden scope, like System.Environment and System.GC. AppContext/Debugger were considered and left alone (no assembly-load surface). Tests: every AppDomain loading spelling (member access, ?., using static, alias) is flagged; the ban is exact-type.
This commit is contained in:
@@ -52,6 +52,12 @@ public static class ScriptTrustPolicy
|
||||
// Whole type — GC control (Collect, KeepAlive, memory pressure knobs) has
|
||||
// no legitimate script use.
|
||||
"System.GC",
|
||||
// Whole type (code review 2026-12-02 CMN-2) — AppDomain's assembly-loading members
|
||||
// (ExecuteAssembly[ByName], Load, CreateInstanceFrom[AndUnwrap],
|
||||
// CreateInstanceAndUnwrap) pull external code — even a UNC path — into the host
|
||||
// process. The exact-match gateway list cannot cover every overload name, and the
|
||||
// type has no legitimate script use, so it is banned like Environment and GC.
|
||||
"System.AppDomain",
|
||||
// Concrete ADO.NET provider namespaces. Scripts reach a DbConnection ONLY
|
||||
// via the Database helper, whose abstract System.Data.Common types stay
|
||||
// allowed; forbidding the concrete providers closes the arbitrary-host
|
||||
|
||||
Reference in New Issue
Block a user