fix(autoscaling): validate monitoring booleans (#3219)

This commit is contained in:
Franklin G. Mendoza authored and GitHub committed 2026-09-07 20:36:48 -05:00
1 parent 9e9b0b6e91
commit 84a7ce67e4
2 files changed
+19 -2

No files matched your search

@@ -1405,7 +1405,7 @@ public class AutoScalingQueryHandler {
private Boolean nullableBoolParam(MultivaluedMap<String, String> p, String key) {
String val = p.getFirst(key);
if (val == null || val.isBlank()) { return null; }
return Boolean.parseBoolean(val);
return parseOptionalBoolean(val, key);
}
private List<LaunchConfigurationBlockDeviceMapping> parseLaunchConfigurationBlockDeviceMappings(
@@ -1516,7 +1516,7 @@ public class AutoScalingQueryHandler {
"1 validation error detected: Value '" + val + "' at '" + key
+ "' failed to satisfy constraint: Member must be a valid boolean", 400);
}
return Boolean.parseBoolean(val);
return parseOptionalBoolean(val, key);
}
private String intString(Integer value) {
@@ -134,6 +134,23 @@ class AutoScalingIntegrationTest {
@Test
@Order(44)
void launchConfigurationRejectsInvalidInstanceMonitoringBoolean() {
given()
.formParam("Action", "CreateLaunchConfiguration")
.formParam("LaunchConfigurationName", "my-lc-invalid-monitoring")
.formParam("ImageId", "ami-12345678")
.formParam("InstanceType", "t3.micro")
.formParam("InstanceMonitoring.Enabled", "not-a-boolean")
.header("Authorization", AUTH)
.when()
.post("/")
.then()
.statusCode(400)
.body(containsString("ValidationError"));
}
@Test
@Order(45)
void launchConfigurationRejectsAMappingWithoutADeviceName() {
given()
.formParam("Action", "CreateLaunchConfiguration")