From 7dde53643ca18afbc668d3c04cc5784d0f53a7ba Mon Sep 17 00:00:00 2001 From: icetiger nate Date: Sat, 24 Mar 2018 14:01:47 +0900 Subject: [PATCH] Update moduleobject.cs I am a novice in English and pythonnet. But I am a Fan of pythonnet. The Proposed file is about NTFS Security. https://stackoverflow.com/questions/4496697/what-is-zone-identifier please check~ --- src/runtime/moduleobject.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/runtime/moduleobject.cs b/src/runtime/moduleobject.cs index e683026f9..4accb1531 100644 --- a/src/runtime/moduleobject.cs +++ b/src/runtime/moduleobject.cs @@ -395,6 +395,14 @@ public static Assembly AddReference(string name) { assembly = AssemblyManager.LoadAssemblyFullPath(name); } + if (System.IO.File.Exists(name)) + { + var zone = System.Security.Policy.Zone.CreateFromUrl(name); + if (zone.SecurityZone != System.Security.SecurityZone.MyComputer) + { + throw new Exception($"File is blocked (NTFS Security)"); + } + } if (assembly == null) { throw new FileNotFoundException($"Unable to find assembly '{name}'.");