Skip to content

Add accessTeams support to BOM upload auto-create#5856

Open
valentijnscholten wants to merge 2 commits intoDependencyTrack:masterfrom
valentijnscholten:bom-upload-access-teams
Open

Add accessTeams support to BOM upload auto-create#5856
valentijnscholten wants to merge 2 commits intoDependencyTrack:masterfrom
valentijnscholten:bom-upload-access-teams

Conversation

@valentijnscholten
Copy link
Contributor

Summary

Add accessTeams support when auto-creating projects during BOM upload. The behaviour mimics createProject via the Project API.

Motivation

When creating a project explicitly via PUT /v1/project, teams can be passed in accessTeams and are applied to the project's ACL. BOM upload with autoCreate=true did not support this, so users could not assign teams when auto-creating via BOM upload. This change brings parity.

Changes

  • BomSubmitRequest: Added accessTeams field. JSON upload accepts accessTeams array with {"name": "TeamName"} or {"uuid": "..."}.
  • BOM multipart (POST /v1/bom): Added accessTeams form param (JSON array).
  • Resolution logic: Same as Project API — principal must be a member of the team, or have ACCESS_MANAGEMENT permission to assign any team.
  • Test: uploadBomAutoCreateWithAccessTeamsTest verifies the flow.

@owasp-dt-bot
Copy link

owasp-dt-bot commented Mar 2, 2026

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

Status Scanner 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.

Mimics createProject: when auto-creating a project during BOM upload,
teams can be specified via accessTeams and are applied to the project
ACL. Same resolution rules as Project API (principal must be member
or have ACCESS_MANAGEMENT).

- BomSubmitRequest: add accessTeams field (JSON)
- BOM multipart: add accessTeams form param (JSON array)
- Apply access teams before updateNewProjectACL

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
@valentijnscholten valentijnscholten force-pushed the bom-upload-access-teams branch from 694d12d to c9a51f1 Compare March 2, 2026 11:37
@codacy-production
Copy link

codacy-production bot commented Mar 2, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.03% (target: -1.00%) 96.08% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d0078ec) 24556 19987 81.39%
Head commit (0a1c88d) 24732 (+176) 20124 (+137) 81.37% (-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 (#5856) 51 49 96.08%

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%

See your quality gate settings    Change summary preferences

Cover the branches added in the accessTeams PR that were not reached
by the initial test: team lookup by UUID, admin path (ACCESS_MANAGEMENT),
inaccessible team error, missing team identifier error, multipart form
endpoint happy path, and invalid JSON in multipart accessTeams field.

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
@valentijnscholten valentijnscholten force-pushed the bom-upload-access-teams branch from 15ea6b0 to 0a1c88d Compare March 3, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants