Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<enclave-aws.version>2.1.0</enclave-aws.version>
<enclave-azure.version>2.1.13</enclave-azure.version>
<enclave-gcp.version>2.1.0</enclave-gcp.version>
<uid2-shared.version>10.1.0</uid2-shared.version>
<uid2-shared.version>10.8.0</uid2-shared.version>
<image.version>${project.version}</image.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
Expand Down Expand Up @@ -308,7 +308,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.5</version>
<configuration>
<argLine>${argLine} -Dfile.encoding=${project.build.sourceEncoding}</argLine>
<systemProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ public boolean validateRequest(RoutingContext rc, JsonObject requestJsonObject,
LOGGER.warn("Path: {} , ClientKey has ServiceId set, but LinkId in request was not authorized. ServiceId: {}, LinkId in request: {}", rc.normalizedPath(), clientKey.getServiceId(), linkId);
return false;
}
if (serviceLink.isDisabled()) {
LOGGER.warn("Path: {} , ServiceLink {} is disabled", rc.normalizedPath(), linkId);
return false;
}
if (!serviceLink.getRoles().contains(role)) {
LOGGER.warn("Path: {} , ServiceLink {} does not have role {}", rc.normalizedPath(), linkId, role);

return false;
}
Service service = rotatingServiceStore.getService(clientKey.getServiceId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ void validateRequest_linkIdNotFound_returnsFalse() {
assertFalse(service.validateRequest(this.routingContext, requestJsonObject, Role.MAPPER));
}

@Test
void validateRequest_linkIdFoundLinkDisabled_returnsFalse() {
this.setClientKey(10);
JsonObject requestJsonObject = new JsonObject();
requestJsonObject.put(SecureLinkValidatorService.LINK_ID, "999");

when(this.rotatingServiceLinkStore.getServiceLink(10, "999")).thenReturn(new ServiceLink("999", 10, 100, "testServiceLink", Set.of(Role.MAPPER), true));

SecureLinkValidatorService service = new SecureLinkValidatorService(this.rotatingServiceLinkStore, this.rotatingServiceStore);
assertFalse(service.validateRequest(this.routingContext, requestJsonObject, Role.MAPPER));
}

@Test
void validateRequest_roleNotInServiceLink_returnsFalse() {
this.setClientKey(10);
Expand Down