Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] PythonSocket -- unhandled exception in Finalize() in restricted 
AppDomain

----------------------------------------------

ISSUES

1. [New issue] PythonSocket -- unhandled exception in Finalize() in restricted 
AppDomain
http://ironpython.codeplex.com/workitem/33779
User creinke has proposed the issue:

"Perhaps it's just my C# ignorance, but I haven't found a way to sandbox this 
away so that a sandboxed script can't bring down the host.

Example:
```
using System;
using System.Security;
using System.Security.Permissions;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;

namespace BugReport
{
    class Program
    {
        static void Main(string[] args)
        {
            AppDomain root = AppDomain.CurrentDomain;

            AppDomainSetup sandboxSetup = new AppDomainSetup();
            sandboxSetup.ApplicationBase = 
root.SetupInformation.ApplicationBase;

            PermissionSet sandboxPermissionSet = new 
PermissionSet(PermissionState.None);

            AppDomain sandbox = AppDomain.CreateDomain("sandbox", 
null, sandboxSetup, sandboxPermissionSet);

            ScriptEngine engine = Python.CreateEngine(sandbox);

            try
            {
                engine.Execute("from socket import *; s = socket(AF_INET, 
SOCK_STREAM)");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            // we don't want to wait
            GC.Collect();
            GC.WaitForPendingFinalizers();

            Console.WriteLine("Press a key...");
            Console.ReadKey();
        }
    }
}
```

Exception:
```
System.Security.SecurityException was unhandled
  Message=Request for the permission of type 
'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
  Source=mscorlib
  StackTrace:
       at System.Security.CodeAccessSecurityEngine.Check(Object demand, 
StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission 
cap, StackCrawlMark& stackMark)
       at System.Security.CodeAccessPermission.Demand()
       at System.Net.Sockets.Socket.get_Handle()
       at IronPython.Modules.PythonSocket.socket._close()
       at IronPython.Modules.PythonSocket.socket.Finalize()
  InnerException: 
```"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on 
CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue 
Tracker. You can unsubscribe or change your issue notification settings on 
CodePlex.com.
_______________________________________________
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to