Skip to content

Check source tables before saving logical-table mappings - #20457

Open
xiangfu0 wants to merge 4 commits into
apache:masterfrom
xiangfu0:xiangfu0/codex2/logical-mapping-source-checks
Open

xiangfu0 wants to merge 4 commits into
apache:masterfrom
xiangfu0:xiangfu0/codex2/logical-mapping-source-checks

Conversation

@xiangfu0

@xiangfu0 xiangfu0 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Apply source-table permission checks when creating or updating a logical-table mapping.

Validated with 49 focused controller tests, including PinotLogicalTableResourceUnitTest.

Upgrade note

Creating or updating a logical table requires UPDATE permission on every mapped physical table and every table referenced by its time-boundary strategy. Grant those permissions before upgrading controllers.

Require source-table UPDATE authorization for both create and update before committing a logical-table dependency.
@codecov-commenter

codecov-commenter commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.28%. Comparing base (ae59fc2) to head (74e8b55).
⚠️ Report is 26 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (ae59fc2) and HEAD (74e8b55). Click for more details.

HEAD has 24 uploads less than BASE
Flag BASE (ae59fc2) HEAD (74e8b55)
unittests 3 2
java-25 7 2
temurin 7 2
unittests2 1 0
lane-a 2 0
integration 4 0
integration2 2 0
lane-b 2 0
integration1 2 0
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #20457       +/-   ##
=============================================
- Coverage     71.50%   61.28%   -10.23%     
+ Complexity     1639        1     -1638     
=============================================
  Files          3618     2795      -823     
  Lines        245010   180941    -64069     
  Branches      39863    30303     -9560     
=============================================
- Hits         175203   110886    -64317     
- Misses        56586    60690     +4104     
+ Partials      13221     9365     -3856     
Flag Coverage Δ
integration ?
integration1 ?
integration2 ?
java-25 61.28% <ø> (-10.23%) ⬇️
lane-a ?
lane-b ?
temurin 61.28% <ø> (-10.23%) ⬇️
unittests 61.28% <ø> (-10.23%) ⬇️
unittests1 61.28% <ø> (+0.05%) ⬆️
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@xiangfu0 xiangfu0 added bug Something is not working as expected security Related to security hardening auth Related to authentication and authorization logical-tables Related to logical table abstraction rest-api Related to REST API endpoints needs-attention Used for sensitive changes - allows searching PRs post release to narrow down causes for regression. labels Dec 4, 2026

@xiangfu0 xiangfu0 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One point inline.

@xiangfu0 xiangfu0 added the backward-incompat Introduces a backward-incompatible API or behavior change label Dec 4, 2026
Defer missing strategy names to the existing config validator and retain source authorization for configured strategies.

@xiangfu0 xiangfu0 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small point inline from another pass.

try {
physicalTableNames.addAll(TimeBoundaryStrategyService.getInstance()
.getTimeBoundaryStrategy(boundary.getBoundaryStrategy()).getTimeBoundaryTableNames(logicalTableConfig));
} catch (IllegalArgumentException | ClassCastException e) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTimeBoundaryTableNames returns the raw parameter list unchecked, so a non-string element in includedTables passes addAll and the ClassCastException only surfaces in the loop on line 224, outside this try. A JSON null under the key gives a NullPointerException from addAll, which this clause doesn't catch either. Both come back as 500 rather than the 400 intended here. Copying the names into the set with an explicit string check inside the try would keep them a 400.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 74e8b5570a. Create and update now return HTTP 400 for malformed time-boundary source lists. Valid source names still go through authorization. All 51 focused controller tests passed.

@Jackie-Jiang Jackie-Jiang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7760e39 across source authorization, database-qualified names, compatibility, and test coverage.

One remaining P2 issue is already tracked in the existing inline thread: malformed timeBoundaryConfig.parameters.includedTables values return HTTP 500. [1] passes addAll and throws ClassCastException during iteration outside the catch; null throws an uncaught NullPointerException from addAll. Validate that the list is non-null and contains only non-null strings before adding its entries, return HTTP 400 for invalid values, and cover both create and update.

No additional authorization or compatibility defects found. All 17 reported checks pass for this revision; tests were not rerun locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Related to authentication and authorization backward-incompat Introduces a backward-incompatible API or behavior change bug Something is not working as expected logical-tables Related to logical table abstraction needs-attention Used for sensitive changes - allows searching PRs post release to narrow down causes for regression. rest-api Related to REST API endpoints security Related to security hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants