Page MenuHomePhabricator

Caching inside the policy filter may cause policy filtering to occur on a partial representation of a project
Closed, ResolvedPublic

Description

Reproduction steps:

  1. Open "Create Subproject" from a parent project Subprojects page.
  2. Limit subproject visibility to members of the parent project.
  3. Create the subproject.

Expected result:

  • Members of the parent project can view, and join the subproject

Actual result:

  • No one can join, view, or edit the subproject. Error message "You do not have permission to view this object".
  • policy unlock claims to succeed, but the same error remains. Note that the error message still indicates that only members of the parent project can view.

Event Timeline

I can't reproduce this. Can you create a test instance in Phacility and reproduce this there?

I was able to reproduce in this test instance. There is a parent project called Parent, and two subprojects: Sub1 and Sub2. Sub2 produces the error.

The key appears to be in the policy settings of the Parent project. The problem does not occur if visibility of Parent is set to All Users. But it does occur when the visibility of Parent is restricted to members of Parent.

Here's the raw data from that install:

mysql> select * from project\G
*************************** 1. row ***************************
                id: 1
              name: Parent
              phid: PHID-PROJ-gpnlq4nvtvrtsrcvkt4b
        authorPHID: PHID-USER-w7oapp7xetx7xshvruyb
       dateCreated: 1478890241
      dateModified: 1478891093
            status: 0
        viewPolicy: PHID-PROJ-gpnlq4nvtvrtsrcvkt4b
        editPolicy: users
        joinPolicy: users
isMembershipLocked: 0
  profileImagePHID: PHID-FILE-jwwqkilrad7t52brmrm7
              icon: umbrella
             color: blue
           mailKey: kmkffcnuqpqihr7ptanl
       primarySlug: parent
 parentProjectPHID: NULL
      hasWorkboard: 0
     hasMilestones: 0
    hasSubprojects: 1
   milestoneNumber: NULL
       projectPath: Ruyh
      projectDepth: 0
    projectPathKey: Ruyh
        properties: []
*************************** 2. row ***************************
                id: 2
              name: Sub1
              phid: PHID-PROJ-b57byavdns3rb2zmw72l
        authorPHID: PHID-USER-w7oapp7xetx7xshvruyb
       dateCreated: 1478890274
      dateModified: 1478890820
            status: 0
        viewPolicy: users
        editPolicy: users
        joinPolicy: users
isMembershipLocked: 0
  profileImagePHID: PHID-FILE-ginwpqgxpewiiwjpchgo
              icon: project
             color: blue
           mailKey: 7zxqadvhxdzpcz7aykn2
       primarySlug: sub1
 parentProjectPHID: PHID-PROJ-gpnlq4nvtvrtsrcvkt4b
      hasWorkboard: 0
     hasMilestones: 0
    hasSubprojects: 0
   milestoneNumber: NULL
       projectPath: Ruyh5525
      projectDepth: 1
    projectPathKey: 5525
        properties: []
*************************** 3. row ***************************
                id: 3
              name: Sub2
              phid: PHID-PROJ-nvzcde5sidg3ighpxgbk
        authorPHID: PHID-USER-w7oapp7xetx7xshvruyb
       dateCreated: 1478890382
      dateModified: 1478890861
            status: 0
        viewPolicy: PHID-PROJ-gpnlq4nvtvrtsrcvkt4b
        editPolicy: admin
        joinPolicy: PHID-PROJ-gpnlq4nvtvrtsrcvkt4b
isMembershipLocked: 0
  profileImagePHID: PHID-FILE-garszdg7hcgucv635aaa
              icon: project
             color: blue
           mailKey: f6jrgqosorzxx5g77tdg
       primarySlug: sub2
 parentProjectPHID: PHID-PROJ-gpnlq4nvtvrtsrcvkt4b
      hasWorkboard: 0
     hasMilestones: 0
    hasSubprojects: 0
   milestoneNumber: NULL
       projectPath: RuyhaygI
      projectDepth: 1
    projectPathKey: aygI
        properties: []
3 rows in set (0.00 sec)

Note that both "Sub2" and "Parent" have been set the global project policy "Members of: 'Parent'", not the object policy "Project Members".

epriestley renamed this task from Cannot view or unlock a subproject to Caching inside the policy filter may cause policy filtering to occur on a partial representation of a project.Nov 11 2016, 9:15 PM
epriestley added a project: Policy.
epriestley triaged this task as Normal priority.