-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix(security): Fix Ranger plugin deserialisation to ignore unknown fields #26315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the Ranger plugin to configure Jackson’s ObjectMapper to ignore unknown fields during deserialization, enhances exception handling to include the root cause, and adjusts test fixtures to validate the new behavior, ensuring compatibility with newer Ranger server versions. Sequence diagram for improved policy fetch error handlingsequenceDiagram
participant RangerBasedAccessControl
participant HttpClient
participant RangerServer
participant ExceptionHandler
RangerBasedAccessControl->>HttpClient: execute(request)
HttpClient->>RangerServer: Fetch policies
RangerServer-->>HttpClient: Response (may contain unknown fields)
HttpClient-->>RangerBasedAccessControl: Response body
RangerBasedAccessControl->>ObjectMapper: readValue(response, ServicePolicies.class)
ObjectMapper-->>RangerBasedAccessControl: ServicePolicies or Exception
alt Exception thrown
RangerBasedAccessControl->>ExceptionHandler: throw PrestoException with root cause
end
Class diagram for updated RangerBasedAccessControl deserializationclassDiagram
class RangerBasedAccessControl {
- static ObjectMapper OBJECT_MAPPER
+ static ObjectMapper OBJECT_MAPPER (configured to ignore unknown properties)
- static JsonCodec USER_INFO_CODEC
- static JsonCodec ROLES_INFO_CODEC
...
+ ServicePolicies getHiveServicePolicies(RangerBasedAccessControlConfig config)
}
class ObjectMapper {
+ configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
}
RangerBasedAccessControl --> ObjectMapper
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agrawalreetika imported this issue as lakehouse/presto #26315 |
Description
Fix Ranger plugin deserialisation to ignore unknown fields.
The Hive Ranger plugin was failing to fetch policies from Ranger servers with versions newer than 2.1.0. The failure was due to Jackson throwing -
This change configures the ObjectMapper to ignore unknown properties during deserialization, allowing the plugin to work with newer Ranger servers without failing.
Motivation and Context
Support current client features even with upgraded Ranger instance version > 2.1.0
Impact
Test Plan
Modified the test policy file to include an extra field, which would cause deserialization to fail. Updated ObjectMapper to ignore unknown properties to prevent exceptions.
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.