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

Affected project in mail-notification doesn't show name #3978

Closed
2 tasks done
malice00 opened this issue Jul 15, 2024 · 5 comments · Fixed by #4108
Closed
2 tasks done

Affected project in mail-notification doesn't show name #3978

malice00 opened this issue Jul 15, 2024 · 5 comments · Fixed by #4108
Labels
defect Something isn't working p3 Nice-to-have features size/S Small effort
Milestone

Comments

@malice00
Copy link
Contributor

Current Behavior

When DT sends a mail about vulnerable dependencies or new vulnerabilities, all references to this project use the purl of the root component instead of the actual project name. This is especially frustrating when this component is not unique -- in our react native apps, the gradle configuration is generated and does not contain a version, so every upload uses the 'same' component even if in DT they are configured as different projects.
The annoying thing is that the list of other affected projects actually do show the project name!

Steps to Reproduce

  1. Create a project
  2. Setup a mail notifcation
  3. Upload an SBOM
  4. Wait for the mail

Expected Behavior

We expect the mail to contain the actual name configured in DT to show in both the subject and the mail body.

Dependency-Track Version

4.11.5

Dependency-Track Distribution

Container Image

Database Server

PostgreSQL

Database Server Version

14.9

Browser

Mozilla Firefox

Checklist

@malice00 malice00 added defect Something isn't working in triage labels Jul 15, 2024
@malice00
Copy link
Contributor Author

Update: it seems this does not happen to all projects... It seems like it happens on projects where a new BOM is uploaded -- older projects seem to work correctly. Might be a regression in 4.11.4/5? The older projects where created with at least 4.11.3, not sure if we were already on 4.11.4 though...

@malice00
Copy link
Contributor Author

Found it! It's caused by the BOM Processing V2! When I turn it off, the mails correctly contain the actual name of the project again. All projects imported with V2 on however, are still broken -- I guess something is saved differently in the database? Unfortunately I currently have no direct access to the db to verify.

@msymons msymons removed the in triage label Jul 17, 2024
@msymons msymons added this to the 4.12 milestone Jul 17, 2024
@msymons
Copy link
Member

msymons commented Jul 17, 2024

@malice00, thanks for reporting the problem and then digging deeper to identify the culprit.

I have assigned this to the 4.12 milestone because it is important that such defects be addressed before BOM Processing V2 makes the switch from being "Experimental"

As an FYI, #3880 was another notification issue that only occurred when BOM Processing V2 was enabled... a defect now fixed in v4.11.5

@msymons msymons added the gnomes Issues for milestone planning and effort estimation by the DT team label Jul 17, 2024
@nscuro
Copy link
Member

nscuro commented Aug 31, 2024

The issue seems to be that BOM Processing V2 populates the purl field of a project during BOM import, based on metadata.component.purl in the BOM. Which is something that should have been done since forever, but the legacy BOM processing implementation didn't do it.

Now, with that in mind, looking at the toString implementation of the Project class:

@Override
public String toString() {
if (getPurl() != null) {
return getPurl().canonicalize();
} else {
StringBuilder sb = new StringBuilder();
if (getGroup() != null) {
sb.append(getGroup()).append(" : ");
}
sb.append(getName());
if (getVersion() != null) {
sb.append(" : ").append(getVersion());
}
return sb.toString();
}
}

... shows that it will be shown as its PURL, if purl is set. Which in your case it is.

Following this trail, the affected projects in the email template end up calling the above toString implementation:

Project: {{ subject.component.project.toString }}

So, this is not really a bug, since it would have happened (I assume intentionally) before, if your projects had the purl field populated.

That said, this should be an easy fix. And I agree, showing a PURL here makes no sense.

@nscuro nscuro added p3 Nice-to-have features size/S Small effort and removed gnomes Issues for milestone planning and effort estimation by the DT team labels Aug 31, 2024
@nscuro nscuro closed this as completed in ee89410 Aug 31, 2024
Gepardgame pushed a commit to Gepardgame/dependency-track that referenced this issue Sep 10, 2024
Copy link
Contributor

github-actions bot commented Oct 1, 2024

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 Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working p3 Nice-to-have features size/S Small effort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants