mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
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:
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);
|
||||
|
||||
Reference in new issue
Block a user