fix: validate filesystem catalog identifiers#334
Merged
JingsongLi merged 6 commits intoMay 21, 2026
Merged
Conversation
JingsongLi
reviewed
May 20, 2026
| } | ||
|
|
||
| /// Validate this identifier's database and object names. | ||
| pub fn validate(&self) -> Result<()> { |
Contributor
There was a problem hiding this comment.
Why not just in Identifier.new?
Contributor
Author
There was a problem hiding this comment.
Good point. I will implement this.
Contributor
|
After the signature modification, this is indeed a major change. Perhaps we should still keep Identifier:: new() invincible (without changing the signature) and only perform validation in the entry method of the FileSystemCatalog. (RESTCatalog will have validation in server side.) |
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.
What changed
This adds path-safe identifier validation helpers and enforces them in
FileSystemCatalogbefore database or table paths are constructed.The existing
Identifier::newAPI remains infallible and compatible.FileSystemCatalognow rejects database and object names that are empty or whitespace-only,.,.., contain/or\, or contain control characters before using them indatabase_pathortable_path.C/Go binding identifier constructors remain compatible and do not reject path-control names at identifier construction time. Unsafe names are rejected when they are used with
FileSystemCatalogoperations.Why
Filesystem catalog paths are derived from database and table names. Without validation, path-control input can escape the intended warehouse namespace on local filesystem storage.
Fixes #333.
Validation
cargo fmt --all -- --checkcargo check -p paimon --all-targetscargo test -p paimon catalog::cargo clippy --all-targets --workspace --features fulltext,vortex -- -D warningsgit diff --check