Re: trying to figure out code permissions
- From: David Thielen <thielen@xxxxxxxxxxxxx>
- Date: Sun, 8 Apr 2007 11:40:02 -0700
Hi;
I'm still not getting something. I now have:
[assembly: UIPermission(SecurityAction.RequestOptional, Window =
UIPermissionWindow.AllWindows)]
And am getting this on startup:
System.Security.SecurityException was unhandled
Message="Request for the permission of type
'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Source="mscorlib"
GrantedSet="<PermissionSet
class=\"System.Security.PermissionSet\"\r\nversion=\"1\">\r\n<IPermission
class=\"System.Security.Permissions.SecurityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089\"\r\nversion=\"1\"\r\nFlags=\"Execution\"/>\r\n<IPermission
class=\"System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089\"\r\nversion=\"1\"\r\nWindow=\"AllWindows\"/>\r\n</PermissionSet>\r\n"
PermissionState="<IPermission
class=\"System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089\"\r\nversion=\"1\"\r\nUnrestricted=\"true\"/>\r\n"
RefusedSet=""
Url="file:///C:/src/TestPerm/TestPerm/bin/Debug/TestPerm.EXE"
StackTrace:
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
One of the choices in the debugger prompt was "Add Permission to the
project" - I clicked on that, exited VS2005, started it again, and still get
this.
What am I missing?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
"Dominick Baier" wrote:
RequestMinimum makes sure you have this permission. Not that all others are.
disabled.
Try RequestOptional instead.
-----
Dominick Baier (http://www.leastprivilege.com)
Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)
Hi;
I assumed the following code would not load. And if it loaded, would
throw an exception on the OpenText. However it runs fine.
AssemblyInfo.cs:
// only permission - set to cause all other to be disallowed
[assembly: RegistryPermission(SecurityAction.RequestMinimum)]
Program.cs:
class Program
{
static void Main(string[] args)
{
MyObj obj = new MyObj();
string str = obj.ToString();
File.OpenText(str);
}
}
class MyObj
{
public override string ToString()
{
return "dave.txt";
}
}
Why does this work?
Cubicle Wars - http://www.windwardreports.com/film.htm
- Follow-Ups:
- Re: trying to figure out code permissions
- From: Dominick Baier
- Re: trying to figure out code permissions
- References:
- Re: trying to figure out code permissions
- From: Dominick Baier
- Re: trying to figure out code permissions
- Prev by Date: Re: Lost ability to use membership system
- Next by Date: Re: trying to figure out code permissions
- Previous by thread: Re: trying to figure out code permissions
- Next by thread: Re: trying to figure out code permissions
- Index(es):
Relevant Pages
|
|