Repository navigation
Fixes 31740: Enforce caller policies on the Incident Manager listing - #31741
Conversation
The Incident Manager listing returned incidents from every domain to a domain-restricted user. Clicking one was correctly blocked, but the row itself already exposed the test case name, the table name and the full FQN. RuleEvaluator#hasDomain short-circuits to true for list operations, because a listing has no single resource to evaluate a condition against, and defers to "post-filtering" on the search query. The two search-backed listing paths in EntityTimeSeriesRepository never received a SubjectContext, so that post-filtering never happened and no hasDomain()/noDomain() policy could take effect. Upgrading does not help: 7c9d85a added a user-supplied `domain` filter parameter, not policy enforcement. Thread the caller's SubjectContext through both paths so the existing RBAC search machinery filters the query: - listFromSearchWithOffset now has a SubjectContext-aware overload that calls SearchRepository#listWithOffset(..., subjectContext), which already applies RBAC in both engines. - listLatestFromSearch does the same through SearchRepository#aggregate, so `latest=true` cannot bypass the filtering applied to the plain listing. This adds a SubjectContext-aware aggregate() down through AggregationManagementClient and both search clients/aggregation managers, mirroring the existing genericAggregation() overload. - TestCaseResolutionStatusResource passes the caller on both branches. Existing callers keep the subject-less overloads and are unaffected. Filtering still honours the global searchSettings.enableAccessControl gate, as elsewhere. Co-Authored-By: Claude Opus 5 <[email protected]>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ Playwright Results — workflow succeededValidated commit ✅ 1457 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 56m 6s ⏱️ Max setup 4m 43s · max shard execution 18m 41s · max shard-job elapsed before upload 22m 51s · reporting 7s 🌐 201.02 requests/attempt · 2.12 app boots/UI scenario · 29.44% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Adds DomainIncidentIsolation.spec.ts alongside the existing DomainIsolation specs, covering the listing through the UI. The user under test deliberately holds DomainOnlyAccessRole with an EMPTY domain list. A user WITH a domain is not a valid regression guard: useIncidentList passes activeDomain as the `domain` query param, and that caller-supplied filter alone hides foreign incidents even on a server carrying the bug — the spec would pass against unfixed code and protect nothing. With no domain the page sends no `domain` param, so the server-side policy is the only thing that can filter the list. Assertions are made against both the payload the page requested and the rendered rows. The list is paginated, so a leaked row can sit on page 2 while page 1 looks clean; asserting only on the DOM would let a real leak pass. Indexing is handled by seedFailedIncidents, which polls until every seeded incident is searchable, so the assertions never race Elasticsearch. Verified against a locally built server: - fixed build: 2/2 pass; 10/10 with --repeat-each=5 - reverted build: the isolation test fails on the leaked FQN while the admin control still passes, confirming the spec detects the regression - full DomainIsolation lane: 16/16 pass Co-Authored-By: Claude Opus 5 <[email protected]>
Review fixes:
- SearchRepository#aggregate(4-arg) calls the subject-less client method again
instead of delegating to the new 5-arg overload. Delegating rerouted every
existing caller onto a different client method and broke
SearchRepositoryBehaviorTest#reportingWrappersDelegateToSearchClient, which
stubs the 4-arg overload. Keeping the subject-less path byte-identical also
keeps the blast radius of this change to the endpoint being fixed.
- DomainIsolationIT now asserts both latest=false and latest=true. The endpoint
defaults to false, so the aggregation branch — the one `latest=true` uses, and
a trivial bypass if unguarded — had no regression coverage.
Playwright spec:
- Declare the tag via the { tag: [...] } option rather than embedding it in the
describe title. 57 specs use the option against 8 with an in-title tag;
--grep @domain-isolation still selects both tests.
- Drop describe-level test.slow(). The tests run in ~2.7s against a 60s budget,
so it bought nothing. What actually needs a budget is the hook, and
test.slow() does not extend one — so beforeAll sets an explicit timeout for
entity creation plus waiting on indexing, matching IncidentManagerPagination.
- Match waitForResponse on URL only and assert the status separately. Narrowing
the predicate by status never resolves on an error response, turning a failing
API into an opaque timeout instead of a status assertion.
- Parallelise independent setup and teardown with Promise.all, in phases that
respect the real dependencies: the table must carry its domain before the
incident is indexed, and the tables are deleted before the domain.
Verified on a locally built server: both listing paths filter for a domainless
user; the spec passes 6/6 and still fails against a reverted build;
SearchRepositoryBehaviorTest 127/127 and the search package 2187/2187.
Co-Authored-By: Claude Opus 5 <[email protected]>
genericAggregation() in the Elasticsearch and OpenSearch aggregation managers inlined the same evaluate-then-bool(must/filter) RBAC block that applyRbacQuery() already encapsulates. Route genericAggregation() through applyRbacQuery() so each manager keeps one copy used by both the aggregate() and genericAggregation() paths. Also fail closed in applyRbacQuery(): when access control requires filtering for the caller but evaluateConditions() yields no query, return a match-none query instead of the unfiltered query. evaluateConditions() returns matchAll today so this branch is currently unreachable, but for a security filter the safe default on an unexpected null must be to hide rather than leak. Behaviour-preserving: the subject-less path (null subject / admin / bot / access control disabled) still returns the query unchanged, and the search listing path (listWithOffset) is untouched.
|
Code Review ✅ ApprovedThreads the authenticated caller's subject context through the Incident Manager listing paths, ensuring domain RBAC policies are enforced on search-backed and aggregated time-series queries. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |



Describe your changes:
Fixes #31740
A user restricted to their own domain saw failed test case incidents from every domain on the Incident Manager page. Opening one was correctly blocked, but the listed row already leaked the test case name, the table name and the full FQN.
RuleEvaluator#hasDomainshort-circuits totruefor list operations, because a listing has no single resource to evaluate the condition against, and defers enforcement to "post-filtering" on the search query:For this endpoint that post-filtering never happened — the two search-backed listing paths in
EntityTimeSeriesRepositorycalledSearchRepositorywithout aSubjectContext, so the existingRBACConditionEvaluatormachinery never ran. The result is that no policy an administrator can write restricts this listing. Upgrading does not help: #21808 / 7c9d85a added a user-supplieddomainfilter parameter, which is a filter the caller opts into rather than policy enforcement.This threads the caller's
SubjectContextthrough both paths so the existing RBAC search machinery filters the query. Follow-up to #24180, which fixed the same class of leak for domain listings and lineage.Type of change:
High-level design:
Reuses the existing search-side RBAC mechanism rather than adding a second enforcement path.
RBACConditionEvaluatoralready compiles policy conditions — includinghasDomain()— into an engine query, andSearchRepository#listWithOffsetalready had aSubjectContext-aware overload wired through toapplyRbacConditionin both the Elasticsearch and OpenSearch managers. The only missing link was that the time-series listing never passed a subject.EntityTimeSeriesRepository#listFromSearchWithOffset— newSubjectContext-aware overload calling the existing subject-awareSearchRepository#listWithOffset.EntityTimeSeriesRepository#listLatestFromSearch— same, throughSearchRepository#aggregate, solatest=truecannot bypass the filtering applied to the plain listing. This required aSubjectContext-awareaggregate()throughAggregationManagementClientand both clients/aggregation managers, mirroring thegenericAggregation()overload that already existed there.TestCaseResolutionStatusResource— passes the caller on both branches.Backward compatibility: every existing signature is kept and delegates with a
nullsubject, so all other callers are unchanged. Filtering honours the existingsearchSettings.globalSettings.enableAccessControlgate, consistent with the rest of the product; that gate defaults tofalse.Alternatives rejected:
hasDomain()to not short-circuit on list operations. There is no resource to evaluate against at that point, so it cannot work, and it would alter policy evaluation for every list endpoint in the product.paging.totaland page sizes.Deliberately out of scope: the same gap exists on other time-series listings that call these methods (
TestCaseResultResource,TestSuiteResource, and the genericEntityTimeSeriesResource). The mechanism is now available to them, but enabling it per endpoint needs its own validation — the RBAC domain clause filters ondomains.id, so each index mapping has to be confirmed to carry that field first. I verified it fortest_case_resolution_status_index_mapping.jsononly.Tests:
Use cases covered
latest=true, which goes through the aggregation path.enableAccessControl = falseare unaffected.Unit tests
Not applicable — the change is wiring an existing mechanism through a call chain, so a unit test here could only assert that one method calls another with a given argument. Covered by the integration test below instead, which asserts the observable API behaviour.
Backend integration tests
DomainIsolationIT#test_incidentListing_restrictedUserSeesOnlyOwnDomainIncidentsinopenmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DomainIsolationIT.java, alongside the existing domain/lineage isolation tests added for Feature Request: Improve domain isolation in UI and lineage for multi-tenant setups #24180.Ingestion integration tests
Playwright (UI) tests
playwright/e2e/Features/DomainIsolation/DomainIncidentIsolation.spec.ts, alongside the existingDomainIsolationspecs (it is picked up by the dedicatedDomainIsolationproject).The user under test holds
DomainOnlyAccessRolewith an empty domain list, and that detail is load-bearing. A user with a domain is not a valid regression guard here:useIncidentListpassesactiveDomainas thedomainquery param, and that caller-supplied filter alone hides foreign incidents even against unfixed code — such a spec would pass on a broken server and protect nothing. With no domain the page sends nodomainparam, leaving the server-side policy as the only filter.Assertions run against both the payload the page requested and the rendered rows: the list is paginated, so a leaked row can sit on page 2 while page 1 looks clean, and a DOM-only assertion would let a real leak through. Indexing is handled by the existing
seedFailedIncidents, which polls until every seeded incident is searchable.Manual testing performed
Reproduced and root-caused against a running 2.0.0-SNAPSHOT server before fixing:
AandB, put a table and its test case inB, and created an incident for it.Awith a policy denyingViewAllwhen!hasDomain().searchSettings.globalSettings.enableAccessControl.GET /api/v1/dataQuality/testCases/testCaseIncidentStatus/{id}on the domainBincident →403 User does not have ANY of the required permissions.GET /api/v1/dataQuality/testCases/testCaseIncidentStatus/search/list→ the same incident was still listed, with its test case name and full FQN.hasDomain() - No matching domains found, returning false, while the listing loggedhasDomain() - List operation detected (no specific resource), returning true for post-filtering.Separately confirmed that the
domainquery parameter onGET /v1/dataQuality/testCases/testCaseIncidentStatusis silently ignored — 140 rows returned with no parameter, with a real domain, and with a nonexistent one. That is a distinct bug on the DB-backed listing path (the resource writes theListFilterkey"domain", which nothing reads; the sibling endpoints correctly writeincidentDomainIdand"domains"). Left out of this PR to keep the security fix reviewable — happy to send it as a follow-up.Verified against a locally built server (fresh MySQL + Elasticsearch, migrations, the server run from the compiled classes with the production UI bundle served from its classpath, everything on
:8585):latest=true(the aggregation path) filters correctly too. The Incident Manager page was checked in a real browser: the restricted user sees only their own domain's incident.Playwright results on that server: 2/2 pass, 10/10 with
--repeat-each=5, and the fullDomainIsolationlane is 16/16. Against the reverted build the isolation test fails on the leaked FQN while the admin control still passes, confirming the spec actually detects the regression rather than passing vacuously.What I have not run: the
DomainIsolationITintegration test. Its harness builds a server image and boots its own containers, which did not fit in the Docker memory available; I validated the same behaviour by hand and through Playwright instead. CI is the first execution of that IT.Worth knowing for anyone reproducing this: the UI masks the bug for a single-domain user. Their domain selector is locked ("You only have access to your assigned domain(s)"), so the page always sends
domain=<their own domain>and looks correct even on a broken server. The exposure is reachable through any direct API call, and through the UI whenever the selector is not pinned to the user's own domain.UI screen recording / screenshots:
No UI code changed — the Incident Manager page already calls
/search/list; only the server-side filtering changed. Including the screenshots anyway because they show the user-visible effect of the fix.Both were captured on the same locally built server with everything held constant except the build: the same user (no domain assigned, holding
DataConsumer+DomainOnlyAccessRole), the same All Domains filter, the same data, andenableAccessControl = truethroughout.Before fix — the listing returns all three incidents.
tc_tblA(domain A) andtc_tblB(domain B) both belong to domains this user is not in, and are leaked. Onlytc_tblNoneis legitimately theirs.After fix — the same page for the same user returns only
tc_tblNone, the domainless incident they are entitled to. The two foreign-domain incidents are gone.Note that a user with a domain does not reproduce this in the UI: their domain selector is locked to their own domain, so the page sends
domain=<their own domain>and looks correct even on a server carrying the bug. That caller-supplied filter is what masks it, which is why the screenshots above use a user with no domain and the selector on All Domains.Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Bug fix:
🤖 Generated with Claude Code
Greptile Summary
This PR threads the caller’s
SubjectContextthrough ordinary and aggregated incident searches so domain policies constrain Incident Manager results.latest=falseandlatest=true, plus end-to-end Incident Manager isolation coverage.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Caller participant Resource as TestCaseResolutionStatusResource participant Repo as EntityTimeSeriesRepository participant Search as SearchRepository participant Backend as Elasticsearch/OpenSearch Caller->>Resource: "GET /search/list?latest=false|true" Resource->>Resource: Authorize request and resolve SubjectContext alt "latest=false" Resource->>Repo: listFromSearchWithOffset(..., subjectContext) else "latest=true" Resource->>Repo: listLatestFromSearch(..., subjectContext) end Repo->>Search: List or aggregate with SubjectContext Search->>Backend: Search query with caller RBAC conditions Backend-->>Caller: Authorized incident rows onlyReviews (7): Last reviewed commit: "refactor(dq): consolidate aggregation RB..." | Re-trigger Greptile
Context used (3)