fix(stepfunctions): check Lambda event source mapping tasks from the generated request resources (#8466)

TaskPermissions gave a Step Functions listEventSourceMappings task a literal *
and built updateEventSourceMapping's event-source-mapping:<Uuid> itself. With
Lambda now read whole from iam-request-resources.json, both go through the
generic requestPermissions, on the request the integration sends:
SdkManagementTaskInvoker.lambdaRequest takes the mapping's UUID, the path label
the API takes, from the task's Uuid, as the invoker already did, so
ListEventSourceMappings is checked on * because its action acts on no
resource type, and UpdateEventSourceMapping on the mapping its UUID names.
The checks are the same as before.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-15 11:42:22 -04:00
1 parent 9e05c07bfc
commit 9bc2f16a9d
3 files changed
+42 -11

No files matched your search

@@ -26,6 +26,19 @@ class SdkManagementTaskInvokerTest {
private final SdkManagementTaskInvoker invoker = new SdkManagementTaskInvoker(ecs,
lambda, mock(SecretsManagerJsonHandler.class), registry, mapper);
/**
* The Lambda request a task sends, as the API models it: the mapping's UUID, its path label, from the task's
* Uuid alone, the rest of the input its body; a UUID in the input is no member the body holds, so it names none.
*/
@Test
void aLambdaTasksRequestTakesTheMappingsUuidAsTheApisUuid() throws Exception {
assertEquals(mapper.readTree("{\"UUID\":\"u-2\",\"BatchSize\":5}"),
SdkManagementTaskInvoker.lambdaRequest(mapper.readTree("{\"Uuid\":\"u-2\",\"BatchSize\":5}")));
assertEquals(mapper.readTree("{\"BatchSize\":5}"),
SdkManagementTaskInvoker.lambdaRequest(mapper.readTree("{\"UUID\":\"u-1\",\"BatchSize\":5}")));
assertEquals(mapper.readTree("{}"), SdkManagementTaskInvoker.lambdaRequest(mapper.readTree("[]")));
}
@Test
void lambdaMappingUpdateUsesSdkUuidWithoutMutatingTheTaskInput() throws Exception {
when(registry.isServiceEnabled("lambda")).thenReturn(true);