From 0dedd49f792b14a0d6e560130c745a1867899525 Mon Sep 17 00:00:00 2001 From: Jackson Price <59149601+jprice8@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:32:24 -0600 Subject: [PATCH] fix(logging): escape apostrophes in formatted diagnostics (#8776) Java's MessageFormat reads a lone apostrophe as the start of a quoted section, so thirteen log patterns that used one in a word like "image's" printed their placeholders as literal text or lost the apostrophe. Each apostrophe is now doubled, so the warnings show their arguments again; the EKS legacy-state warning names the volume to pass to docker volume inspect. WarmPoolTest drops a cleanup stub that could go unused once the original stop finished, since the released latch's answer already serves any later stop. Co-authored-by: Andre Kurait --- .../aws/core/common/docker/ContainerLifecycleManager.java | 4 ++-- .../java/io/floci/aws/core/common/docker/DockerDaemon.java | 2 +- .../java/io/floci/aws/services/acm/CertificateGenerator.java | 2 +- .../java/io/floci/aws/services/acm/model/KeyAlgorithm.java | 2 +- .../aws/services/cloudformation/CloudFormationService.java | 2 +- .../java/io/floci/aws/services/ec2/Ec2ContainerManager.java | 2 +- src/main/java/io/floci/aws/services/ec2/Ec2Service.java | 2 +- .../java/io/floci/aws/services/eks/EksClusterManager.java | 4 ++-- .../aws/services/emrserverless/EmrServerlessService.java | 2 +- .../io/floci/aws/services/iam/WebIdentityTokenIssuer.java | 2 +- .../floci/aws/services/lambda/launcher/ContainerLauncher.java | 2 +- src/test/java/io/floci/aws/services/lambda/WarmPoolTest.java | 1 - 12 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java b/src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java index 84f2097e06..802bf9496b 100644 --- a/src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java +++ b/src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java @@ -485,7 +485,7 @@ public class ContainerLifecycleManager { copyIntoContainerDir(containerId, trustStore.get(), ContainerCaBundle.JAVA_TRUST_STORE_FILE_NAME); return true; } catch (Exception e) { - LOG.warnv("Could not copy the Java trust store into container {0}, whose JVMs keep the image's trust" + LOG.warnv("Could not copy the Java trust store into container {0}, whose JVMs keep the image''s trust" + " store and will not trust Floci HTTPS: {1}", containerId, e.getMessage()); return false; } @@ -1225,7 +1225,7 @@ public class ContainerLifecycleManager { String[] env = imageConfig == null ? null : imageConfig.getEnv(); return Optional.of(env == null ? List.of() : List.of(env)); } catch (Exception e) { - LOG.warnv("Could not read the environment of image {0}, so the JVMs in its container keep the image's" + LOG.warnv("Could not read the environment of image {0}, so the JVMs in its container keep the image''s" + " trust store and will not trust Floci HTTPS: {1}", resolvedImage, e.getMessage()); return Optional.empty(); } diff --git a/src/main/java/io/floci/aws/core/common/docker/DockerDaemon.java b/src/main/java/io/floci/aws/core/common/docker/DockerDaemon.java index 40552c8caa..7137772804 100644 --- a/src/main/java/io/floci/aws/core/common/docker/DockerDaemon.java +++ b/src/main/java/io/floci/aws/core/common/docker/DockerDaemon.java @@ -23,7 +23,7 @@ public final class DockerDaemon { String os = dockerClient.infoCmd().exec().getOperatingSystem(); return Optional.ofNullable(os).map(value -> value.toLowerCase(Locale.ROOT)); } catch (Exception e) { - LOG.debugv("Could not read the Docker daemon's operating system: {0}", e.getMessage()); + LOG.debugv("Could not read the Docker daemon''s operating system: {0}", e.getMessage()); return Optional.empty(); } } diff --git a/src/main/java/io/floci/aws/services/acm/CertificateGenerator.java b/src/main/java/io/floci/aws/services/acm/CertificateGenerator.java index 4bab60f7e5..90162fe230 100644 --- a/src/main/java/io/floci/aws/services/acm/CertificateGenerator.java +++ b/src/main/java/io/floci/aws/services/acm/CertificateGenerator.java @@ -365,7 +365,7 @@ public class CertificateGenerator { // character, which the JDK rejects outright rather than resolving. Emitting it as a DNS // name keeps the name covered; dropping it would silently stop the server // serving that host, which fails a handshake with nothing to point at. - LOG.debugv("Could not parse '{0}' as IP address, treating as DNS name", san); + LOG.debugv("Could not parse ''{0}'' as IP address, treating as DNS name", san); return new GeneralName(GeneralName.dNSName, san); } } diff --git a/src/main/java/io/floci/aws/services/acm/model/KeyAlgorithm.java b/src/main/java/io/floci/aws/services/acm/model/KeyAlgorithm.java index 5538b9586a..e6d2437584 100644 --- a/src/main/java/io/floci/aws/services/acm/model/KeyAlgorithm.java +++ b/src/main/java/io/floci/aws/services/acm/model/KeyAlgorithm.java @@ -68,7 +68,7 @@ public enum KeyAlgorithm { return alg; } } - LOG.warnv("Unknown key algorithm '{0}', defaulting to RSA_2048", name); + LOG.warnv("Unknown key algorithm ''{0}'', defaulting to RSA_2048", name); return RSA_2048; } } diff --git a/src/main/java/io/floci/aws/services/cloudformation/CloudFormationService.java b/src/main/java/io/floci/aws/services/cloudformation/CloudFormationService.java index a61fc32188..605394306a 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/CloudFormationService.java +++ b/src/main/java/io/floci/aws/services/cloudformation/CloudFormationService.java @@ -1714,7 +1714,7 @@ public class CloudFormationService implements ResourceProvider { current.resolveNodeOmittingNoValue(props)); } catch (RuntimeException e) { LOG.warnv("Resolved create-only values of {0} ({1}) could not be compared; the update adds no " - + "replacement beyond the engine's own decision: {2}", logicalId, resourceType, e.getMessage()); + + "replacement beyond the engine''s own decision: {2}", logicalId, resourceType, e.getMessage()); return false; } } diff --git a/src/main/java/io/floci/aws/services/ec2/Ec2ContainerManager.java b/src/main/java/io/floci/aws/services/ec2/Ec2ContainerManager.java index fd40d228fa..e325994cc8 100644 --- a/src/main/java/io/floci/aws/services/ec2/Ec2ContainerManager.java +++ b/src/main/java/io/floci/aws/services/ec2/Ec2ContainerManager.java @@ -793,7 +793,7 @@ public class Ec2ContainerManager { return version; } } catch (Exception e) { - LOG.debugv("Could not read the Docker host's kernel version: {0}", e.getMessage()); + LOG.debugv("Could not read the Docker host''s kernel version: {0}", e.getMessage()); } LOG.warn("Docker host kernel version unknown; systemd guest launches without /lib/modules"); return null; diff --git a/src/main/java/io/floci/aws/services/ec2/Ec2Service.java b/src/main/java/io/floci/aws/services/ec2/Ec2Service.java index 878d6ae2ee..bd489db04f 100644 --- a/src/main/java/io/floci/aws/services/ec2/Ec2Service.java +++ b/src/main/java/io/floci/aws/services/ec2/Ec2Service.java @@ -1395,7 +1395,7 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab moved++; } } - LOG.infov("Moved {0} EC2 tag record(s) under their resource's region; kept {1} for instances not yet" + LOG.infov("Moved {0} EC2 tag record(s) under their resource''s region; kept {1} for instances not yet" + " restored; dropped {2} whose resource no region holds", moved, kept, dropped); } diff --git a/src/main/java/io/floci/aws/services/eks/EksClusterManager.java b/src/main/java/io/floci/aws/services/eks/EksClusterManager.java index 2bdc04d039..4ef307e54c 100644 --- a/src/main/java/io/floci/aws/services/eks/EksClusterManager.java +++ b/src/main/java/io/floci/aws/services/eks/EksClusterManager.java @@ -1458,7 +1458,7 @@ public class EksClusterManager return configured; } LOG.warnv("floci.services.eks.node-instance-type {0} is absent from the EC2 catalog; sizing EKS nodes " - + "from their node group's instance type", configured.get()); + + "from their node group''s instance type", configured.get()); return Optional.empty(); } @@ -1743,7 +1743,7 @@ public class EksClusterManager LOG.warnv("EKS cluster {0} (account {1}) starts under its account-qualified Docker name; " + "a pre-upgrade {2} named {3} survives but carries no verifiable owning account, " + "so it is NOT adopted. If its data belongs to this cluster, copy it into the " - + "cluster's qualified volume manually (docker volume inspect {3}).", + + "cluster''s qualified volume manually (docker volume inspect {3}).", cluster.getName(), cluster.getAccountId(), kind, legacy); } diff --git a/src/main/java/io/floci/aws/services/emrserverless/EmrServerlessService.java b/src/main/java/io/floci/aws/services/emrserverless/EmrServerlessService.java index ada395398f..864f4dcd2c 100644 --- a/src/main/java/io/floci/aws/services/emrserverless/EmrServerlessService.java +++ b/src/main/java/io/floci/aws/services/emrserverless/EmrServerlessService.java @@ -451,7 +451,7 @@ public class EmrServerlessService { throw new AwsException("InternalServerException", "The custom image " + imageUri + " could not be resolved: " + e.getMessage(), 500); } - LOG.infov("The custom image {0} has no digest in Floci's ECR ({1}), so each run resolves it: {2}", + LOG.infov("The custom image {0} has no digest in Floci''s ECR ({1}), so each run resolves it: {2}", imageUri, e.getErrorCode(), e.getMessage()); return null; } diff --git a/src/main/java/io/floci/aws/services/iam/WebIdentityTokenIssuer.java b/src/main/java/io/floci/aws/services/iam/WebIdentityTokenIssuer.java index 0b8ed46a30..2aded3f2f9 100644 --- a/src/main/java/io/floci/aws/services/iam/WebIdentityTokenIssuer.java +++ b/src/main/java/io/floci/aws/services/iam/WebIdentityTokenIssuer.java @@ -194,7 +194,7 @@ public class WebIdentityTokenIssuer { key.setPublicKey(Base64.getEncoder().encodeToString(pair.getPublic().getEncoded())); key.setPrivateKey(Base64.getEncoder().encodeToString(pair.getPrivate().getEncoded())); AccountAwareStorageBackend.putInAccount(keyStore, accountId, algorithm.name(), key); - LOG.debugv("Generated the account's {0} web identity token signing key", algorithm); + LOG.debugv("Generated the account''s {0} web identity token signing key", algorithm); return key; } catch (GeneralSecurityException e) { throw new IllegalStateException( diff --git a/src/main/java/io/floci/aws/services/lambda/launcher/ContainerLauncher.java b/src/main/java/io/floci/aws/services/lambda/launcher/ContainerLauncher.java index af31e83fd2..ea2b1b81be 100644 --- a/src/main/java/io/floci/aws/services/lambda/launcher/ContainerLauncher.java +++ b/src/main/java/io/floci/aws/services/lambda/launcher/ContainerLauncher.java @@ -398,7 +398,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher { // Mount host AWS config into Lambda container (read-only) for SDK credential discovery awsConfigPath.ifPresent(hostPath -> { if (!Files.isDirectory(Path.of(hostPath))) { - LOG.warnv("awsConfigPath '{0}' does not exist or is not a directory; " + LOG.warnv("awsConfigPath ''{0}'' does not exist or is not a directory; " + "Lambda containers may fail to discover credentials", hostPath); } specBuilder.withReadOnlyBind(hostPath, "/opt/aws-config"); diff --git a/src/test/java/io/floci/aws/services/lambda/WarmPoolTest.java b/src/test/java/io/floci/aws/services/lambda/WarmPoolTest.java index 6cf6235dd6..34f7e8e071 100644 --- a/src/test/java/io/floci/aws/services/lambda/WarmPoolTest.java +++ b/src/test/java/io/floci/aws/services/lambda/WarmPoolTest.java @@ -271,7 +271,6 @@ class WarmPoolTest { } finally { releaseSlowStop.countDown(); executor.shutdownNow(); - doNothing().when(containerLauncher).stop(slow); pool.afterReset(); pool.shutdown(); }