Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Notification for OIDC Groups is not working #2647

Closed
2 tasks done
sahil3112 opened this issue Apr 7, 2023 · 12 comments
Closed
2 tasks done

Email Notification for OIDC Groups is not working #2647

sahil3112 opened this issue Apr 7, 2023 · 12 comments
Labels
defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk
Milestone

Comments

@sahil3112
Copy link

Current Behavior

I receive the mail notification when the team mapped to an alert contains local users, but I didn't get the Mail Notification when the Team is mapped to OIDC Group

Steps to Reproduce

  1. Setup OIDC Group in OIDC Tool
  2. Add a user to that OIDC Group
  3. Create an OIDC Group in Dependency Track
  4. Create a Team in the Dependency track and map that OIDC Group to the Team that we created in Dependency Track
  5. Set-Up Mail Configuration
  6. Go to alert and Select Publisher as Email and then Select the Same team as the recipient in which we map the OIDC Group

After doing all the steps, I didn't get a mail notification but I get the mail notification if I create a Local user

Expected Behavior

Mail Notification Send to the users under the OIDC Group

Dependency-Track Version

4.7.1

Dependency-Track Distribution

Container Image

Database Server

PostgreSQL

Database Server Version

No response

Browser

Google Chrome

Checklist

@sahil3112 sahil3112 added defect Something isn't working in triage labels Apr 7, 2023
@valentijnscholten
Copy link
Contributor

Just to be sure, did you login at least once to make sure the OIDC user gets created and actually mapped into the Team in DT?

@sahil3112
Copy link
Author

sahil3112 commented Apr 8, 2023

Hi @valentijnscholten , I have make sure that the user is Mapped to OIDC Group and that OIDC group is mapped to the local team

@valentijnscholten
Copy link
Contributor

According to the code and testcase OIDC users should also get the email notification. Can you confirm my question above? You need to login at least once with the user to have the user created inside DT. Otherwise DT is not aware of the existence of the user. Also the email address field needs to be populated.

static String[] parseDestination(final JsonObject config, final List<Team> teams) {
String[] destination = teams.stream().flatMap(
team -> Stream.of(
Arrays.stream(config.getString("destination").split(",")).filter(Predicate.not(String::isEmpty)),
Optional.ofNullable(team.getManagedUsers()).orElseGet(Collections::emptyList).stream().map(ManagedUser::getEmail).filter(Objects::nonNull),
Optional.ofNullable(team.getLdapUsers()).orElseGet(Collections::emptyList).stream().map(LdapUser::getEmail).filter(Objects::nonNull),
Optional.ofNullable(team.getOidcUsers()).orElseGet(Collections::emptyList).stream().map(OidcUser::getEmail).filter(Objects::nonNull)
)
.reduce(Stream::concat)
.orElseGet(Stream::empty)
)
.distinct()
.toArray(String[]::new);
return destination.length == 0 ? null : destination;
}

@sahil3112
Copy link
Author

Hi @valentijnscholten ,

Thanks for the info

I have checked that the OIDC user in DT is mapped to the team for which I have set up the alert
But in the configuration test Mail is sent by DT and if the user is Mapped Locally then also I get the mail with the same setup,
and I also didn't get any error logs in DT

Is there anything I am missing in the "OIDC_SCOPE=openid email profile groups"

Not sure In the local user I get the mail But in the OIDC user i didn't get mail notification

@sahil3112
Copy link
Author

When I use below API call

GET /api/v1/user/oidc

then I only get the username and subjectIdentifier, I didn't get email of the users in the user list

{
"username": "USERNAME",
"subjectIdentifier": "IDENTIFIER",
"teams": [
{
"uuid": "ID",
"name": "Team Name"
}
]
}

@rkg-mm
Copy link
Contributor

rkg-mm commented Apr 10, 2023

There was a bug in the current version affecting LDAP users in the underlying alpine framework.
We fixed that for upcoming DTrack 4.8 version for LDAP.

Could it be same happens for OIDC?
See #2320

@syalioune
Copy link
Contributor

It's more simple than the problem with LDAP.

The email field of OIDCUSER is not persistent so email from synced users are never stored hence why Optional.ofNullable(team.getOidcUsers()).orElseGet(Collections::emptyList).stream().map(OidcUser::getEmail).filter(Objects::nonNull) always return an empty array.

@sahil3112
Copy link
Author

Hi @syalioune ,

Thanks for the information

Can you please recommended possible solution, is there anything we have to do in IAM services

@syalioune
Copy link
Contributor

Can you please recommended possible solution, is there anything we have to do in IAM services

No nothing. A fix/feature should be implemented in DT (Alpine framework) to handle this use case.

@nscuro nscuro added p2 Non-critical bugs, and features that help organizations to identify and reduce risk and removed in triage labels Apr 11, 2023
@nscuro
Copy link
Member

nscuro commented Apr 11, 2023

Thanks all, I raised a PR for Alpine to fix this: stevespringett/Alpine#484

As it is a low-risk change, hopefully we can include it in the upcoming 4.8 release.

@nscuro nscuro added this to the 4.8 milestone Apr 12, 2023
@nscuro
Copy link
Member

nscuro commented Apr 12, 2023

Fixed in stevespringett/Alpine#484.

@nscuro nscuro closed this as completed Apr 12, 2023
@nscuro nscuro changed the title Email Notification for OICD Groups is not working Email Notification for OIDC Groups is not working Apr 12, 2023
@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk
Projects
None yet
Development

No branches or pull requests

5 participants