Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mfshao
Copy link
Contributor

@mfshao mfshao commented Jul 14, 2020

Fulfills https://ctds-planx.atlassian.net/browse/PXP-6412

Deployed in: https://mingfei.planx-pla.net/ (should not see obvious changes)

Improvements

  • Switch Guppy from using Arborist's /auth/resources endpoint to /auth/mapping and filter out accessible list base on read access

Breaking Changes

  • User can only see/query the data for a project if they have the following access: method read (or * - all methods) to service guppy (or * - all services) on that project resource. (previously they can see/query all the data if you any types of access to them)

@mfshao mfshao requested a review from paulineribeyre July 14, 2020 15:49
resources: [],
};
Object.keys(result).forEach((key) => {
if (result[key] && result[key].some((x) => x.method === 'read')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you also need to handle method: '*'
could you include that in the test as well?

Copy link
Contributor Author

@mfshao mfshao Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to this comment, for method: '*' should we also check for service?

this section

{
  "service": "indexd",
  "method": "*"
}

will makes the project be accessible but it should not, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, good question... right now we use "read on all services" when we grant read access, but we shouldn't assume that's the case
i guess we should check for sheepdog, peregrine or *
but then we have the same problem in windmill https://github.com/uc-cdis/data-portal/blob/2020.07/src/authMappingUtils.js#L63

Copy link
Contributor Author

@mfshao mfshao Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so for portal now we are not checking read for each projects specifically. So in the submission page you will see a project name with Browse Data button show up even if you don't have read access to that project. But if you click that button you will see nothing (before the 404 redir) or be redirected to 404 page.

But we can make some improvements to windmill so it won't display the project in submission table if you don't have access

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm i thought that was already the case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm i thought that was already the case

yeah you are right

Copy link
Contributor

@paulineribeyre paulineribeyre Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i think either sheepdog or peregrine should be fine...
but then why not have "guppy" or "mds" or anything else that lets you read data 🤦

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually i'm starting to think we should just check "service=guppy or *"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually i'm starting to think we should just check "service=guppy or *"

this actually sounds reasonable to me, even if you have access to peregrine or sheepdog doesn't mean you will be granted with access to guppy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, and it won't break anything we currently do, since we just grant read access to all services

@paulineribeyre
Copy link
Contributor

maybe this change should be considered a breaking change?

@mfshao
Copy link
Contributor Author

mfshao commented Jul 14, 2020

maybe this change should be considered a breaking change?

hmmm... idk

The /auth/mapping has exists since a pretty old arborist I think?

@paulineribeyre
Copy link
Contributor

right, but you're going from being able to see all the data you have any access to, to only being able to see the data you have "read" access to

paulineribeyre
paulineribeyre previously approved these changes Jul 14, 2020
Comment on lines 29 to 35
// logic: you have access to a project if you either
// 1. have 'read' access to a project resource
// or
// 2. have '*' access to service 'guppy' or service '*'
if (result[key] && result[key].some((x) => x.method === 'read'
|| (x.method === '*' && (x.service === 'guppy' || x.service === '*')))
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic should be: you have access to a project if you have the following access: method 'read' (or '*' - all methods) to service 'guppy' (or '*' - all services) on the project resource.
so i think something like this?

        if (result[key] && result[key].some((x) =>
          (x.method === 'read' || x.method === '*')
          && (x.service === 'guppy' || x.service === '*')
        )) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true! i'll update, thanks for the suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants