django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

Scan Added Notification settings

Open ZeeshanDarasa opened this issue 1 year ago • 2 comments

Bug description I have disabled scan added event notifications from personal notification settings, it is enabled in system notifications, I am still getting scan added notifications even after disabling

Steps to reproduce Steps to reproduce the behavior:

  1. Go to dojohost.com/notifications/personal
  2. Uncheck Scan Added Box
  3. Click Save
  4. Add a new scan/import.

Expected behavior It should not send notifications for scan added if setting is disabled in notification settings

Deployment method (select with an X)

  • [x] Docker Compose
  • [ ] Kubernetes
  • [ ] GoDojo

Environment information

  • Docker Compose version v2.39.4
  • DefectDojo version v. 2.50.4

Screenshots If applicable, add screenshots to help explain your problem.

Image Image

ZeeshanDarasa avatar Dec 03 '25 08:12 ZeeshanDarasa

If you are an admin you will receive system level notifications. There's also scan_added settings per product.

valentijnscholten avatar Dec 04 '25 16:12 valentijnscholten

Fixed in #15498, merged to bugfix as 410dd8352.

@valentijnscholten your diagnosis was the mechanism exactly, and this change deliberately alters the first half of it.

_notify_single_user() appended the system-wide settings for every superuser. Because notification records are combined with a union, that put the system row's channels back on top of anything the superuser had switched off — so unticking "Scan Added" on your own page could not take effect. The append is still there, but only as a fallback for a superuser who has no notification settings of their own (they are included as recipients regardless, so something has to supply defaults).

The reason this is treated as a bug rather than intended behaviour: NOTIFICATIONS_SYSTEM_LEVEL_TRUMP already exists to say which events override personal settings, it defaults to ["user_mentioned", "review_requested"], and scan_added is deliberately not in it. Overriding personal settings for every event bypassed that gate entirely.

A second defect in the same code path was fixed alongside it: merge_notifications_list() covered 17 of the model's 18 MultiSelectField columns — scan_added_empty was never merged, so it silently kept whichever value the first record happened to carry. There is now a test that walks the fields off the model so the next event added cannot be missed the same way.

@ZeeshanDarasa what is unchanged: the per-product settings @valentijnscholten mentioned. Personal global and personal per-product records are still unioned together, which is intended — a product-level "Scan Added" re-enables it for that product even if your global setting is off. So if you still get these after upgrading, check /notifications/personal for the specific product as well as the global page, and if it persists please reopen with whether the account is a superuser and which of those records have scan_added set. Closing on the basis that the described symptom is resolved.

devGregA avatar Aug 04 '26 01:08 devGregA