Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag doesn't get appended to project when added over API and project already has a tag #4539

Closed
2 tasks done
kpe09 opened this issue Jan 9, 2025 · 0 comments · Fixed by #4541
Closed
2 tasks done
Labels
defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/S Small effort
Milestone

Comments

@kpe09
Copy link

kpe09 commented Jan 9, 2025

Current Behavior

When sending a POST '/api/v1/tag/{name}/project' request, I get back a 204 response, but the new tag isn't appended to the project's tags if the project already has one tag added to it. The initial tag stays as it is.
When in the starting situation, the project has no tags, then the POST request adds the tag as intended. But if this is repeated with a project that already has one tag, nothing changes, or rather the new tag isn't appended.

Steps to Reproduce

  1. Find or create a project with one tag.
  2. Send a POST request with URL '/api/v1/tag/{name}/project' using an arbitrary API client to the server with a valid tag that has already been created on the server and isn't the same as the one already present in the project.

Expected Behavior

The new tag should be appended to the tags of the project.

Dependency-Track Version

4.12.2

Dependency-Track Distribution

Container Image

Database Server

N/A

Database Server Version

No response

Browser

N/A

Checklist

@kpe09 kpe09 added defect Something isn't working in triage labels Jan 9, 2025
@kpe09 kpe09 changed the title Tag doesn't get added to project when added over API, when project already has a tag Tag doesn't get appended to project when added over API and project already has a tag Jan 9, 2025
@nscuro nscuro added p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/S Small effort and removed in triage labels Jan 11, 2025
@nscuro nscuro added this to the 4.12.3 milestone Jan 11, 2025
valentijnscholten added a commit to valentijnscholten/dependency-track that referenced this issue Jan 11, 2025
Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
@nscuro nscuro closed this as completed in cb4590f Jan 11, 2025
nscuro added a commit to nscuro/dependency-track that referenced this issue Jan 11, 2025
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 DependencyTrack#4539

Signed-off-by: nscuro <nscuro@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/S Small effort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants