RANGER-5567: allow validateConfig API available only for users with Ranger admin role#931
Open
vyommani wants to merge 3 commits intoapache:masterfrom
Open
RANGER-5567: allow validateConfig API available only for users with Ranger admin role#931vyommani wants to merge 3 commits intoapache:masterfrom
vyommani wants to merge 3 commits intoapache:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to restrict access to the ServiceREST.validateConfig API, and it also introduces Hive JDBC URL validation to block potentially dangerous JDBC parameters before connecting.
Changes:
- Re-maps
RangerAPIList.VALIDATE_CONFIGto a different UI/module association inRangerAPIMapping. - Adds a new
JdbcUrlValidatorand a comprehensive JUnit test suite for it. - Wires JDBC URL validation into
HiveClientconnection initialization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| security-admin/src/main/java/org/apache/ranger/security/context/RangerAPIMapping.java | Adjusts which UI tab/module is associated with VALIDATE_CONFIG for authorization decisions. |
| hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java | Invokes JDBC URL validation prior to attempting a JDBC connection. |
| hive-agent/src/main/java/org/apache/ranger/services/hive/client/JdbcUrlValidator.java | New validator that rejects JDBC URLs with prohibited/dangerous parameter names/patterns. |
| hive-agent/src/test/java/org/apache/ranger/services/hive/client/JdbcUrlValidatorTest.java | New test coverage for URL validation, bypass attempts, and sanitization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dfd593c to
e8f8063
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.
What changes were proposed in this pull request?
allow validateConfig API available only for users with Ranger admin role
How was this patch tested?
mvn clean install is success and added the new tests as well.