-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(auth) - New privilege for Associate tags #8644
base: master
Are you sure you want to change the base?
Conversation
@@ -4,6 +4,7 @@ public enum DataHubGraphQLErrorCode { | |||
BAD_REQUEST(400), | |||
UNAUTHORIZED(403), | |||
NOT_FOUND(404), | |||
UNAUTHORIZED_TAG_ERROR(405), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTP 405 is well defined in general tech. Let's not override the standard HTTP codes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted back the error code to 403 with different error message
We have some use-cases where only a specific group users are authorized to associate certain tags. For all other tags, we want to allow all users to be able to associate the tags to ANY entity. Edit Tag privilege is a privilege which allows ANY tag to be associated to an entity. The entity can be specified or restricted by ownership. But, there is no way to restrict association by tags. Also, there is only ways to specify policy by including resources but no way to specify policies by excluding resources. |
@jjoyce0510 and @chriscollins3456 Meenakshi synced up the code with master again after validation. Could one of you please review and merge the PR. Thanks in advance. |
@anshbansal , @chriscollins3456 and @jjoyce0510 Thanks and Regards. |
LabelUtils.validateLabel( | ||
context.getOperationContext(), tagUrn, Constants.TAG_ENTITY_NAME, _entityService); | ||
|
||
if (!LabelUtils.isAuthorizedToAssociateTag(context, tagUrn)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auth calls should come first before sending validation operations to the entity service, ideally done as soon as possible before any business logic occurs to short circuit.
metadata-service/auth-impl/src/main/java/com/datahub/authorization/PolicyEngine.java
Outdated
Show resolved
Hide resolved
); | ||
} | ||
return ( | ||
<Typography.Paragraph> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is introducing a non-trivial amount of new risk into this system by adding a lot of new complexity.
Is there consideration about priority of exclusion inclusion rules and conflicting rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing the detailed overview of the rationale behind associate Tags. I think it's safe to add this change, with the one caveat that the OpenAPI endpoints are not currently honoring this privilege - either that would need to be solved in this PR or a followup, I'll allow @david-leifker to chime in.
As for the exclusionary rules, I think this is a bit more concerning with larger implications. To date, we've fought long and hard to keep the policy system as simple as possible, to minimize the chance of user error when assigning privileges, by maintaining ONLY an inclusionary access model.
Exclusionary is a lot more risk because it means folks can do things by default. It is also not clear how to restrict privileges once it's been granted via an exclusionary policy has been defined - it's quite easy to accidentally grant broad access to many people without deeply understanding that you've done this.
I'm wondering if you folks are willing to drop this requirement, or to better understand why inclusionary access is not possible for your situation. This change will have security implications ALL users of DataHub across the globe, so it's quite important we get this one right.
…tion/PolicyEngine.java Co-authored-by: RyanHolstien <[email protected]>
In our organization, we want to allow all users to be able to create and associate tags for their own use cases. But, there are certain tags which are restricted. That is the reason we want to add this Exclusionary logic so that we can restrict access for these special tags alone. Would it be okay if we add this with a feature flag to reduce impact ? |
I think we definitely need to add a test around the policy and new privilege added to the existing tests around the policy engine. Note that the policy engine will grant access if any of the policies match, which means the NOT_EQUAL condition would not be given precedence. It is not a deny condition, but the naming might be a bit confusing based on the Specifically, I am not sure this logic allows this use case
|
Comments from John Joyce: The defaults also have to be great |
New privilege to restrict association of tags. We have some use-cases where only a specific group users are authorized to associate certain tags. Also added a resource exclusion capability so that policy can be created for all resources excluding a certain set of resources using NOT_EQUALS policy condition.
To mimic behavior before this change, we need to create a policy which authorizes all users to the new privilege ASSOCIATE TAGS all tag resources.
Checklist
Summary by CodeRabbit
New Features
NOT_EQUALS
to improve filtering capabilities in policy conditions.Bug Fixes
Documentation