fix(docker): stop the bundled AWS CLI fetching URL-valued parameters (#3426)

The image installs the AWS CLI with pip, which ships only v1, and v1 treats a parameter value
that looks like a URL as a pointer to fetch rather than as the value. awscli/paramfile.py reads
cli_follow_urlparam with a default of true, so an init hook in /etc/floci/init/ready.d putting
an SSM parameter such as MY_API_URL=https://example.com fails with "Unable to retrieve
https://example.com", and a hook that backgrounds its calls loses that silently.

AWS CLI v2 dropped the behaviour, so this never reproduces when the same script is run from a
host with v2 installed, only inside the image. Disabling the setting in the profile the image
bakes fixes it for every hook; setting it at runtime does not work, because aws configure set
writes to a root-owned file while hooks run after the entrypoint's privilege drop.

Mirrored into docker/Dockerfile.jvm-package, whose runtime stage is a copy of this one and is
pinned to it by DockerfileRuntimeParityTest.
This commit is contained in:
Anders Wasen authored and GitHub committed 2026-09-17 07:41:12 -05:00
1 parent b38a2c8c3b
commit bd005ac9c7
2 files changed
+12 -2

No files matched your search

+6 -1
View File
@@ -37,8 +37,13 @@ RUN set -eux; \
WORKDIR /app
# cli_follow_urlparam: the bundled CLI is v1 (pip ships no v2), where a parameter value that looks
# like a URL is *fetched* and its body used as the value. An init hook putting an SSM parameter such
# as MY_API_URL=https://example.com then fails with "Unable to retrieve https://…", and a hook that
# backgrounds its calls loses that silently. AWS CLI v2 dropped the behaviour, so this only shows up
# in the image, never when the same script is run from a host with v2.
RUN mkdir -p /app/data /etc/floci/aws \
&& printf '[default]\nendpoint_url = http://localhost:4566\n' > /etc/floci/aws/config \
&& printf '[default]\nendpoint_url = http://localhost:4566\ncli_follow_urlparam = false\n' > /etc/floci/aws/config \
&& chown 1001:root /app \
&& chmod "g+rwX" /app \
&& chown 1001:root /app/data
+6 -1
View File
@@ -36,8 +36,13 @@ RUN set -eux; \
WORKDIR /app
# cli_follow_urlparam: the bundled CLI is v1 (pip ships no v2), where a parameter value that looks
# like a URL is *fetched* and its body used as the value. An init hook putting an SSM parameter such
# as MY_API_URL=https://example.com then fails with "Unable to retrieve https://…", and a hook that
# backgrounds its calls loses that silently. AWS CLI v2 dropped the behaviour, so this only shows up
# in the image, never when the same script is run from a host with v2.
RUN mkdir -p /app/data /etc/floci/aws \
&& printf '[default]\nendpoint_url = http://localhost:4566\n' > /etc/floci/aws/config \
&& printf '[default]\nendpoint_url = http://localhost:4566\ncli_follow_urlparam = false\n' > /etc/floci/aws/config \
&& chown 1001:root /app \
&& chmod "g+rwX" /app \
&& chown 1001:root /app/data