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

Support for summarized and scheduled notifications #3849

Conversation

MM-msr
Copy link

@MM-msr MM-msr commented Jun 14, 2024

Description

Currently, Dependency-Track Alerts send a single notification for every single event happening that an alert is subscribed to (e.g. NEW_VULNERABILITY). This can lead to a lot of emails for users and creates the risk of overlooking important notifications.

To improve the user experience of the Alerts, scheduled notifications are implemented in Dependency-Track to send summarized notifications of new events between the last and current scheduled notification. The schedule is defined as cron expression.

Scheduled notification management is available via API and Frontend under Administration -> Notifications -> Scheduled Alerts, which is introduced in the Frontend Pull Request [reference will be added after creation].

The PR includes default templates for console and email publishing.

Addressed Issue

#322

Additional Details

  • DEFAULT_SCHEDULED_CRON_EXPRESSION as environment variable for the default cron expression of new rules
  • Error: "The type javax.validation.Payload cannot be resolved. It is indirectly referenced from required type com.github.packageurl.validator.PackageURL" was introduced in my local development environment after syncing the main project and the transition of some javax packages to jakarta
    • was fixed by manually adding javax.validation-api to pom.xml as depencency
  • While evaluating and debugging the consideration of child projects in the notification process, it has turned out that projects delivered by QueryManager.getAllProjects() and some other methods didn't consistently include the correct child references. To workaround this behavior, the notification task "SendScheduledNotificationTask" uses a project-by-project-retrieval approach in "evaluateAffectedProjects(qm, rule)". This worked out empirically to deliver consistent child references.
  • DefaultPublisher-Retrieval was changed from by-class to a combination of name + class (or by-enum on a higher layer) to support multiple default publishers with same publisher class. This change is needed to use the existing publisher classes without defining new ones for scheduled default publishers.

[TODO: exemplary screenshots will be added during the next days]

Checklist

@MM-msr
Copy link
Author

MM-msr commented Jun 14, 2024

@nscuro As you may have already discussed with @rkg-mm, i would appreciate it if you would provide a feature branch for this PR, as it includes bigger code and functionality changes.

@nscuro
Copy link
Member

nscuro commented Jun 16, 2024

@MM-msr Sure! Feature branches have been created:

If you haven't already, please have a look at https://github.com/DependencyTrack/dependency-track/blob/master/DEVELOPING.md#feature-branches for details on how feature branches work. Please let me know if you have any questions, or run into challenges.

@MM-msr MM-msr changed the base branch from master to feature-322-scheduled-notifications June 17, 2024 06:14
@MM-msr
Copy link
Author

MM-msr commented Jun 18, 2024

@nscuro Due to the DCO failure i rebased according to the instructions there. I cloned the PR, did the rebase and tried then to push it back. (local branches: master + pr/3849)

git push --force-with-lease origin master-322-scheduled-notifications fails with the message

error: src refspec master-322-scheduled-notifications does not match any
error: failed to push some refs to 'https://github.com/DependencyTrack/dependency-track.git'

What did i do wrong? I suppose i have to 1) have to do the rebase again in my original repo (aka fork) or 2) i have to use another target branch, because it's not really existing with this name in the official DependencyTrack repository. Maybe i need to change master-322-scheduled-notifications to origin/feature-322-scheduled-notifications or my own repo-branch MM-msr/master-322-scheduled-notifications? Since it's my first real interaction with contribution, PRs and stuff, I don't want to experiment any further to force push somewhere else, so a little assistance or a hint where i have to look would be much appreciated. :)
Thanks a lot in advance.

@nscuro
Copy link
Member

nscuro commented Jun 18, 2024

@MM-msr It seems that origin in your local repository refers to this (DependencyTrack/dependency-track) repo, when it should be yours (MM-msr/dependency-track):

error: failed to push some refs to 'https://github.com/DependencyTrack/dependency-track.git

You can't push directly to this repository.

Something along these lines should do it:

git clone https://github.com/MM-msr/dependency-track.git
cd dependency-track
git remote add upstream https://github.com/DependencyTrack/dependency-track.git
git checkout master-322-scheduled-notifications
git rebase HEAD~90 --signoff # As per DCO Check suggestion
git push --force-with-lease origin master-322-scheduled-notifications

Afterwards, you may want to consider rebasing your changes against the new target branch, to make sure you're "in line":

git pull --rebase upstream feature-322-scheduled-notifications
# In case of conflicts, resolve them, then do: git rebase --continue
# Once rebased, do another round of: git push --force

MM-msr added 24 commits June 18, 2024 16:54
Signed-off-by: Max Schiller <[email protected]>
…orkaround for unknown possibility of JDO Inheritance setting

Signed-off-by: Max Schiller <[email protected]>
…ies for scheduled notifications

Signed-off-by: Max Schiller <[email protected]>
…ly of previous work from MGE, may be changed in future)

Signed-off-by: Max Schiller <[email protected]>
Signed-off-by: Max Schiller <[email protected]>
spawar-apex and others added 26 commits June 18, 2024 17:02
…rs showcase Signed-off-by: Author Name [email protected]

Signed-off-by: Swapnil Pawar <[email protected]>
…rs showcase Signed-off-by: Author Name [email protected]

Signed-off-by: Swapnil Pawar <[email protected]>
Bumps org.eclipse.jetty.ee10:jetty-ee10-maven-plugin from 12.0.9 to 12.0.10.

---
updated-dependencies:
- dependency-name: org.eclipse.jetty.ee10:jetty-ee10-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [org.apache.maven.plugins:maven-checkstyle-plugin](https://github.com/apache/maven-checkstyle-plugin) from 3.3.1 to 3.4.0.
- [Commits](apache/maven-checkstyle-plugin@maven-checkstyle-plugin-3.3.1...maven-checkstyle-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-checkstyle-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Also removes `cwe-dictionary-generate.py`.

Dictionary generated with:

```
jbang gen-cwe-dict@DependencyTrack --version 4.14 --package org.dependencytrack.parser.common.resolver --output src/main/java/org/dependencytrack/parser/common/resolver/CweDictionary.java --jakarta
```

Signed-off-by: nscuro <[email protected]>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.7 to 3.25.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f079b84...2e230e8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.21.0 to 0.22.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@fd25fed...595be6a)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.3.2 to 4.3.3.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](actions/dependency-review-action@0c155c5...72eb03d)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps debian from `2b2e35d` to `0200978`.

---
updated-dependencies:
- dependency-name: debian
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
…inactive projects is selected

Signed-off-by: Ross Murphy <[email protected]>
Bumps com.google.cloud.sql:cloud-sql-connector-jdbc-sqlserver from 1.18.1 to 1.19.0.

---
updated-dependencies:
- dependency-name: com.google.cloud.sql:cloud-sql-connector-jdbc-sqlserver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Max Schiller <[email protected]>
Signed-off-by: Max Schiller <[email protected]>
Since Dependabot appears to be unable to do so.

Signed-off-by: nscuro <[email protected]>
@MM-msr MM-msr force-pushed the master-322-scheduled-notifications branch from edecc6a to e269964 Compare June 18, 2024 15:08
@MM-msr
Copy link
Author

MM-msr commented Jun 18, 2024

@nscuro Due to massive problems with double-signoff and rebase conflicts i close this pull request and i will provide another pull request in the next days/weeks directly to the new feature branch. I will transfer my changes to a new branch with proper signoff and, if needed, a DependencyTrack-master sync at the end of my changes. This will make things a lot easier than to try to fix this PR. Sorry for the inconvenience.

@MM-msr MM-msr closed this Jun 18, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants