Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ACL): Prevents permissions overrride and merges acl cache to persist permissions across different namespaces (#8418) #8506

Merged

Conversation

all-seeing-code
Copy link
Contributor

@all-seeing-code all-seeing-code commented Dec 12, 2022

In the current implementation, when you update ACL rules across
different namespaces, the previous rules are overwritten. This results
in incorrect results for other namespaces (the ones which were created
earlier).

To reproduce:

  1. Create a namespace-1 with acl rules configured

  2. Create a namespace-2 with a different set of acl rules configured

  3. Login to namespace-1 and do a query. It will not respect the rules
    configured in step-1.

  4. TestTwoPermissionSetsInNameSpacesWithAcl

(cherry picked from commit de758ac)

…ist permissions across different namespaces (#8418)

In the current implementation, when you update ACL rules across
different namespaces, the previous rules are overwritten. This results
in incorrect results for other namespaces (the ones which were created
earlier).

To reproduce:
1. Create a `namespace-1` with acl rules configured
2. Create a `namespace-2` with a different set of acl rules configured
3. Login to `namespace-1` and do a query. It will not respect the rules
configured in step-1.

Rather than overwriting the rules, we do a merge of map that holds the
rules. This helps in persisting the rules configured for different
namespaces.
i.e
```
AclCachePtr.predPerms = predPerms
```
is modified to
```
map.copy(AclCachePtr.predPerms, predPerms)
```
`map` is only available in `go>=1.18`, therefore this PR also bumps the
go version in `go.mod`.

1. `TestTwoPermissionSetsInNameSpacesWithAcl`

(cherry picked from commit de758ac)
@github-actions github-actions bot added area/enterprise Related to proprietary features area/testing Testing related issues labels Dec 12, 2022
Op: "AND",
Child: []gql.FilterTree{
{filter, newFilter}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[nitpick ~ no need to fix] I notice the tabbing & related aesthetic changes coming in from your PRs - possibly from your IDE formatter. I personally think we should avoid introducing these changes, when the PR is targeting an older branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the original change went into main and it had the formatting changes like you mentioned. Since this PR is only a cherry-pick, I brought in all the changes from the other merge. Fixing (removing) these would require changes on top of cherry-pick PR.

Copy link
Contributor

@skrdgraph skrdgraph left a comment

Choose a reason for hiding this comment

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

[nitpick] we should try to keep the diff's tightened ONLY to the issue at hand. It would be nice to raise a separate PR for these aesthetic changes. I am guessing this happened because of your IDE, and you should probably minimize changes for easier review in these side-releases. (no action is needed)

Copy link
Contributor

@meghalims meghalims left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

We should also merge this change to main, I do have comments but I do not want to block this change. Will review it again when we merge to main.

@all-seeing-code
Copy link
Contributor Author

We should also merge this change to main, I do have comments but I do not want to block this change. Will review it again when we merge to main.

This is merged in main. This is only a cherry-pick to slash branch for one customer who is facing issues. If you have any urgent comments, can you file it on the original PR or as a separate issue. I'll fix them in main.

@all-seeing-code all-seeing-code merged commit 425f4b1 into release/v21.03-slash Dec 21, 2022
@all-seeing-code all-seeing-code deleted the anurag/cherry-pick-acl-fixes-into-slash branch December 21, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/enterprise Related to proprietary features area/testing Testing related issues
Development

Successfully merging this pull request may close these issues.

4 participants