From 1fdcf552946efc5e0abcc30a469e1f88eed7714a Mon Sep 17 00:00:00 2001 From: nscuro Date: Fri, 14 Jun 2024 14:00:19 +0200 Subject: [PATCH] Disable automatic API key generation for teams Ports https://github.com/DependencyTrack/dependency-track/pull/3574 from Dependency-Track v4.11.0. Co-authored-by: Massimo Prencipe Signed-off-by: nscuro --- .../java/org/dependencytrack/resources/v1/TeamResource.java | 2 +- .../java/org/dependencytrack/resources/v1/TeamResourceTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/dependencytrack/resources/v1/TeamResource.java b/src/main/java/org/dependencytrack/resources/v1/TeamResource.java index f12d29ff5..374753568 100644 --- a/src/main/java/org/dependencytrack/resources/v1/TeamResource.java +++ b/src/main/java/org/dependencytrack/resources/v1/TeamResource.java @@ -130,7 +130,7 @@ public Response createTeam(Team jsonTeam) { ); try (QueryManager qm = new QueryManager()) { - final Team team = qm.createTeam(jsonTeam.getName(), true); + final Team team = qm.createTeam(jsonTeam.getName(), false); super.logSecurityEvent(LOGGER, SecurityMarkers.SECURITY_AUDIT, "Team created: " + team.getName()); return Response.status(Response.Status.CREATED).entity(team).build(); } diff --git a/src/test/java/org/dependencytrack/resources/v1/TeamResourceTest.java b/src/test/java/org/dependencytrack/resources/v1/TeamResourceTest.java index b2dba1852..1c6c24dea 100644 --- a/src/test/java/org/dependencytrack/resources/v1/TeamResourceTest.java +++ b/src/test/java/org/dependencytrack/resources/v1/TeamResourceTest.java @@ -134,6 +134,7 @@ public void createTeamTest() { Assert.assertNotNull(json); Assert.assertEquals("My Team", json.getString("name")); Assert.assertTrue(UuidUtil.isValidUUID(json.getString("uuid"))); + Assert.assertTrue(json.getJsonArray("apiKeys").isEmpty()); } @Test