Re: trying to figure out code permissions



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



.



Relevant Pages

  • RE: Trying to run in partial trust (getting a PolicyException)
    ... RequestMinimum and the two items below were the only uses in all of my code. ... class="System.Security.Permissions.EnvironmentPermission, mscorlib, ... I think you can check the permission ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: SecurityAction RequestOptional, RequestRefuse, & more
    ... > event that other DLLs can register with and when that event fires, ... > So it looks like I should only declare RequestMinimum and leave the ... your existing assembly-level permission attributes. ...
    (microsoft.public.dotnet.framework)
  • RE: SecurityAction RequestOptional, RequestRefuse, & more
    ... the RequestMinimum the give your dll the permission. ... cannot be granted permissions by code access security policy that it does ...
    (microsoft.public.dotnet.framework)
  • Re: StrongNameIdentityPermission at Assembly level?
    ... RequestMinimum will make sure the current assembly has the permission in ... question before allowing it to execute. ... Demand and LinkDemand examine the permissions of callers which is what you ... > permission will verify that your assembly will execute ONLY if it is ...
    (microsoft.public.dotnet.security)