Skip to content

Add project filtering for GET /api/v2/projects - #7348

Open
Nihad74 wants to merge 6 commits into
DependencyTrack:mainfrom
Nihad74:fix-pr-implement-project-filtering
Open

Nihad74 wants to merge 6 commits into
DependencyTrack:mainfrom
Nihad74:fix-pr-implement-project-filtering

Conversation

@Nihad74

@Nihad74 Nihad74 commented Sep 18, 2026

Copy link
Copy Markdown

Description

Adds a paginated GET /api/v2/projects endpoint with support for filtering, sorting, optional field expansion, and portfolio access control.

This PR continues and supersedes #6873. It has been rebased onto the current main branch and incorporates the remaining review feedback from that PR.

Supported filters include:

  • Project name and version using case-insensitive substring matching
  • Tags using tags_all
  • Teams using teams_any
  • Parent and ancestor project UUIDs
  • Root projects and projects with children
  • Active state and latest-version state
  • Last BOM import time
  • Project classifier

The endpoint also supports sorting, keyset pagination, and optional expansion of:

  • metrics
  • parent
  • teams

Addressed Issue

Addresses #926
Addresses #2778

Supersedes #6873

Additional Details

This PR is based on the work originally submitted in #6873.

The remaining review feedback from that PR has been addressed:

  • Removed severity filtering from this PR so it can be discussed and implemented separately if needed.
  • Changed expanded teams from objects to a list of team name strings.
  • Removed unused columns from the API v2 project listing query.
  • Removed redundant child project ACL checks, as project ACLs are inherited through the project hierarchy.
  • Kept parent and teams as expandable fields to avoid unnecessary query cost and response size.
  • Uses the shared classifier, project state, and project reference schemas.
  • Uses project metrics rather than dependency metrics.
  • Uses withJitDisabled for the project listing query.
  • Handles last_inherited_risk_score sorting correctly for collection projects.

The branch has been rebased onto the current main.

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly
  • This PR is a substantial change (per the ADR criteria), and I have added an ADR under docs/adr/

@owasp-dt-bot

owasp-dt-bot commented Sep 18, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production

codacy-production Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 114 complexity

Metric Results
Complexity 114

View in Codacy

🟢 Coverage 94.33% diff coverage · +0.03% coverage variation

Metric Results
Coverage variation ✅ +0.03% coverage variation (-1.00%)
Diff coverage ✅ 94.33% diff coverage (70.00%)

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e1e3c8f) 45958 40366 87.83%
Head commit (fed544a) 46195 (+237) 40589 (+223) 87.86% (+0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7348) 247 233 94.33%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread api/src/main/openapi/resources/projects/projects.yaml Outdated
Comment thread apiserver/src/main/java/org/dependencytrack/persistence/jdbi/ProjectDao.java Outdated
Comment thread apiserver/src/main/java/org/dependencytrack/persistence/jdbi/ProjectDao.java Outdated
@Nihad74
Nihad74 force-pushed the fix-pr-implement-project-filtering branch from e64674c to de19336 Compare October 1, 2026 06:32
@Nihad74
Nihad74 requested a review from nscuro October 1, 2026 08:05
@nissessenap

Copy link
Copy Markdown
Contributor

ping @nscuro , please take a second look at this PR when you have time. It would be really nice to get this feature and start being able to read data based on tags.

ElenaStroebele and others added 5 commits October 27, 2026 22:25
Signed-off-by: ElenaStroebele <elena.stroebele@rohde-schwarz.com>
Signed-off-by: ElenaStroebele <elena.stroebele@rohde-schwarz.com>
Signed-off-by: Nihad Uddin <nihad.uddin@rohde-schwarz.com>
Signed-off-by: Nihad Uddin <nihad.uddin@rohde-schwarz.com>
Signed-off-by: Nihad Uddin <nihad.uddin@rohde-schwarz.com>
@Nihad74
Nihad74 force-pushed the fix-pr-implement-project-filtering branch from 910417b to 4fd9066 Compare October 27, 2026 22:33
Signed-off-by: Nihad Uddin <nihad.uddin@rohde-schwarz.com>
@nscuro nscuro added this to the 5.3 milestone Oct 28, 2026
@nscuro nscuro added the enhancement New feature or request label Oct 28, 2026
@nscuro nscuro self-assigned this Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants