Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Symonfy 2.1 - Class-scope ACLs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Gergely Polonkai  
View profile  
 More options Aug 30 2012, 8:59 am
From: Gergely Polonkai <pol...@w00d5t0ck.info>
Date: Thu, 30 Aug 2012 14:59:06 +0200
Local: Thurs, Aug 30 2012 8:59 am
Subject: Symonfy 2.1 - Class-scope ACLs

Hello,

I have created an ACL with

    $fqcn = 'KekRozsak\\FrontBundle\\Entity\\News';
    $securityIdentity = new RoleSecurityIdentity('ROLE_ADMIN');
    $objectIdentity = new ObjectIdentity('class', $fqcn);
    $acl = $aclProvider->createAcl($objectIdentity);
    $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
    $aclProvider->updateAcl($acl);

I've checked my database, it is written there well. Now, according to
http://symfony.com/doc/master/cookbook/security/acl.html#checking-access,
I'm trying to check for access like

    if ($this->securityContext->isGranted('OWNER', $objectIdentity) ===
false) {
        throw new AccessDeniedException();
    }

And now, access is always denied, even if I log in with a user that has the
ROLE_ADMIN role. What am I doing wrong?

Thanks,
Gergely


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Franco Fallica  
View profile  
 More options Aug 30 2012, 9:48 am
From: Franco Fallica <franco.fall...@getunik.com>
Date: Thu, 30 Aug 2012 15:48:03 +0200
Local: Thurs, Aug 30 2012 9:48 am
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs
are you sure that

$objectIdentity = new ObjectIdentity('class', $fqcn);  is really
equals the $objectIdentity used in you isGranted call.
The only thing I can imagine is that they aren't.

--
--getunik ag-------------------------------------------
  franco fallica               franco.fall...@getunik.com
  hardturmstrasse 101      fon: +41 (0)44 388 55 88
  ch-8005 zuerich             fax: +41 (0)44 388 55 89

--new getunik product-------------------------
  Fundraising via SMS! Donations via SMS are fast, convenient and low priced!
  www.getunik.com/smsspenden (in german)

we make the web a better place - www.getunik.com

*****************************************************************
think before you print - for the sake of nature
*****************************************************************


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gergely Polonkai  
View profile  
 More options Aug 30 2012, 9:56 am
From: Gergely Polonkai <pol...@w00d5t0ck.info>
Date: Thu, 30 Aug 2012 15:56:34 +0200
Local: Thurs, Aug 30 2012 9:56 am
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs

    const OBJECT_FQCN = 'KekRozsak\\FrontBundle\\Entity\\News';
    $objectIdentity = new ObjectIdentity('class', self::OBJECT_FQCN);

Itt seems to be the same. The debug log says

DEBUG - ACL found, no ACE applicable. Voting to deny access.

I don't know if that helps...
--
"You need to believe in things that aren't true. How else can they become?"
- Terry Pratchett

2012/8/30 Franco Fallica <franco.fall...@getunik.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gergely Polonkai  
View profile  
 More options Aug 30 2012, 10:34 am
From: Gergely Polonkai <pol...@w00d5t0ck.info>
Date: Thu, 30 Aug 2012 16:34:10 +0200
Local: Thurs, Aug 30 2012 10:34 am
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs

I have found since then that an insertClassAce() method also exists. I've
emptied my ACL tables, created the ACL with insertClassAce instead of
insertObjectAce, but the result is the same: access denied is thrown when
it should not be. With this method, the debug message is still the same:
ACL found, no ACEs applicable...

2012/8/30 Gergely Polonkai <pol...@w00d5t0ck.info>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gergely Polonkai  
View profile  
 More options Sep 1 2012, 10:12 am
From: Gergely Polonkai <pol...@w00d5t0ck.info>
Date: Sat, 1 Sep 2012 16:12:01 +0200
Local: Sat, Sep 1 2012 10:12 am
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs

Since then, I have found an issue in Symfony's GitHub:

https://github.com/symfony/symfony/issues/5026

There is already a pull request on it:

https://github.com/symfony/symfony/pull/5076

As soon as I make this change in Symfony sources, everything works like
charm.
--
"You need to believe in things that aren't true. How else can they become?"
- Terry Pratchett

2012/8/30 Gergely Polonkai <pol...@w00d5t0ck.info>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gergely Polonkai  
View profile  
 More options Sep 1 2012, 11:57 am
From: Gergely Polonkai <pol...@w00d5t0ck.info>
Date: Sat, 1 Sep 2012 17:56:37 +0200
Local: Sat, Sep 1 2012 11:56 am
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs

Okay, if anyone is interested, here are my results.

Both my Users and Roles are loaded from the ORM. Also, my Role entity has a
childRoles property, which is a self-referencing manyToMany mapping. My
role hierarchy implementation worked so the getReachableRoles() method
returned an array of Role entities. As soon as I return an array of strings
(string representations of the Role entities, e.g $role->getRole()), it
starts to work.

This is a bit awful if you ask me, but Symfony developers say that my
previous workaround (when I modified the Symfony sources) can address a
security issue (although they never talked about any details), so I went
this way.

Best,
Gergely
--
"You need to believe in things that aren't true. How else can they become?"
- Terry Pratchett

2012/9/1 Gergely Polonkai <pol...@w00d5t0ck.info>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gergely Polonkai  
View profile  
 More options Sep 1 2012, 5:10 pm
From: Gergely Polonkai <pol...@w00d5t0ck.info>
Date: Sat, 1 Sep 2012 23:10:17 +0200
Local: Sat, Sep 1 2012 5:10 pm
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs

After going further with this new implementation of my RoleHierarchy class,
it turned out that
$this->get('security.context')->is_granted('ROLE_SOMETHING') stops working
with the array-of-strings way. So on to a next attempt (sorry for making a
developer blog-like stuff of this post...)

So in my pain my last hope was "extends". After I changed my Role entity to
extend Symfony's Role object (Symfony\Component\Security\Role\Role), it
seems to work, now with both access checking methods. But it seems waaay
too ugly for me.

2012/9/1 Gergely Polonkai <pol...@w00d5t0ck.info>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Bailey  
View profile  
 More options Sep 3 2012, 3:42 am
From: Simon Bailey <bina...@gmail.com>
Date: Mon, 3 Sep 2012 00:42:49 -0700 (PDT)
Local: Mon, Sep 3 2012 3:42 am
Subject: Re: [Symfony2] Symonfy 2.1 - Class-scope ACLs

hi gergely,

On Saturday, September 1, 2012 11:10:42 PM UTC+2, Gergely Polonkai wrote:

> After going further with this new implementation of my RoleHierarchy
> class, it turned out that
> $this->get('security.context')->is_granted('ROLE_SOMETHING') stops working
> with the array-of-strings way. So on to a next attempt (sorry for making a
> developer blog-like stuff of this post...)

> So in my pain my last hope was "extends". After I changed my Role entity
> to extend Symfony's Role object (Symfony\Component\Security\Role\Role), it
> seems to work, now with both access checking methods. But it seems waaay
> too ugly for me.

the solution i opted for was to leave the symfony source code as it is
(seeing as the pull request was rejected in a rather dismissive way) and to
implement the SecurityIdentityRetrievalStrategyInterface in a custom class
and hooked that into security.yml.

https://gist.github.com/3607658 -- for the implementation and the
security.yml configuration. lines 58-63 are basically the same as my pull
request and my code now uses this RetrievalStrategy rather than symfony's
built-in one. it's a bit b0rked to have to do something like this rather
than use the built-in system, but it works and there is no need to change
my entities. i'd still be interested in johschmitt's reasoning as to why
this is a security problem though... :)

regards,
sb


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »