jenkinsci / jenkinsci/active-directory-plugin

[JENKINS-71667] Fortify ActiveDirectoryMailAddressResolver

Open
#652 0 comments 0 reactions 0 assignees View on GitHub
component:active-directory-plugin imported-jira-issue priority:major resolution:unresolved
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


  • assignee: rsandell
  • status: In Review
  • priority: Major
  • component(s): active-directory-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.