jenkinsci / jenkinsci/active-directory-plugin
[JENKINS-71667] Fortify ActiveDirectoryMailAddressResolver
- Dominant language
- Java
- Stars
- 53
- Forks
- 115
- PR merge metrics
- No merged PRs in 30d
Description
Seen in the wild
```
WARNING hudson.tasks.MailAddressResolver#resolve: hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl@157c0dd7 failed to resolve userX. Ignoring and moving on
java.lang.ClassCastException: class org.acegisecurity.userdetails.UserDetails$1 cannot be cast to class hudson.plugins.active_directory.ActiveDirectoryUserDetail (org.acegisecurity.userdetails.UserDetails$1 is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @17f9344b; hudson.plugins.active_directory.ActiveDirectoryUserDetail is in unnamed module of loader jenkins.util.URLClassLoader2 @6033250)
at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:55)
```
The actual root cause for the UserDetails being of other type than what the AD plugin expects is yet undetermined, but in the meantime it can be improved to at least not assume it will get what it expects out of the current UserDetailsService.
---
Originally reported by
rsandell, imported from: Fortify ActiveDirectoryMailAddressResolver
rsandell
Raw content of original issue
Seen in the wild
WARNING hudson.tasks.MailAddressResolver#resolve: hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl@157c0dd7 failed to resolve userX. Ignoring and moving on
java.lang.ClassCastException: class org.acegisecurity.userdetails.UserDetails$1 cannot be cast to class hudson.plugins.active_directory.ActiveDirectoryUserDetail (org.acegisecurity.userdetails.UserDetails$1 is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @17f9344b; hudson.plugins.active_directory.ActiveDirectoryUserDetail is in unnamed module of loader jenkins.util.URLClassLoader2 @6033250)
at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:55)The actual root cause for the UserDetails being of other type than what the AD plugin expects is yet undetermined, but in the meantime it can be improved to at least not assume it will get what it expects out of the current UserDetailsService.
Contributor guide
Research direction
Start in ActiveDirectoryMailAddressResolverImpl.java at findMailAddressFor, line 55, and inspect the UserDetails returned by the current UserDetailsService. The change is done when the resolver no longer assumes that value is an ActiveDirectoryUserDetail and the reported ClassCastException path is handled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100