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

feat(auth) - New privilege for Associate entities for entities tags and glossary terms #8644

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

mkamalas
Copy link
Contributor

@mkamalas mkamalas commented Aug 16, 2023

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

  • [ x] The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • [ x] Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

Summary by CodeRabbit

  • New Features

    • Introduced enhanced authorization checks for tag association and removal, ensuring only authorized users can perform these actions.
    • Added a new enumeration value NOT_EQUALS to improve filtering capabilities in policy conditions.
    • Introduced a new privilege "Associate Tags" for more granular permission management related to tag associations.
  • Bug Fixes

    • Improved error handling for permission-related issues during bulk edits of tags, providing clearer feedback to users.
  • Documentation

    • Updated documentation to reflect new privileges and conditions related to tag management and policy definitions.

@github-actions github-actions bot added docs Issues and Improvements to docs product PR or Issue related to the DataHub UI/UX devops PR or Issue related to DataHub backend & deployment labels Aug 16, 2023
@@ -4,6 +4,7 @@ public enum DataHubGraphQLErrorCode {
BAD_REQUEST(400),
UNAUTHORIZED(403),
NOT_FOUND(404),
UNAUTHORIZED_TAG_ERROR(405),
Copy link
Collaborator

@anshbansal anshbansal Aug 16, 2023

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

Copy link
Contributor Author

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

@maggiehays maggiehays added the community-contribution PR or Issue raised by member(s) of DataHub Community label Aug 17, 2023
@david-leifker
Copy link
Collaborator

david-leifker commented Sep 20, 2024

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 NOT_EQUAL name.

Specifically, I am not sure this logic allows this use case

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 ?

@david-leifker david-leifker self-requested a review September 20, 2024 22:30
@datahub-cyborg datahub-cyborg bot added the pending-submitter-response Issue/request has been reviewed but requires a response from the submitter label Dec 24, 2024
@rtekal
Copy link
Contributor

rtekal commented Jan 28, 2025

Comments from John Joyce:
If we do this, we'd want to be consistent and do it for terms, structured properties, domains as well. I think it does make sense.

The defaults also have to be great

@datahub-cyborg datahub-cyborg bot added needs-review Label for PRs that need review from a maintainer. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Jan 28, 2025
@jjoyce0510
Copy link
Collaborator

Hi guys - Circling back on this one.

I don't think you have responded directly about the request to drop the exclusionary policy requirement.

We've to date kept our policy system extremely simple intentionally. We don't want to break this without deeper consideration.

Given the name of the PR, can we please isolate only the changes related to adding a a new privilege for associating tags? That would reduce the surface area dramatically.

Then we can focus on adding tests to this and we can merge this.

I think we need clear alignment around the exclusionary rules piece. I would want to have a meeting with our team and yours to establish alignment before we proceed any more with this. Please coordinate with Raj Tekal to get that meeting on the books!

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels Feb 5, 2025
@mkamalas
Copy link
Contributor Author

mkamalas commented Feb 6, 2025

Hi guys - Circling back on this one.

I don't think you have responded directly about the request to drop the exclusionary policy requirement.

We've to date kept our policy system extremely simple intentionally. We don't want to break this without deeper consideration.

Given the name of the PR, can we please isolate only the changes related to adding a a new privilege for associating tags? That would reduce the surface area dramatically.

Then we can focus on adding tests to this and we can merge this.

I think we need clear alignment around the exclusionary rules piece. I would want to have a meeting with our team and yours to establish alignment before we proceed any more with this. Please coordinate with Raj Tekal to get that meeting on the books!

Hi Joyce,

I attempted to explain the need for the exclusionary rule in this message #8644 (comment). The rationale behind this is the restriction for tag association would typically not be needed for most tags. It is something that would be needed only for certain specially-governed tags. With inclusive policies alone, the policy/policies for Associate tag privilege has to be updated every time a new tag is introduced in the system.

If the use case is to restrict association of 2 tags TagA, TagB and allow only a set of users to associate these 2 tags and allow all users to associate all other tags.
Below will be the 2 policies that we setup:
Policy1 -> Grant Associate Tag privilege on all tags except TagA and TagB to all users
Policy2 -> Grant Associate Tag privilege on TagA and TagB to the specific set of authorized users.

The current datahub setup allows all users to associate all tags. Without exclusionary policy, I am thinking it would be hard to establish a policy for Associate tag privilege.

We can discuss further on options to configure such a setup or any use case for Associate tags. I will work with Raj to plan for a meeting for this discussion.

Thanks

@datahub-cyborg datahub-cyborg bot added needs-review Label for PRs that need review from a maintainer. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Feb 6, 2025
@jjoyce0510
Copy link
Collaborator

Hi there. This makes sense. Our team will be considering this reasoning shortly. Getting this through will be a priority for us!

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels Feb 11, 2025
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

Attention: Patch coverage is 6.09756% with 154 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...src/app/permissions/policy/PolicyPrivilegeForm.tsx 3.07% 126 Missing ⚠️
.../src/app/permissions/policy/PolicyDetailsModal.tsx 0.00% 7 Missing ⚠️
datahub-web-react/src/app/entity/shared/utils.ts 0.00% 6 Missing ⚠️
...eb-react/src/app/permissions/policy/policyUtils.ts 40.00% 6 Missing ⚠️
...n/java/com/datahub/authorization/PolicyEngine.java 0.00% 4 Missing and 1 partial ⚠️
...eb-react/src/app/shared/tags/AddTagsTermsModal.tsx 0.00% 4 Missing ⚠️

❌ Your patch check has failed because the patch coverage (6.09%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datahub-cyborg datahub-cyborg bot added needs-review Label for PRs that need review from a maintainer. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Feb 16, 2025
@rtekal
Copy link
Contributor

rtekal commented Feb 26, 2025

@jjoyce0510
Few days ago, we had a conversation and you are aligned with this PR. You said your team might take over and create a new PR.
Could you please first take this PR first and then more improvements can be made? It is better if you accept this PR rather than creating a new one; which will cause more work for us to reconcile.

Please suggest what more is needed in accepting this PR. Thank you.

@mkamalas mkamalas changed the title feat(auth) - New privilege for Associate tags feat(auth) - New privilege for Associate entities for entities tags and glossary terms Mar 5, 2025
@mkamalas
Copy link
Contributor Author

mkamalas commented Mar 5, 2025

@jjoyce0510 - Updated the privilege to call it Associate Entity and applied the logic for glossary terms as well. The other ask was to add more test cases around new policy and we are working on it.

@asikowitz asikowitz added the platform PR-s that make changes to core parts of the platform label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution PR or Issue raised by member(s) of DataHub Community devops PR or Issue related to DataHub backend & deployment docs Issues and Improvements to docs needs-review Label for PRs that need review from a maintainer. platform PR-s that make changes to core parts of the platform product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants