Always set ACL on new projects when using API key with team#5855
Open
valentijnscholten wants to merge 1 commit intoDependencyTrack:masterfrom
Open
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: 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>
f45ea5a to
25d8743
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateNewProjectACLnow 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
createProjectdoes withaccessTeams: when creating a project via the Project API, teams passed inaccessTeamsare applied to the project's ACL even if the access control feature is disabled. The BOM upload auto-create andupdateNewProjectACLpath 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
ACCESS_MANAGEMENT_ACL_ENABLEDcheck fromupdateNewProjectACL. The API key's team is now always added when the principal is an API key with at least one team.uploadBomAutoCreateWithAclDisabledAddsApiKeyTeamTestandcreateProjectWithAclDisabledAddsApiKeyTeamTestto verify ACL assignment when the feature is disabled.