Commit 0d1c171
authored
fix(security): Fix Ranger plugin deserialisation to ignore unknown fields (#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
-
> UnrecognizedPropertyException for fields like category
> in RangerServiceDef$RangerAccessTypeDef.
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
<!---Describe any public API or user-facing feature change or any
performance 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
- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
## Release Notes
Please follow [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines)
and fill in the release notes below.
```
== NO RELEASE NOTE ==
```1 parent 415fbb3 commit 0d1c171
File tree
2 files changed
+6
-3
lines changed- presto-hive/src
- main/java/com/facebook/presto/hive/security/ranger
- test/resources/com.facebook.presto.hive.security.ranger
2 files changed
+6
-3
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
83 | | - | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
136 | | - | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
0 commit comments