[improvement](fe) Add connector property validators - #66153
Draft
CalvinKirs wants to merge 1 commit into
Draft
Conversation
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: Connector properties only supported binding and type conversion, so path-valued properties had to duplicate validation or accepted parent-directory references. Add a reusable field-level validator extension point and apply a traversal validator to Hadoop and Hive XML resource properties before assignment.
### Release note
Reject parent-directory references in Hadoop and Hive XML connector resource paths.
### Check List (For Author)
- Test: Unit Test
- ./run-fe-ut.sh --run org.apache.doris.foundation.property.ConnectorPropertiesUtilsTest,org.apache.doris.filesystem.hdfs.properties.HdfsPropertiesTest
- Behavior changed: Yes, Hadoop and Hive XML resource paths containing a parent-directory component are rejected.
- Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Member
Author
|
run buildall |
Member
Author
|
/review |
Contributor
|
Codex automated review failed and did not complete. Error: Your access token could not be refreshed because your refresh token was revoked. Please log out and sign in again. Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
Contributor
TPC-H: Total hot run time: 29500 ms |
Contributor
TPC-DS: Total hot run time: 175926 ms |
Contributor
ClickBench: Total hot run time: 24.96 s |
Contributor
FE UT Coverage ReportIncrement line coverage |
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 problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
ConnectorPropertycurrently describes property names, aliases, required fields, supported fields, and sensitive values, while property-specific value checks have to be implemented separately by each connector.This PR adds a reusable validation extension point to the connector property binding framework. A validator receives the target object, annotated field, matched property name, converted value, and the complete raw property map. Validation runs after type conversion and before field assignment. Validator instances are stateless and reused across bindings.
To add validation to a connector property, implement
ConnectorPropertyValidator:Then declare it on the property:
Properties without a validator retain the existing behavior through the default no-op validator.
The PR also provides
NoPathTraversalValidatoras the first reusable implementation. It rejects parent-directory components in path values and comma-separated resource lists. Hadoop, JFS, OSS-HDFS, and Hive XML resource properties now use this validator.Release note
Add connector property validators and validate parent-directory components in Hadoop and Hive XML resource paths.
Check List (For Author)
Test
./run-fe-ut.sh --run org.apache.doris.foundation.property.ConnectorPropertiesUtilsTest,org.apache.doris.filesystem.hdfs.properties.HdfsPropertiesTestBehavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)