diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaCodeSigningAttachmentSdkTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaCodeSigningAttachmentSdkTest.java
new file mode 100644
index 0000000000..de6360d8d6
--- /dev/null
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaCodeSigningAttachmentSdkTest.java
@@ -0,0 +1,97 @@
+package com.floci.test;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.core.SdkBytes;
+import software.amazon.awssdk.services.lambda.LambdaClient;
+import software.amazon.awssdk.services.lambda.model.CreateCodeSigningConfigResponse;
+import software.amazon.awssdk.services.lambda.model.CreateFunctionRequest;
+import software.amazon.awssdk.services.lambda.model.CreateFunctionResponse;
+import software.amazon.awssdk.services.lambda.model.FunctionCode;
+import software.amazon.awssdk.services.lambda.model.GetFunctionCodeSigningConfigResponse;
+import software.amazon.awssdk.services.lambda.model.ListFunctionsByCodeSigningConfigResponse;
+import software.amazon.awssdk.services.lambda.model.PutFunctionCodeSigningConfigResponse;
+import software.amazon.awssdk.services.lambda.model.ResourceConflictException;
+import software.amazon.awssdk.services.lambda.model.Runtime;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+@DisplayName("Lambda - code signing attachment lifecycle through AWS SDK v2")
+class LambdaCodeSigningAttachmentSdkTest {
+
+ private static final String ACCOUNT_ID = "000000000000";
+ private static final String ROLE = TestFixtures.globalArn("iam", ACCOUNT_ID, "role/lambda-role");
+ private static final String PROFILE = TestFixtures.arn("signer", ACCOUNT_ID,
+ "/signing-profiles/prof/AbCdEfGhIj");
+
+ @Test
+ void createAttachReadListDetachAndDelete() {
+ String functionName = TestFixtures.uniqueName("sdk-code-signing");
+ try (LambdaClient lambda = TestFixtures.lambdaClient()) {
+ String configArn = null;
+ boolean functionCreated = false;
+ try {
+ CreateCodeSigningConfigResponse createdConfig = lambda.createCodeSigningConfig(request -> request
+ .description("SDK lifecycle")
+ .allowedPublishers(publishers -> publishers.signingProfileVersionArns(PROFILE)));
+ configArn = createdConfig.codeSigningConfig().codeSigningConfigArn();
+ String createdConfigArn = configArn;
+ assertThat(configArn).startsWith(TestFixtures.arn("lambda", ACCOUNT_ID,
+ "code-signing-config:csc-"));
+ assertThat(lambda.getCodeSigningConfig(request -> request.codeSigningConfigArn(createdConfigArn))
+ .codeSigningConfig().allowedPublishers().signingProfileVersionArns())
+ .containsExactly(PROFILE);
+
+ CreateFunctionResponse createdFunction = lambda.createFunction(CreateFunctionRequest.builder()
+ .functionName(functionName)
+ .runtime(Runtime.NODEJS20_X)
+ .role(ROLE)
+ .handler("index.handler")
+ .code(FunctionCode.builder()
+ .zipFile(SdkBytes.fromByteArray(LambdaUtils.minimalZip()))
+ .build())
+ .build());
+ functionCreated = true;
+
+ PutFunctionCodeSigningConfigResponse attached = lambda.putFunctionCodeSigningConfig(request -> request
+ .functionName(functionName).codeSigningConfigArn(createdConfigArn));
+ assertThat(attached.functionName()).isEqualTo(functionName);
+ assertThat(attached.codeSigningConfigArn()).isEqualTo(configArn);
+
+ GetFunctionCodeSigningConfigResponse read = lambda.getFunctionCodeSigningConfig(
+ request -> request.functionName(functionName));
+ assertThat(read.functionName()).isEqualTo(functionName);
+ assertThat(read.codeSigningConfigArn()).isEqualTo(configArn);
+
+ ListFunctionsByCodeSigningConfigResponse listed = lambda.listFunctionsByCodeSigningConfig(
+ request -> request.codeSigningConfigArn(createdConfigArn).maxItems(1));
+ assertThat(listed.functionArns()).containsExactly(createdFunction.functionArn());
+ assertThat(listed.nextMarker()).isNull();
+
+ assertThatThrownBy(() -> lambda.deleteCodeSigningConfig(
+ request -> request.codeSigningConfigArn(createdConfigArn)))
+ .isInstanceOf(ResourceConflictException.class);
+
+ lambda.deleteFunctionCodeSigningConfig(request -> request.functionName(functionName));
+ assertThat(lambda.getFunctionCodeSigningConfig(request -> request.functionName(functionName))
+ .codeSigningConfigArn()).isNullOrEmpty();
+ assertThat(lambda.listFunctionsByCodeSigningConfig(request -> request.codeSigningConfigArn(createdConfigArn))
+ .functionArns()).isEmpty();
+ lambda.deleteCodeSigningConfig(request -> request.codeSigningConfigArn(createdConfigArn));
+ configArn = null;
+ } finally {
+ try {
+ if (functionCreated) {
+ lambda.deleteFunction(request -> request.functionName(functionName));
+ }
+ } finally {
+ if (configArn != null) {
+ String remainingConfigArn = configArn;
+ lambda.deleteCodeSigningConfig(request -> request.codeSigningConfigArn(remainingConfigArn));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/docs/services/lambda.md b/docs/services/lambda.md
index 0ca069389a..b966b03296 100644
--- a/docs/services/lambda.md
+++ b/docs/services/lambda.md
@@ -32,8 +32,10 @@ Floci Lambda runs your function code locally inside real Docker containers - clo
| `AddPermission` | Add a resource-policy statement |
| `GetPolicy` | Get the function resource policy |
| `RemovePermission` | Remove a resource-policy statement |
-| `GetFunctionCodeSigningConfig` | Return code-signing config (always empty) |
-| `ListFunctionsByCodeSigningConfig` | List functions carrying a config. Always empty, since nothing can attach one |
+| `GetFunctionCodeSigningConfig` | Return the code-signing config attached to `$LATEST` (or an empty ARN) |
+| `PutFunctionCodeSigningConfig` | Attach or replace a code-signing config on `$LATEST` |
+| `DeleteFunctionCodeSigningConfig` | Detach the code-signing config from `$LATEST` |
+| `ListFunctionsByCodeSigningConfig` | List functions carrying a config, with marker pagination |
| `CreateCodeSigningConfig` | Create a code signing configuration |
| `GetCodeSigningConfig` | Read a code signing configuration |
| `UpdateCodeSigningConfig` | Update the members the request names |
@@ -586,13 +588,14 @@ These AWS Lambda operations have no handler in Floci. Calls will return `404` or
- Layer permissions (`AddLayerVersionPermission`, `RemoveLayerVersionPermission`, `GetLayerVersionPolicy`)
- `InvokeWithResponseStream`
-- Code signing enforcement. A configuration is created, read, updated, deleted and listed, and
- nothing verifies a signature against it, so it never gates a deployment. Attaching one to a
- function is not wired either: there is no `PutFunctionCodeSigningConfig`, so
- `GetFunctionCodeSigningConfig` still reports an empty ARN and `ListFunctionsByCodeSigningConfig`
- always reports no functions. An unknown configuration is `ResourceNotFoundException`, and a
- malformed ARN or an out-of-range `MaxItems` is rejected with `InvalidParameterValueException`
- first
+
+Code signing enforcement is not emulated: an attached configuration never gates a deployment.
+The attachment lifecycle is supported for `$LATEST`: `PutFunctionCodeSigningConfig` attaches or
+replaces a configuration, `GetFunctionCodeSigningConfig` reads it,
+`DeleteFunctionCodeSigningConfig` detaches it, and `ListFunctionsByCodeSigningConfig` returns
+attached functions with marker pagination. An unknown configuration is
+`ResourceNotFoundException`; a malformed ARN or out-of-range `MaxItems` is rejected with
+`InvalidParameterValueException` first.
## Configuration
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java b/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java
index 95cb30f3d2..489e9bdd5b 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java
@@ -895,6 +895,9 @@ public class ResourceArnBuilder {
if (name == null) {
return createdFunctionArn(path, ctx, region, accountId);
}
+ if (path.endsWith("/code-signing-config")) {
+ return codeSigningFunctionArn(name, region, accountId);
+ }
boolean qualifiedTarget = path.endsWith("/functions/" + name + "/invocations")
|| path.endsWith("/functions/" + name + "/response-streaming-invocations")
|| path.endsWith("/functions/" + name + "/provisioned-concurrency");
@@ -922,6 +925,17 @@ public class ResourceArnBuilder {
}
}
+ /** Code-signing attachment routes use Lambda's broader NamespacedFunctionName shape. */
+ private static String codeSigningFunctionArn(String name, String region, String accountId) {
+ try {
+ LambdaArnUtils.ResolvedFunctionRef ref = LambdaArnUtils.resolveNamespacedFunctionName(name);
+ return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + ref.name()).toString();
+ } catch (AwsException e) {
+ // A reference Lambda refuses, which its handler answers with a 400 before acting on anything.
+ return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + name).toString();
+ }
+ }
+
/**
* The function {@code CreateFunction} makes, which its body names, in the caller's account and Region, as
* every route but an invoke acts there: the Service Reference gives it the {@code function} resource, so
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaArnUtils.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaArnUtils.java
index 42c1854846..66f3b0de04 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaArnUtils.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaArnUtils.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import java.util.Arrays;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
@@ -24,6 +25,11 @@ public final class LambdaArnUtils {
private static final Pattern NAME_PATTERN = Pattern.compile("[a-zA-Z0-9-_]+");
private static final int MAX_NAME_LENGTH = 64;
private static final int MAX_TOTAL_LENGTH = 140;
+ /** The NamespacedFunctionName shape used by Lambda's attachment and mapping APIs. */
+ public static final Pattern NAMESPACED_FUNCTION_NAME_PATTERN = Pattern.compile(
+ "^(arn:(aws[a-zA-Z-]*)?:lambda:)?(?(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}:)?"
+ + "(?\\d{12}:)?(function:)?(?[a-zA-Z0-9-_\\.]+)"
+ + "(?::(?\\$LATEST(\\.PUBLISHED)?|[a-zA-Z0-9-_]+))?$");
/** The model's {@code FunctionName} pattern, quoted in the ValidationException a bad name gets. */
private static final String NAME_REGEX = "(arn:(aws[a-zA-Z-]*)?:lambda:)?"
+ "((eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}:)?"
@@ -91,6 +97,50 @@ public final class LambdaArnUtils {
*/
public record ResolvedFunctionRef(String name, String qualifier, String region, String account) {}
+ /**
+ * Parses Lambda's broader {@code NamespacedFunctionName} shape. Unlike {@link #resolve}, this
+ * accepts dotted names, optional region/account prefixes without {@code function:}, and the
+ * {@code function:NAME} namespace used by the code-signing attachment APIs.
+ */
+ public static ResolvedFunctionRef resolveNamespacedFunctionName(String input) {
+ if (input == null || input.isEmpty() || input.length() > 256) {
+ throw namespacedValidationFailure(input);
+ }
+ Matcher matcher = NAMESPACED_FUNCTION_NAME_PATTERN.matcher(input);
+ if (!matcher.matches()) {
+ throw namespacedValidationFailure(input);
+ }
+ if (matcher.group(1) != null) {
+ if (!AwsArnUtils.isArn(input)) {
+ throw invalid("Invalid ARN: " + input);
+ }
+ AwsArnUtils.Arn arn;
+ try {
+ arn = AwsArnUtils.parse(input);
+ } catch (IllegalArgumentException e) {
+ throw invalid("Invalid ARN: " + input);
+ }
+ if (!"lambda".equals(arn.service())) {
+ throw invalid("Invalid ARN: " + input);
+ }
+ return new ResolvedFunctionRef(matcher.group("name"), matcher.group("qualifier"),
+ arn.region(), arn.accountId());
+ }
+ return new ResolvedFunctionRef(matcher.group("name"), matcher.group("qualifier"),
+ stripTrailingColon(matcher.group("region")), stripTrailingColon(matcher.group("account")));
+ }
+
+ private static String stripTrailingColon(String value) {
+ return value == null ? null : value.substring(0, value.length() - 1);
+ }
+
+ private static AwsException namespacedValidationFailure(String input) {
+ return SmithyValidationErrors.validationException(
+ "Value '" + input + "' at 'functionName' failed to satisfy constraint: "
+ + "Member must satisfy regular expression pattern: "
+ + NAMESPACED_FUNCTION_NAME_PATTERN.pattern());
+ }
+
/**
* Parses a {@code FunctionName} path parameter. Throws {@link AwsException}, HTTP 400,
* on any malformed input: {@code ValidationException} when the name fails the
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigFunctionsController.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigFunctionsController.java
index 4b0a34219d..d58e7e0c8c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigFunctionsController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigFunctionsController.java
@@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
-import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.lambda.model.CodeSigningConfig;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
@@ -23,8 +22,6 @@ import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
-import java.util.regex.Pattern;
-
/**
* The code signing configuration resource, all under /2020-04-22/code-signing-configs.
*
@@ -35,11 +32,9 @@ import java.util.regex.Pattern;
* instead of matching here.
*
* Create, Get, Update, Delete and List manage the configuration itself.
- * ListFunctionsByCodeSigningConfig reports which functions carry one, and always reports none:
- * attaching a configuration to a function is PutFunctionCodeSigningConfig, which is not
- * implemented, so nothing can be attached. It answers a configuration that does not exist with a
- * 404 rather than an empty list, because an empty list would say the configuration exists and
- * simply has no functions.
+ * ListFunctionsByCodeSigningConfig derives its results from the function records carrying the
+ * configuration ARN. It answers a configuration that does not exist with a 404 rather than an
+ * empty list, because an empty list would say the configuration exists and simply has no functions.
*
* Nothing here verifies a signature. Lambda's own code signing checks are not emulated, so a
* configuration never gates a deployment.
@@ -49,29 +44,21 @@ import java.util.regex.Pattern;
@Consumes(MediaType.APPLICATION_JSON)
public class LambdaCodeSigningConfigFunctionsController {
- /**
- * botocore's {@code CodeSigningConfigArn} shape pattern, verbatim. Applied with
- * {@link String#matches(String)} so it is anchored whole-string, which is the
- * right semantics for an ARN; the shape's {@code max: 200} is checked separately
- * because the pattern itself does not bound the partition suffix.
- */
- private static final Pattern CODE_SIGNING_CONFIG_ARN = Pattern.compile(
- "arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}"
- + ":\\d{12}:code-signing-config:csc-[a-z0-9]{17}");
-
- private static final int ARN_MAX_LENGTH = 200;
private static final int MAX_ITEMS_MIN = 1;
private static final int MAX_ITEMS_MAX = 10000;
private final LambdaCodeSigningConfigService service;
+ private final LambdaService lambdaService;
private final RegionResolver regionResolver;
private final ObjectMapper objectMapper;
@Inject
public LambdaCodeSigningConfigFunctionsController(LambdaCodeSigningConfigService service,
+ LambdaService lambdaService,
RegionResolver regionResolver,
ObjectMapper objectMapper) {
this.service = service;
+ this.lambdaService = lambdaService;
this.regionResolver = regionResolver;
this.objectMapper = objectMapper;
}
@@ -88,15 +75,19 @@ public class LambdaCodeSigningConfigFunctionsController {
@PathParam("codeSigningConfigArn") String codeSigningConfigArn,
@QueryParam("Marker") String marker,
@QueryParam("MaxItems") String maxItems) {
- requireValidArn(codeSigningConfigArn);
- parseMaxItems(maxItems);
- // Resolving the config is what turns an unknown ARN into the 404. A known one has no
- // functions, since PutFunctionCodeSigningConfig is not implemented, so Marker addresses a
- // page past the end and NextMarker is never emitted.
- service.get(regionResolver.resolveRegion(headers), codeSigningConfigArn);
+ LambdaCodeSigningConfigService.validateArn(codeSigningConfigArn);
+ Integer requested = maxItems == null || maxItems.isBlank() ? null : parseMaxItems(maxItems);
+ String region = regionResolver.resolveRegion(headers);
+ String accountId = regionResolver.getAccountId();
+ service.get(region, accountId, codeSigningConfigArn);
+ PaginatedResult page = lambdaService.listFunctionsByCodeSigningConfig(
+ region, accountId, codeSigningConfigArn, requested, marker);
ObjectNode root = objectMapper.createObjectNode();
- root.putArray("FunctionArns");
+ root.set("FunctionArns", objectMapper.valueToTree(page.items()));
+ if (page.nextToken() != null) {
+ root.put("NextMarker", page.nextToken());
+ }
return Response.ok(root).build();
}
@@ -113,8 +104,9 @@ public class LambdaCodeSigningConfigFunctionsController {
@Path("/code-signing-configs/{codeSigningConfigArn}")
public Response getCodeSigningConfig(@Context HttpHeaders headers,
@PathParam("codeSigningConfigArn") String codeSigningConfigArn) {
- requireValidArn(codeSigningConfigArn);
- return Response.ok(wrap(service.get(regionResolver.resolveRegion(headers), codeSigningConfigArn))).build();
+ LambdaCodeSigningConfigService.validateArn(codeSigningConfigArn);
+ String region = regionResolver.resolveRegion(headers);
+ return Response.ok(wrap(service.get(region, regionResolver.getAccountId(), codeSigningConfigArn))).build();
}
@PUT
@@ -122,19 +114,34 @@ public class LambdaCodeSigningConfigFunctionsController {
public Response updateCodeSigningConfig(@Context HttpHeaders headers,
@PathParam("codeSigningConfigArn") String codeSigningConfigArn,
ObjectNode body) {
- requireValidArn(codeSigningConfigArn);
- CodeSigningConfig config = service.update(regionResolver.resolveRegion(headers), codeSigningConfigArn,
- text(body, "Description"), allowedPublishers(body), policies(body));
- return Response.ok(wrap(config)).build();
+ LambdaCodeSigningConfigService.validateArn(codeSigningConfigArn);
+ String region = regionResolver.resolveRegion(headers);
+ return service.withConfigLock(codeSigningConfigArn, () -> {
+ service.get(region, regionResolver.getAccountId(), codeSigningConfigArn);
+ CodeSigningConfig config = service.update(region, codeSigningConfigArn,
+ text(body, "Description"), allowedPublishers(body), policies(body));
+ return Response.ok(wrap(config)).build();
+ });
}
@DELETE
@Path("/code-signing-configs/{codeSigningConfigArn}")
public Response deleteCodeSigningConfig(@Context HttpHeaders headers,
@PathParam("codeSigningConfigArn") String codeSigningConfigArn) {
- requireValidArn(codeSigningConfigArn);
- service.delete(regionResolver.resolveRegion(headers), codeSigningConfigArn);
- return Response.noContent().build();
+ LambdaCodeSigningConfigService.validateArn(codeSigningConfigArn);
+ String region = regionResolver.resolveRegion(headers);
+ String accountId = regionResolver.getAccountId();
+ return service.withConfigLock(codeSigningConfigArn, () -> {
+ service.get(region, accountId, codeSigningConfigArn);
+ PaginatedResult attached = lambdaService.listFunctionsByCodeSigningConfig(
+ region, accountId, codeSigningConfigArn, 1, null);
+ if (!attached.items().isEmpty()) {
+ throw new AwsException("ResourceConflictException",
+ "The code signing configuration is still attached to a function.", 409);
+ }
+ service.delete(region, codeSigningConfigArn);
+ return Response.noContent().build();
+ });
}
@GET
@@ -180,17 +187,6 @@ public class LambdaCodeSigningConfigFunctionsController {
CodeSigningConfig.CodeSigningPolicies.class);
}
- private void requireValidArn(String arn) {
- if (arn == null || arn.isBlank()
- || arn.length() > ARN_MAX_LENGTH
- || !CODE_SIGNING_CONFIG_ARN.matcher(arn).matches()) {
- throw SmithyValidationErrors.exception("InvalidParameterValueException",
- "Value '" + arn + "' at 'codeSigningConfigArn' "
- + "failed to satisfy constraint: Member must satisfy regular expression pattern: "
- + CODE_SIGNING_CONFIG_ARN.pattern());
- }
- }
-
private int parseMaxItems(String maxItems) {
if (maxItems == null || maxItems.isBlank()) {
return MAX_ITEMS_MAX;
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigService.java
index 8000215b90..85fb50d5de 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaCodeSigningConfigService.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SignedMarkers;
+import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.lambda.model.CodeSigningConfig;
@@ -16,9 +17,12 @@ import java.security.SecureRandom;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
+import java.util.function.Supplier;
+import java.util.regex.Pattern;
/**
* Code signing configurations, the resource CreateCodeSigningConfig manages.
@@ -40,6 +44,10 @@ public class LambdaCodeSigningConfigService {
private static final int MAX_DESCRIPTION = 256;
private static final int MAX_SIGNING_PROFILE_ARNS = 20;
private static final int LIST_PAGE_SIZE = 10000;
+ private static final Pattern CODE_SIGNING_CONFIG_ARN = Pattern.compile(
+ "arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}"
+ + ":\\d{12}:code-signing-config:csc-[a-z0-9]{17}");
+ private static final int ARN_MAX_LENGTH = 200;
/** The model documents Warn as the default when the request names no policy. */
static final String DEFAULT_UNTRUSTED_ARTIFACT_POLICY = "Warn";
@@ -52,12 +60,21 @@ public class LambdaCodeSigningConfigService {
private final RegionResolver regionResolver;
private final SignedMarkers markers = new SignedMarkers();
private final SecureRandom random = new SecureRandom();
+ private final Object[] configLocks = new Object[64];
@Inject
public LambdaCodeSigningConfigService(StorageFactory storageFactory, RegionResolver regionResolver) {
this.regionResolver = regionResolver;
this.store = storageFactory.create("lambda", "lambda-code-signing-configs.json",
new TypeReference