Re: Identity Permission and Code Access Permission classes

From: Novice (6tc1ATqlinkDOTqueensuDOTca)
Date: 08/23/04


Date: Mon, 23 Aug 2004 06:09:02 -0700

I'm really just trying to get a better grasp of when it would be appropriate
to use the Stack Walk Modifiers. I guess, they are appropriate just to
lock-down your application/libraries - but that ultimately it is the
responsibility of the computer hosting the application to ensure access is
limited.

What are your thoughts?

Novice

"Nicole Calinoiu" wrote:

> I'm still not sure what your ultimate goal is here, so it's a bit difficult
> to say whether the information in the P&P document is really relevant. It
> would help quite a bit if you could better describe why you want to protect
> the contents of this directory and against what type(s) of threat you
> believe it requires protection.
>
> My guess so far has been that this is a configuration directory for your
> application, and you want to protect its contents from modification by any
> code other than your own. If so, within-code protections (whether
> imperative or declarative) are only a partial solution, addressing only
> possible luring of your code to perform undesired actions. However, even
> wrt to this particular goal, use of StrongNamePermission alone isn't
> necessarily particularly useful since it's trivial to bypass. It can,
> however, be sufficient to counter certain types of threats. So... Exactly
> what kind of potential misuse are you trying to protect this directory
> against?
>
>
> "Novice" <6tc1ATqlinkDOTqueensuDOTca> wrote in message
> news:9E20FDC3-2635-4345-A12C-04DC95205C4F@microsoft.com...
> >I believe this is information I was looking for:
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh08.asp
> >
> > Go to the section "Using Stack Walk Modifiers". Basically it states that
> > you can use the security policy, but that you can also achieve the same
> > effect programmatically in your code.
> >
> > If the above seems inconsistent with what I was originally asking - please
> > let me know because it may be that I misunderstand the documentation.
> >
> > Thanks,
> > Novice
> >
> > "Novice" wrote:
> >
> >> What I meant is that I could achieve this same functionality by writing
> >> code
> >> (imperatively) such that:
> >> if (publicKeyEqualsExpectedValue){
> >> allowWriteToHardDisk();
> >> }
> >>
> >> And again the same code could be written in declarative statements. Of
> >> course the assumption is that you have access to the source code
> >> otherwise
> >> you wouldn't be able to write the declarative or imperative statements to
> >> begin with.
> >>
> >> That is why I said it isn't "clean" since I would see putting the above
> >> statement into every assembly as a hack.
> >>
> >> But my real question was if there was a way to create a declarative
> >> statement like the one I posted:
> >> [StrongNameIdentityPermission(SecurityAction.LinkDemand,
> >> PublicKey="00240000048...97e85d098615")]
> >>
> >> And add something to the above or following the above that would also
> >> indicate that the application could only write to:
> >> c:\somedirectory\
> >> if it had the above PublicKey.
> >>
> >> I.E. is there a way to do the above in the source code for an application
> >> and use the PublicKey (a piece of evidence) to restrict an assembly's
> >> privileges/permissions.
> >>
> >> I think this could be achieve using the code access permission request
> >> operations (request, assert and deny). This of course assumes that the
> >> security policy would allow that level - however, assuming the policy
> >> allowed
> >> it - couldn't you write code such that you deny write access to that
> >> directory if the PublicKey isn't what you require?
> >>
> >> Thanks,
> >> Novice
> >>
> >>
> >> "Nicole Calinoiu" wrote:
> >>
> >> > Not sure what you mean by "I know this could be done using imperative
> >> > security" since, well, it's not. <g>
> >> >
> >> > Setting a machine to only allow access to a directory by assemblies
> >> > signed
> >> > with a specified key is certainly possible, but it's not done by
> >> > imperative
> >> > or declarative CAS checks in some other assembly's code. It's only
> >> > accomplished by setting policy. Otherwise, code that doesn't pass
> >> > through
> >> > your application wouldn't be subject to the limitation.
> >> >
> >> >
> >> >
> >> >
> >> > "Novice" <6tc1ATqlinkDOTqueensuDOTca> wrote in message
> >> > news:4E09C5AF-CECE-4C0A-BBD4-374A3E55DB14@microsoft.com...
> >> > > If I wanted to ensure that a particular assembly (or set of
> >> > > assemblies) as
> >> > > dictated by something in their evidence got certain code access
> >> > > permissions
> >> > > could I do this both in the security policy on the host machine or
> >> > > using
> >> > > declarative security (I know this could be done using imperative
> >> > > security -
> >> > > but it is not as "clean" as declarative security).
> >> > >
> >> > > To be more specific I would like to write a declarative security
> >> > > statement
> >> > > like the one below:
> >> > > [StrongNameIdentityPermission(SecurityAction.LinkDemand,
> >> > >
> >> > > PublicKey="00240000048...97e85d098615")]
> >> > >
> >> > > such that only assemblies with a particular PublicKey (like the one
> >> > > above)
> >> > > could be given rights to access "c:\somedirectory\"
> >> > >
> >> > > I would prefer to do this using declarative security statements - a
> >> > > second
> >> > > question is whether this would be possible using the security
> >> > > administrator
> >> > > on the local machine.
> >> > >
> >> > > Thanks,
> >> > > Novice
> >> >
> >> >
> >> >
>
>
>



Relevant Pages

  • Re: LAW ENFORCEMENT against PROHIBITION
    ... Found this on *Strike the Root*....I was intreigued (I used to know how ... Won't Protect Your Privacy ... SECURE ACCESS WON'T PROTECT THE PRIVACY OF TCF ... I've lived with the knowledge of this threat for some time. ...
    (alt.gathering.rainbow)
  • Re: California carry laws
    ... Secondly the deterrent effect of a shotgun is overridden by the perceived ... threat of a sniper 100> 1000 yards away. ... Just because something doesn't protect or deter every possibly threat ...
    (rec.knives)
  • Re: Best Antivirus
    ... All major Mac antivirus software vendors are guilty of this. ... which ones explicitly state they protect os x users against system 6 ... malware such as nvir & mdef, stating that they are a 'serious threat'? ... Send responses to the relevant news group rather than email to me. ...
    (comp.sys.mac.apps)
  • Re: For Australia
    ... themselves to self-described cowardice and will inevitably scorn ... There is a huge difference between standing up to a threat and standing up to an insult. ... I think any man who has ever had to concede any of his belongings because he couldn't defend them will feel bad and "unmanly", more so if he failed to protect someone weaker that he perceived to be under his protection. ... Being goaded into a fight because of some jerk with a big mouth, when no threat is present should IMO not be perceived as the same thing, even though psychologically, it might be very similar. ...
    (rec.martial-arts)
  • Re: Best Antivirus
    ... it claims to block mdef, nvir, ... which ones explicitly state they protect os x users against system 6 ... malware such as nvir & mdef, stating that they are a 'serious threat'? ...
    (comp.sys.mac.apps)

Quantcast