Skip to content

Always set ACL on new projects when using API key with team#5855

Open
valentijnscholten wants to merge 1 commit intoDependencyTrack:masterfrom
valentijnscholten:update-new-project-acl-without-feature-check
Open

Always set ACL on new projects when using API key with team#5855
valentijnscholten wants to merge 1 commit intoDependencyTrack:masterfrom
valentijnscholten:update-new-project-acl-without-feature-check

Conversation

@valentijnscholten
Copy link
Contributor

@valentijnscholten valentijnscholten commented Mar 2, 2026

Summary

updateNewProjectACL now always adds the API key's team to newly created projects, regardless of whether the portfolio access control feature is enabled.

Motivation

The behaviour now matches what createProject does with accessTeams: when creating a project via the Project API, teams passed in accessTeams are applied to the project's ACL even if the access control feature is disabled. The BOM upload auto-create and updateNewProjectACL path previously only set ACL when the feature was enabled, causing inconsistent behaviour.

With this change, the team that uploads a BOM or creates a project retains access once the ACL feature is later enabled, without requiring manual ACL assignment.

This is useful/needed when users/admins are preparing for the ACL to be enabled but have not enabled it yet.

Changes

  • ProjectQueryManager: Removed the ACCESS_MANAGEMENT_ACL_ENABLED check from updateNewProjectACL. The API key's team is now always added when the principal is an API key with at least one team.
  • Tests: Added uploadBomAutoCreateWithAclDisabledAddsApiKeyTeamTest and createProjectWithAclDisabledAddsApiKeyTeamTest to verify ACL assignment when the feature is disabled.

@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.

@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.05% (target: -1.00%) 100.00% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d0078ec) 24556 19987 81.39%
Head commit (25d8743) 24682 (+126) 20076 (+89) 81.34% (-0.05%)

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 (#5855) 7 7 100.00%

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

Remove the ACCESS_MANAGEMENT_ACL_ENABLED check from updateNewProjectACL
so that the API key's team is added to newly created projects regardless
of whether the portfolio access control feature is enabled.

This aligns the behaviour with createProject via the Project API, which
applies accessTeams from the request body even when the ACL feature is
disabled. Consistent ACL assignment ensures the uploading/creating team
retains access when the feature is later enabled.

Adds tests for BOM auto-create and Project API create with ACL disabled.

Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
@valentijnscholten valentijnscholten force-pushed the update-new-project-acl-without-feature-check branch from f45ea5a to 25d8743 Compare March 2, 2026 11:38
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