Re: Checking for SecurityAttributes
From: Ivan Medvedev [MS] (ivanmed_at_online.microsoft.com)
Date: 07/08/03
- Next message: Ivan Medvedev [MS]: "Re: MACTripleDES using CryptoAPI"
- Previous message: Ivan Medvedev [MS]: "Re: Performance strategies"
- In reply to: Sekhmet den skammelige: "Checking for SecurityAttributes"
- Next in thread: Sekhmet den skammelige: "Re: Checking for SecurityAttributes"
- Reply: Sekhmet den skammelige: "Re: Checking for SecurityAttributes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 7 Jul 2003 15:07:23 -0700
Sekhmet -
that is right - currently there is no managed classes in the .NET Framework
that you can use to inspect declarative security attributes. There are some
unmanaged interfaces that can do that, or you can use the permview tool
supplied in the SDK.
Looking at your problem though it sounds like the best way to solve it would
be something other than inspecting the attributes. If you need to "sandbox"
an assembly (i.e. restrict its security permissions), the right way to do it
would be creating an AppDomain, dynamically setting its security policy so
that the assembly gets only so much permissions, and loading the assembly
into that AppDomain. That way the assembly will not get more permissions
than you give, no matter what attributes or Asserts it uses.
Hope this helps.
--Ivan
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sekhmet den skammelige" <s@lunarscape.dk> wrote in message
news:%23FmVhikQDHA.4024@tk2msftngp13.phx.gbl...
> If I have an 3. party assembly I load at runtime and would like to make
sure
> it can't assert fx. FileIOPermissions and the way I like to do that is by
> checking if the assembly sets the following attribute:
> [assembly:SecurityPermissionAttribute(SecurityAction.RequestRefuse,
> Assertion = true].
>
>
> Now, I can use the reflection API to see what custom attributes the
assembly
> has, but I can't seem to find a way to make certain that the assembly has
> said SecurityAttribute.
>
> Is it just me that can't seem to find such functionality or is it just not
> possible?
>
>
> -------------------------------------
>
> /kim/sekhmet/birkelund
>
> s@lunarscape.dk
>
>
>
>
- Next message: Ivan Medvedev [MS]: "Re: MACTripleDES using CryptoAPI"
- Previous message: Ivan Medvedev [MS]: "Re: Performance strategies"
- In reply to: Sekhmet den skammelige: "Checking for SecurityAttributes"
- Next in thread: Sekhmet den skammelige: "Re: Checking for SecurityAttributes"
- Reply: Sekhmet den skammelige: "Re: Checking for SecurityAttributes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|