You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "zhang-arvin (via GitHub)" <gi...@apache.org> on 2026/08/31 08:43:30 UTC
[PR] [#12685] fix(core): Fix PolicyManager asymmetric set difference check for built-in policies [gravitino]
zhang-arvin opened a new pull request, #12743:
URL: https://github.com/apache/gravitino/pull/12743
### What changes were proposed in this pull request?
Fix the asymmetric set difference check in PolicyManager.updatePolicyEntity() that only blocks removing supportedObjectTypes from built-in policies, but silently allows adding new ones.
### Why are the changes needed?
The original check uses Sets.difference(old, new).isEmpty() which only verifies that old types are not removed - it does not detect when new types are added. This allows silently changing the supported object types of built-in policies.
Additionally, the error message format string was missing its format arguments.
### How was this patch tested?
Manual verification that symmetric Sets.difference checks in both directions now correctly prevent any modification to supported object types of built-in policies.
Fixes: #12685
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12685] fix(core): Fix PolicyManager asymmetric set difference check for built-in policies [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades commented on PR #12743:
URL: https://github.com/apache/gravitino/pull/12743#issuecomment-5503262494
is this duplicated with #12686 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12685] fix(core): Fix PolicyManager asymmetric set difference check for built-in policies [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades closed pull request #12743: [#12685] fix(core): Fix PolicyManager asymmetric set difference check for built-in policies
URL: https://github.com/apache/gravitino/pull/12743
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12685] fix(core): Fix PolicyManager asymmetric set difference check for built-in policies [gravitino]
Posted by "LiJie20190102 (via GitHub)" <gi...@apache.org>.
LiJie20190102 commented on code in PR #12743:
URL: https://github.com/apache/gravitino/pull/12743#discussion_r3909821578
##########
core/src/main/java/org/apache/gravitino/policy/PolicyManager.java:
##########
@@ -500,12 +500,14 @@ private PolicyEntity updatePolicyEntity(PolicyEntity policyEntity, PolicyChange.
if (policyType != Policy.BuiltInType.CUSTOM) {
// cannot change the supported object types for built-in policies
+ Set<String> oldTypes = policyEntity.content().supportedObjectTypes();
+ Set<String> newTypes = updateContent.getContent().supportedObjectTypes();
Preconditions.checkArgument(
- Sets.difference(
- policyEntity.content().supportedObjectTypes(),
- updateContent.getContent().supportedObjectTypes())
- .isEmpty(),
- "Policy content type mismatch: expected %s but got %s");
+ Sets.difference(oldTypes, newTypes).isEmpty()
Review Comment:
Issue #12685 explicitly states:
_No_ existing test covers the **UpdateContent** path for built-in policies — the test gap is what let this through.
This PR fixes the bug but adds no tests. **TestPolicyManager** only covers rename, comment, enable/disable, and custom-content paths today. Please add regression tests for the **UpdateContent** path on built-in policies:
- Adding a new **supportedObjectType** to a built-in policy → reject
- Removing an existing **supportedObjectType** from a built-in policy → reject
- **supportedObjectTypes** unchanged → pass
Without these, the same regression can silently re-enter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12685] fix(core): Fix PolicyManager asymmetric set difference check for built-in policies [gravitino]
Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #12743:
URL: https://github.com/apache/gravitino/pull/12743#issuecomment-5490242483
@mchades please help to review this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org