Skip to content

[server] Add authorization to Snapshot Management RPCs#3300

Open
vaibhavk1992 wants to merge 3 commits into
apache:mainfrom
vaibhavk1992:add-snapshot-management-authorization
Open

[server] Add authorization to Snapshot Management RPCs#3300
vaibhavk1992 wants to merge 3 commits into
apache:mainfrom
vaibhavk1992:add-snapshot-management-authorization

Conversation

@vaibhavk1992
Copy link
Copy Markdown
Contributor

Summary

Changes

Server Side

TabletService.java:

  • notifyKvSnapshotOffset - Added CLUSTER/WRITE authorization check
  • notifyLakeTableOffset - Added CLUSTER/WRITE authorization check

CoordinatorService.java:

  • commitKvSnapshot - Added CLUSTER/WRITE authorization check
  • commitLakeTableSnapshot - Added CLUSTER/WRITE authorization check

Test Coverage

FlussAuthorizationITCase.java:

  • Added testSnapshotManagementAuthorization() with comprehensive coverage:
    • Authorization denial tests (no permission) - verifies AuthorizationException for all 4 operations
    • Authorization success tests (with permission) - verifies operations succeed after CLUSTER/WRITE permission granted
    • Internal session bypass tests - verifies internal server calls automatically bypass authorization

Technical Details

These are internal server-to-server RPCs used for snapshot coordination between CoordinatorServer and TabletServers. The authorization prevents external clients from calling internal cluster management APIs while allowing legitimate internal operations via session.isInternal() bypass.

All operations use CLUSTER/WRITE permission type because they modify cluster-wide snapshot state, consistent with other internal cluster management operations like rebalance and ISR adjustment.

Test Plan

  • Compiled successfully: mvn compile test-compile -pl fluss-server,fluss-client -am
  • All authorization checks follow existing patterns from rebalance/ISR operations
  • Tests verify complete authorization lifecycle: denial → grant → success

Closes #3250

vaibhav kumar and others added 3 commits May 11, 2026 16:19
This commit adds CLUSTER/WRITE authorization checks for snapshot management
internal RPCs as specified in issue apache#3250:

Server Changes:
- TabletService: Add authorization to notifyKvSnapshotOffset and notifyLakeTableOffset
- CoordinatorService: Add authorization to commitKvSnapshot and commitLakeTableSnapshot
- All methods check CLUSTER/WRITE permission before processing requests
- Internal sessions automatically bypass authorization via session.isInternal()

Test Coverage:
- Add comprehensive test testSnapshotManagementAuthorization()
- Test 1-4: Verify AuthorizationException when client lacks CLUSTER/WRITE permission
- Test 5: Grant CLUSTER/WRITE permission and verify operations succeed
- Test 6: Verify internal server-to-server calls bypass authorization
- Tests all 4 snapshot management operations with complete authorization lifecycle

These are internal server-to-server RPCs used for snapshot coordination.
The authorization prevents external clients from calling internal APIs while
allowing legitimate internal cluster operations to proceed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…objects

The test was failing because Protocol Buffer request objects require certain
fields to be set before validation. Added required fields to all snapshot
management RPC requests:

- NotifyKvSnapshotOffsetRequest: tableId, bucketId, coordinatorEpoch, minRetainOffset
- NotifyLakeTableOffsetRequest: coordinatorEpoch
- CommitKvSnapshotRequest: completedSnapshot, coordinatorEpoch, bucketLeaderEpoch
- CommitLakeTableSnapshotRequest: (no required fields, but keeping consistent)

This ensures requests pass validation and reach the authorization check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[server] Add authorization to Snapshot Management RPCs (commitKvSnapshot, notifyKvSnapshotOffset, commitLakeTableSnapshot, notifyLakeTableOffset)

1 participant