eclipse-ee4j / eclipse-ee4j/jersey

NullPointerException when SecurityEntityFilteringFeature enabled

Open
#3,131 8 comments 0 reactions 0 assignees View on GitHub
Component: extensions Component: security Incomplete Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

Hi,

I enabled SecurityEntityFilteringFeature. When I test a 406 due to a not supported media-type I get a NullPointerException thrown by ServerScopeProvider.getFilteringScopes because the getMatchedMethods() returns a null

```
for (final ResourceMethod method : ServerScopeProvider.getMatchedMethods(uriInfo)) {
final Invocable invocable = method.getInvocable();

mergeFilteringScopes(filteringScope,
getFilteringScopes(invocable.getHandlingMethod(), invocable.getHandler().getHandlerClass()));

if (!filteringScope.isEmpty()) {
uriToContexts.putIfAbsent(path, filteringScope);
return filteringScope;
}
}
```

How can I tell Jersey to execute this feature only if I return a 200
#### Affected Versions
[2.17]

Contributor guide

Open the contributing guide

Research direction

Start in ServerScopeProvider.getFilteringScopes and inspect how getMatchedMethods() is handled when a 406 unsupported-media-type response occurs with SecurityEntityFilteringFeature enabled. Reproduce the reported NullPointerException and verify that filtering is only executed for a successful 200 response without breaking other response handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.