Commit graph

98 commits

Author SHA1 Message Date
Arjav
b305b224ed delete policy violations before component
Signed-off-by: Arjav <arjavdongaonkar@gmail.com>
2025-10-13 13:43:28 +05:30
Joshua AL Rasbi
f6db185240 added a trigger for updating metrics for cloned project & unit tests
Signed-off-by: Joshua AL Rasbi <joshua.ar@Joshuas-MacBook-Pro.local>
Signed-off-by: Joshua AL Rasbi <joshua.AR@ibm.com>
2025-05-07 16:34:01 +01:00
nscuro
36d869c968
Improve the stability of tag binding
This is mostly a preventative change than one based on actual issues encountered.

Removing from a collection that is being iterated over is not supported and should usually lead to a `ConcurrentModificationException` being thrown. Using an `Iterator` prevents this from happening.

Signed-off-by: nscuro <nscuro@protonmail.com>
2025-04-26 16:43:28 +02:00
nscuro
9c109dec99
Prevent duplicate tag names and relationships
Signed-off-by: nscuro <nscuro@protonmail.com>
2025-04-18 21:13:56 +02:00
nscuro
23afb5cbf3
Fix component properties not being cloned
Signed-off-by: nscuro <nscuro@protonmail.com>
2025-03-11 12:16:22 +01:00
nscuro
4a0df1beef
Remove deprecated getAllProjects methods
Signed-off-by: nscuro <nscuro@protonmail.com>
2025-02-08 22:51:39 +01:00
nscuro
70e0ac2b05
Refactor vuln analysis task to be more efficient
* For portfolio analysis, don't fetch *all* projects at once, but in batches of 100.
* Regularly evict objects from the ORM's L1 cache to prevent excessive cache size.
* For project analysis, don't fetch *all* components at once, but in batches of 1000.
* Limit the fields being fetched from the database to only those needed for vulnerability analysis.
* When triggering a project analysis, only transmit the project's UUID via events, instead of all of its components.
* Deprecate `QueryManager#getAllProjects` for removal. This method is never the right choice, but is still used in a few places.

In addition, as byproducts of this refactoring:

* Add MDC variables to provide more context in logs emitted during vulnerability analysis.
* Remove event subscription for specific scanner events. Scanners are only ever invoked directly, never through the event system.
* Gracefully handle thread interrupts.
* Fix `CacheableScanTask#applyAnalysisFromCache` never being invoked.

Signed-off-by: nscuro <nscuro@protonmail.com>
2025-02-08 21:29:06 +01:00
nscuro
761f849b69
Fix possible NPEs during tag binding
Fixes #4593

Signed-off-by: nscuro <nscuro@protonmail.com>
2025-01-28 11:47:02 +01:00
nscuro
cb4590f38a
Fix REST endpoints for adding tags
The `/tag/{name}/project` endpoint did not add the provided tag to projects which already had tags assigned to them.

The `/tag/{name}/policy` and `/tag/{name}/notificationRule` endpoints replaced existing tags with the provided tag, which is not the intended behavior. Since only one tag can be provided via path parameter, the tag should be *added* to existing tags, not replace them.

Fixes #4539

Signed-off-by: nscuro <nscuro@protonmail.com>
2025-01-11 13:19:04 +01:00
Mikael Carneholm
51fb679583 Implement changes suggested by @nscuro
Use DbUtil to check DB type, use Project.id instead of uuid in queries and don't delete tags, notifications or policies.

Signed-off-by: Mikael Carneholm <mikael.carneholm.2@wirelesscar.com>
2024-12-18 15:31:18 +01:00
Mikael Carneholm
1da4f78a8e
Merge branch 'master' into master
Signed-off-by: Mikael Carneholm <mikael.carneholm.2@wirelesscar.com>
2024-12-16 11:25:46 +01:00
nscuro
0c0d2471ba
Remove workaround for unloading of project parent
Fields are no longer unloaded when a transaction commits (`DataNucleus.RetainValues` is enabled globally), as of https://github.com/stevespringett/Alpine/pull/552.

Signed-off-by: nscuro <nscuro@protonmail.com>
2024-12-08 14:40:09 +01:00
nscuro
380107d928
Merge branch 'master' of github.com:DependencyTrack/dependency-track into 2041-introduce-collection-projects 2024-12-07 18:06:35 +01:00
Mikael Carneholm
beba9d23be Implement the changes suggested by @nscuro
Signed-off-by: Mikael Carneholm <mikael.carneholm.2@wirelesscar.com>
2024-12-02 15:16:12 +01:00
Mikael Carneholm
3450de7f0f
Merge branch 'DependencyTrack:master' into master 2024-11-29 13:43:26 +01:00
Niklas
9b015c3e28
Merge pull request #4415 from nscuro/issue-4410 2024-11-28 18:18:26 +01:00
nscuro
42b91e887a
Fix project.active being nullable
Ensure the field defaults to `true`, both in Java and the database. During upgrade, migrate all values that are currently `null` to `true`.

Solidify this change by switching `project.active` from `Boolean` to `boolean`. Adjust logic that previously had to check for `null`.

Fixes #4410

Signed-off-by: nscuro <nscuro@protonmail.com>
2024-11-27 22:10:16 +01:00
nscuro
297b192f91
Fix NPE when cloning projects with broken dependency graph
Fixes #4413

Signed-off-by: nscuro <nscuro@protonmail.com>
2024-11-27 19:51:50 +01:00
Mikael Carneholm
2a0a7e53c0 Add /v1/project/batchDelete API method that deletes with SQL
Signed-off-by: Mikael Carneholm <mikael.carneholm.2@wirelesscar.com>
2024-11-14 18:06:28 +01:00
Ralf King
5f5c7abc65 * Fix failing unit test by enforcing parent loading
* Add validation to prevent invalid states of collection projects (prevent collection project having Components or services), including several unit tests covering these scenarios.

Signed-off-by: Ralf King <rkg@mm-software.com>
2024-10-03 12:06:59 +02:00
Ralf King
0e73c0c814 Allow projects to be configured as collections with different ProjectCollectionLogics.
Modifies project metrics updates to consider collection project logics.

Added several events to trigger project metrics updates to update collection projects if child projects change in a relevant way.

Signed-off-by: Ralf King <rkg@mm-software.com>
2024-10-03 12:01:52 +02:00
Ralf King
229a3265eb Fixed cloning not properly respecting latest flag. Add regression test for it.
Signed-off-by: Ralf King <rkg@mm-software.com>
2024-09-29 01:30:27 +02:00
Ralf King
fe36568e36 Handle Review comments:
*Simplify Boolean to boolean in Project and Policy and remove unncessary migration script part
*Move reads into transaction
*remove unnecessary index
*Rename ONLY_FOR_LATEST_PROJECT_VERSION to ONLY_LATEST_PROJECT_VERSION

Signed-off-by: Ralf King <rkg@mm-software.com>
2024-09-28 23:59:04 +02:00
Ralf King
3b4af92404 Introduce isLatest flag for projects. Support this for different endpoints which allow creation or modification of projects.
Signed-off-by: Ralf King <rkg@mm-software.com>
2024-09-28 23:33:55 +02:00
nscuro
3eac1d664f
Fix directDependencies of cloned projects referring to original component UUIDs
Fixes #4153

Signed-off-by: nscuro <nscuro@protonmail.com>
2024-09-24 22:39:50 +02:00
nscuro
68e615a1b9
Support tagging of notification rules
Supersedes #3506

Co-authored-by: Sebastien Delcoigne <sebastien.delcoigne@gmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
2024-08-31 22:45:00 +02:00
Ross Murphy
385bf6eacc
replace author with authors for DT model
Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
2024-07-24 15:53:11 +01:00
Ross Murphy
0a2550e798
Merge branch 'master' into issue-3936
Signed-off-by: Ross Murphy <77832827+2000rosser@users.noreply.github.com>
2024-07-16 17:47:35 +01:00
nscuro
164847a87a
Ensure no unique constraint violation for ProjectMetadata
Adds regression test for #3895. The behavior itself does not reproduce on `master`, but does with `4.11.5`.

Wraps the project cloning in a transaction to make it more reliable. Adds MDC variables for `CloneProjectTask` (#3234).

Fixes #3895

Signed-off-by: nscuro <nscuro@protonmail.com>
2024-07-15 20:54:27 +02:00
Ross Murphy
f1d14d53e9
add support for authors field
Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
2024-07-11 11:55:02 +01:00
nscuro
c41717f515
Add REST endpoints for bulk tagging & un-tagging of projects
Signed-off-by: nscuro <nscuro@protonmail.com>
2024-06-30 13:01:13 +02:00
Niklas
3346907d70
Merge pull request #3711 from DependencyTrack/feature-alpine-2.2.6
Bump Alpine to `2.2.6-SNAPSHOT`
2024-05-15 19:46:48 +02:00
nscuro
d82d32a06c
Replace manual transaction commits with callInTransaction
This is to properly support nested transactions as introduced in https://github.com/stevespringett/Alpine/pull/552.

Signed-off-by: nscuro <nscuro@protonmail.com>
2024-05-10 21:47:34 +02:00
Aravind Parappil
49350358f8 Add active Field To Project Versions
In order for the UI to distinguish between active or inactive project versions,
we need to include the active boolean field to ProjectVersion model

Signed-off-by: Aravind Parappil <aravindparappil@gmail.com>
2024-05-09 20:52:17 -04:00
nscuro
c5eda9271e
Transfer copyright from Steve Springett to OWASP Foundation
Signed-off-by: nscuro <nscuro@protonmail.com>
2024-03-20 18:39:35 +01:00
Sebastien Delcoigne
d1a44a6f92 Adds possibility to enter an attribution date value when adding a vulnerability to a project, used in cloning operation.
Fixes #3464

Signed-off-by: Sebastien Delcoigne <sebastien.delcoigne@gmail.com>
2024-02-22 22:57:13 +11:00
Niklas
43a1e38d1e
Merge pull request #3248 from mge-mm/dependency-track-1732
Project cloning logic for cloning policy violations and Violationanalysis
2024-01-15 20:39:37 +01:00
Ralf King
3f97987d85 Implement #1732
Signed-off-by: Ralf King <rkg@mm-software.com>
2023-12-10 02:43:38 +01:00
Ralf King
e379766844 reuse existing projects endpoint instead of creating a new one
Signed-off-by: Ralf King <rkg@mm-software.com>
2023-12-04 02:02:54 +01:00
Ralf King
763492f42f Portfolio Access Control : Add a team group to project should only list projects that are not already added.
Signed-off-by: Ralf King <rkg@mm-software.com>
2023-12-03 21:30:53 +01:00
Niklas
065e483a98
Merge pull request #3179 from nscuro/supplier-manufacturer-corrections
Supplier and manufacturer corrections
2023-11-28 23:42:30 +01:00
Willie Nel
7ead801fea Added a default value for 'active' if it is null
When creating a project from json payload and the active field is
not specified it will now default to true instead of null.

This fixes an issue with projects not being assignable as parent projects
because they are "inactive".

Signed-off-by: Willie Nel <4620380+willienel@users.noreply.github.com>
2023-11-28 20:28:55 +01:00
nscuro
b5a0bbf5fe
Move manufacturer from ProjectMetadata to Project
As per CycloneDX specification, `metadata.manufacturer` refers to `metadata.component`, whereas `metadata.supplier` and `metadata.authors` refer to the BOM itself.

Keeping `manufacturer` in `ProjectMetadata` is awkward and confusing.

Signed-off-by: nscuro <nscuro@protonmail.com>
2023-11-27 21:47:02 +01:00
nscuro
b6952ca22f
Remove unused ProjectQueryManager#updateProject method
Signed-off-by: nscuro <nscuro@protonmail.com>
2023-11-27 20:09:50 +01:00
nscuro
609c4f8092
Ensure project.supplier can be PATCHed
Signed-off-by: nscuro <nscuro@protonmail.com>
2023-11-27 20:07:51 +01:00
nscuro
91c1040f77
Include metadata when cloning projects
Signed-off-by: nscuro <nscuro@protonmail.com>
2023-11-27 19:44:53 +01:00
nscuro
785f1e485e
Handle supplier in update, patch, and clone operations of components and projects
Signed-off-by: nscuro <nscuro@protonmail.com>
2023-11-27 19:44:53 +01:00
nscuro
a6230de487
Object passed to IndexEvent no longer need detaching
They are converted to non-managed `SearchDocument` implementations in `IndexEvent`'s constructor.

Signed-off-by: nscuro <nscuro@protonmail.com>
2023-10-22 22:41:58 +02:00
nscuro
5534d3aace
Fix NPE in doesProjectExist when project version is null
Regression introduced in #2966

Signed-off-by: nscuro <nscuro@protonmail.com>
2023-10-02 23:09:22 +02:00
nscuro
741de8ce16
Fix project cloning allowing for duplicate versions
Also fixed:

* services not being cloned, despite `includeServices` being set to `true`.
* ACLs not being enforced for the `/clone` endpoint

And added tests for cloning that were previously missing.

Signed-off-by: nscuro <nscuro@protonmail.com>
2023-08-21 22:57:29 +02:00