Skip to content

Update moduleobject.cs #655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2018
Merged
Changes from 1 commit
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
Next Next commit
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~
  • Loading branch information
icetiger1974 authored Mar 24, 2018
commit 7dde53643ca18afbc668d3c04cc5784d0f53a7ba
8 changes: 8 additions & 0 deletions src/runtime/moduleobject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}'.");
Expand Down