Bug #47473

Role->setParentRoles() fails if array of roles contains duplicates

Added by Robert Lemke over 2 years ago. Updated over 2 years ago.

Status:Resolved Start date:2013-04-23
Priority:Must have Due date:
Assigned To:Robert Lemke % Done:

100%

Category:Security
Target version:TYPO3 Flow Base Distribution - 2.0
PHP Version:5.4 Complexity:medium
Has patch:No Affected Flow version:Flow 2.0.0 beta 2

Description

If the array of roles contains duplicates, Doctrine may fail while trying to insert the same role multiple times:

Uncaught Exception in Flow
An exception occurred while executing 'INSERT INTO typo3_flow_security_policy_role_parentroles_join (flow_policy_role, parent_role) VALUES (?, ?)' with params {"1":"Acme.Demo:Administrator","2":"Acme.Demo:Base"}: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Acme.Demo:Administrator-Acme.Demo:Base' for key 'PRIMARY'

Doctrine\DBAL\DBALException thrown in file
Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php in line 47.

Associated revisions

Revision 30124b20
Added by Robert Lemke over 2 years ago

[BUGFIX] setParentRoles() fails if passed roles contain duplicates

Fixes an issue where Doctrine failed inserting parent roles if the array
passed to Role->setParentRoles() contained duplicates.

Even though getParentRoles() does return roles without duplicates,
setParentRoles() did not filter duplicates and caused the SQL error
mentioned in the related issue ticket.

Change-Id: I6f0ed41e74d0f2100990368f930b558fe0f3ed2f
Resolves: #47473
Releases: master, 2.0

Revision ec284d85
Added by Robert Lemke over 2 years ago

[BUGFIX] setParentRoles() fails if passed roles contain duplicates

Fixes an issue where Doctrine failed inserting parent roles if the array
passed to Role->setParentRoles() contained duplicates.

Even though getParentRoles() does return roles without duplicates,
setParentRoles() did not filter duplicates and caused the SQL error
mentioned in the related issue ticket.

Change-Id: I6f0ed41e74d0f2100990368f930b558fe0f3ed2f
Resolves: #47473
Releases: master, 2.0

History

#1 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20101

#2 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/20102

#3 Updated by Anonymous over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF