Repository navigation
[2.1] fix: add matchAnyDomain policy condition function - #38685
Merged
Merged
Conversation
* feat: register matchAnyDomain as a policy condition function * feat: translate matchAnyDomain policy condition to search query * test: cover matchAnyDomain policy condition evaluation * test: cover matchAnyDomain search query translation * style: apply google-java-format to matchAnyDomain tests * fix: fail closed when matchAnyDomain/matchAnyCertification have no arguments matchAnyDomain() with an empty argument list produced an empty bool query (should: []), which Elasticsearch and OpenSearch evaluate as match_all. An ALLOW rule carrying such a condition therefore granted access to every searchable resource, diverging from the direct RuleEvaluator which returns false for the same condition. Emit no clause and mark the rule match_nothing instead, so an empty condition degrades to deny-all. Applied to matchAnyCertification as well (same pattern, currently unreachable via the SpEL signature but identical bug class). Adds regression tests on Elastic and OpenSearch asserting the generated query is match_none and contains no domain clause and no empty bool clause. * fix: restore missing closing brace before matchAnyDomain in RBACConditionEvaluator matchAnyDomain was inserted before the closing brace of matchAnyServiceType, so it became a nested method declaration. That is an illegal start of expression and broke compilation of openmetadata-service (CI: illegal start of expression at RBACConditionEvaluator.java:412). Close matchAnyServiceType first so matchAnyDomain is a proper class member. * Match domain documents in matchAnyDomain and pin exact-FQN semantics - Search: a Domain document has no domains field, but REST treats a domain as belonging to itself. Match the named domain's own document by entityType + fullyQualifiedName, as hasDomain does, so an Allow rule does not hide the domain and a Deny rule does not leak it. - Fix the function examples: a top-level domain FQN is 'Finance', not 'Domain.Finance'. - Tests: matchAnyDomain matches the exact sub-domain FQN only, like matchAnyTag; 'Finance' does not match an asset in 'Finance.Payments'. * Rewrite matchAnyDomain conditions on domain rename and delete A Deny rule written with matchAnyDomain stopped applying after the domain (or its parent) was renamed, because nothing rewrote the condition. - PolicyConditionUpdater.DOMAIN_FUNCTIONS; DomainRepository rewrites the arguments by prefix on rename (sub-domains follow their parent) and removes them by prefix on hard delete, so a call with no argument left becomes false. - Guard test: every RuleEvaluator function taking arguments is in a rewrite set or listed with the reason it is not. - Search tests for matchAnyCertification() with no arguments failing closed. - ADR v3: domains are covered; matchAnyDomain matches the exact FQN. --------- Co-authored-by: Ram Narayan Balaji <ramnarayanb3005@gmail.com> (cherry picked from commit 888a553)
gh-bot-collate
Bot
requested review from
sonika-shah
and removed request for
a team
November 25, 2026 12:25
Author
|
🤖 This backport will not merge itself: |
yan-3005
approved these changes
Nov 25, 2026
yan-3005
left a comment
Contributor
There was a problem hiding this comment.
Verified on 2.1 (backport merged with current origin/2.1, MySQL + ES): ITs PolicyResourceIT, DomainResourceIT, QueryVisibilityPolicyIT, MultiDomainHasDomainIT, DomainReassignmentAuthorizationIT — 525 run, 0 failures (incl. the new domain rename/delete policy-condition tests); unit PolicyConditionUpdaterTest, RuleEvaluatorTest, ES/OS RBAC — 166/0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated backport of #33385 to
2.1.888a553b7c27e561b015a9a1dca769155c38906amain.Opened from openmetadata-collate, which holds the credentials needed to open a PR here. It merges itself once this branch's required checks pass — no review needed. If a check fails it stays open and the author of #33385 is asked to look.
resolver run