Skip to content

RANGER-5799: Validate class assignability before instantiating config… - #1237

Open
vyommani wants to merge 1 commit into
apache:masterfrom
vyommani:RANGER-5799
Open

vyommani wants to merge 1 commit into
apache:masterfrom
vyommani:RANGER-5799

Conversation

@vyommani

Copy link
Copy Markdown
Contributor

…ured service-def classes

What changes were proposed in this pull request?

Several places resolve a configured class name via Class.forName(...).newInstance(), relying on the checkcast to catch a bad class — but the checkcast happens after construction, not before. Add an isAssignableFrom check before instantiation, in the existing try/catch, so an unassignable class is treated the same as an unresolvable one (falls back / skipped, as today).

No new validation mechanism, no behavior change for valid configs. Tests added confirming a non-assignable class is never constructed while legitimate classes still work.

How was this patch tested?

all tests are green and add couple of new tests as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants