Re: PrincipalPermission trouble

From: Viorel Ghilas (vghilas_at_hotmail.com)
Date: 06/20/05


Date: Mon, 20 Jun 2005 16:34:49 +0300

Hi Dominick

I agree that PrincipalPermission is not really a CAS Permission because it
does not extend CodeAccessPermission. But could you explain me what kind of
verification do Demand through stack walk? It call IsInRole for each stack
element? Can stack list contian diferent Principal values?

"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
wrote in message news:494893632548578244451812@news.microsoft.com...
> Hello Viorel,
>
> so in other words - there is no performance optimization using LinkDemand
> (others than it does not seem to work correctly)
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
> > I am absolutly know that it's the principal that must be checked. It's
> > not a security issuer in authentication, it's microsoft defenition of
> > LinkDemand
> >
> > a.. LinkDemand happens at just-in-time (JIT) compilation time and
> > checks only the immediate caller. This security check does not check
> > the caller's caller. Once this check passes, there is no additional
> > security overhead no matter how many times the caller might call.
> > However, there is also no protection from luring attacks. With
> > LinkDemand, any code that passes the test and can reference your code
> > can potentially break security by allowing malicious code to call
> > using the authorized code. Therefore, do not use LinkDemand unless all
> > the possible weaknesses can be thoroughly avoided.
> >
> > But Demand I don't use for performance reasions. So I decide to move
> > from declarative LinkDemand security permissions to my own imperative
> > security check method and I will check all cases and will log more
> > graceful errors.
> >
> > With best regards
> > Viorel
> > "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com>
> > wrote in message news:OgsJFy0cFHA.2288@TK2MSFTNGP14.phx.gbl...
> >
> >> Are you absolutely positive that the correct principal is on the
> >> thread
> >>
> > when
> >
> >> you make your checks? Is Thread.CurrentPrincipal pointing to a
> >> different user every time or the same user? Perhaps there is a bug
> >> in your authentication or something.
> >>
> >> Joe K.
> >>
> >> "Viorel Ghilas" <vghilas@hotmail.com> wrote in message
> >> news:%23pR4JmkcFHA.796@TK2MSFTNGP09.phx.gbl...
> >>
> >>> Hi all,
> >>>
> >>> I have a library that have methods protected with
> >>> PrincipalPermission,
> >>>
> > for
> >
> >>> ex.
> >>> [PrincipalPermission(SecurityAction.LinkDemand, Role="DBAdmin")]
> >>> public Guid GetAdminId() {
> >>> return new Guid("{BCA26163-E488-4ce8-BF6B-597EB0BE388F}");
> >>> }
> >>> and I have a web app that create an user with a role on login. The
> >>>
> > problem
> >
> >>> is that after one user with "DBAdmin" role call GetAdminId then
> >>> after it
> >>> every user with every role that are loged in system could call this
> >>> method.
> >>> How can I resolve this problem. If I put Demand otherwise LinkDemand
> >>> it
> >>> will
> >>> work, but I dont use because of performance reason. I suppose that
> >>> .NET
> >>> cached method calls with it's securiy permissions? Sure I protect
> >>> web
> >>> pages
> >>> with authorization mecanism, but the library will be used with other
> >>> person,
> >>> and all validation must be on business layer. One solution is to use
> >>> my
> >>> customer imperative security mecanism. But I want to know what is
> >>> wrong?
> >>> With best regards
> >>> Viorel
>
>
>



Relevant Pages

  • Re: PrincipalPermission trouble
    ... a stack walk) - PrincipalPermission does only call IsInRoleon Thread.CurrentPrincipal ... LinkDemand just doesn't make sense here - user security is not stack or link ...
    (microsoft.public.dotnet.security)
  • Re: PrincipalPermission trouble
    ... security issuer in authentication, it's microsoft defenition of LinkDemand ... >> I have a library that have methods protected with PrincipalPermission, ...
    (microsoft.public.dotnet.security)
  • RE: Security Attribute on Event?
    ... Regarding on the program on using Declarative role based security through ... ..net 's PrincipalPermission attribute in asp.net app, ... programmatically use PrincipalPermission class instance to demand the ... a helper function rather than control's event handler function? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Security Warnings From FXCop - CA2122 & CA2123
    ... > 2.0 except for two warnings from CodeAnalysis: ... Add a LinkDemand where required. ... > My knowledge of security is amatuer and I need to deploy this project ... > protected override void Dispose ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Reg Role BAsed security..
    ... My question is the same security I can achive by using session. ... So what are the advantages of using rolebased security..over using session.. ... > lets you use the PrincipalPermission class as well as the ... > PrincipalPermission or PrincipalPermissionAttribute classes). ...
    (microsoft.public.dotnet.framework.aspnet.security)