ATLAS-5379 : Authorize lineage neighbor entities before returning headers - #731
Open
VinayakMarraiya230920 wants to merge 1 commit into
Open
ATLAS-5379 : Authorize lineage neighbor entities before returning headers#731VinayakMarraiya230920 wants to merge 1 commit into
VinayakMarraiya230920 wants to merge 1 commit into
Conversation
VinayakMarraiya230920
marked this pull request as ready for review
August 20, 2026 12:08
Apply per-entity ENTITY_READ checks when building lineage guidEntityMap. Skip unauthorized neighbors and omit relations when either endpoint is not readable.
VinayakMarraiya230920
force-pushed
the
ATLAS-5379
branch
from
August 21, 2026 07:10
3d57412 to
bffa884
Compare
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.
Apply per-entity ENTITY_READ checks when building lineage guidEntityMap. Skip unauthorized neighbors and omit relations when either endpoint is not readable.
What changes were proposed in this pull request?
Problem
The lineage API (
GET /api/atlas/v2/lineage/{guid}) checksENTITY_READon the seed entity before building lineage, but neighbor entities discovered during graph traversal were added to the response without per-entity authorization.In
EntityLineageService.processEdge():guidEntityMapLineageRelationentries were always added for each edgeSo a user authorized to read entity A could see metadata for unauthorized neighbor B (and the relation between them) in the lineage response — an authorization bypass / information disclosure.
The seed entity was already protected here:
Neighbors had no equivalent check.
Fix
Updated
EntityLineageService.java:addEntityHeaderIfAuthorized()— loads the header and adds it toguidEntityMaponly if:LineageRelationis added only when bothinGuidandoutGuidare present inguidEntityMap(both readable).processEdge()refactored — uses the helper for both vertices; unauthorized neighbors are skipped; edges involving unreadable entities are omitted.Behavior after fix
Scope: 1 file changed (
EntityLineageService.java), no REST contract change, no UI changes.How was this patch tested?
Manual (primary)
With authorization enabled (Ranger/simple authorizer) and lineage between at least two entities (A → process → B):
Setup
User A — ENTITY_READ on seed entity only
User B — owns upstream/downstream entity B; User A has no read on B
Steps
As User A, fetch lineage on entity A:
curl -u userA:passA
"http://:21000/api/atlas/v2/lineage/{guidA}?direction=BOTH&depth=3"
Before fix: Response guidEntityMap included B; relations included A↔B edge.
After fix: B absent from guidEntityMap; A↔B relation not in relations.
As User A, direct read on B (sanity check):
curl -u userA:passA
"http://:21000/api/atlas/v2/entity/guid/{guidB}/header"
Expected: 403 Forbidden.
As User B (or admin with full read), same lineage call.
Expected: Both entities and relations returned (no regression).
Repeat with direction=INPUT and direction=OUTPUT to confirm filtering in both traversal directions.
Manual (regression)
Authorized user with read on all entities in a lineage chain still gets complete graph.
Seed entity without lineage access still gets 403 at entry (unchanged).
Invalid entity type / non-dataset behavior unchanged.
Unit tests
mvn -pl repository -Dtest=EntityLineageServiceTest test
Existing tests pass (mock-based; no new auth-specific test added in this PR).
Build
mvn -pl repository -am compile -DskipTests
Compiles successfully.