fix(ssm): reject send-command timeouts below AWS minimum (#1511)

This commit is contained in:
Jason van Zyl authored and GitHub committed 2026-06-23 00:39:12 -05:00
1 parent bb6ee4f69d
commit 0870f993a4
4 files changed
+71 -15

No files matched your search

@@ -40,6 +40,7 @@ import java.util.concurrent.Executors;
public class SsmCommandService {
private static final Logger LOG = Logger.getLogger(SsmCommandService.class);
private static final int MIN_TIMEOUT_SECONDS = 30;
private static final int MAX_STDOUT_CHARS = 24000;
private static final int MAX_STDERR_CHARS = 8000;
@@ -129,6 +130,7 @@ public class SsmCommandService {
Map<String, List<String>> parameters = parseParameters(request.path("Parameters"));
String comment = request.path("Comment").asText("");
int timeoutSeconds = request.path("TimeoutSeconds").asInt(3600);
validateTimeoutSeconds(timeoutSeconds);
String documentVersion = request.path("DocumentVersion").asText("$DEFAULT");
String outputS3Bucket = request.path("OutputS3BucketName").asText("");
String outputS3Prefix = request.path("OutputS3KeyPrefix").asText("");
@@ -198,6 +200,15 @@ public class SsmCommandService {
return response;
}
private static void validateTimeoutSeconds(int timeoutSeconds) {
if (timeoutSeconds < MIN_TIMEOUT_SECONDS) {
throw new AwsException(
"ValidationException",
"1 validation error detected: Value '" + timeoutSeconds + "' at 'timeoutSeconds' failed to satisfy constraint: Member must have value greater than or equal to 30",
400);
}
}
public CommandInvocation getCommandInvocation(String commandId, String instanceId, String region) {
return invocationStore.get(invocationKey(region, commandId, instanceId))
.orElseThrow(() -> new AwsException("InvocationDoesNotExist",