fix(lambda): fail an image function's init when Lambda's user cannot enter its working directory (#8047)

Closes #7979

Resolve symlinks on the working directory's path, relative or absolute,
and check every directory on the resolved path. Stop the check at a
function's EFS mount path, which Lambda enters as the access point's user.

Build the Dockerfile-only build context in one place,
DockerBuildContext.ofDockerfile, for the helper image and the two Docker
tests that built it by hand.

It created an application named test-app, which AppConfigIntegrationTest looks up by name when both run in one shard.
This commit is contained in:
Niels Kootstra authored and GitHub committed 2026-11-12 09:15:36 -04:00
1 parent 60252c9b7f
commit 17af8368b5
15 files changed
+544 -28

No files matched your search

+4
View File
@@ -1199,6 +1199,10 @@ A container image function whose `ImageUri` names an image already present on th
Container image functions (`"PackageType": "Image"`) that pull from private registries need Docker credentials. See [Docker Configuration → Private Registry Authentication](../configuration/docker.md#private-registry-authentication) for the full guide.
### Image user and working directory
AWS runs a container image function as its own least-privileged user, not the image's `USER`. Floci keeps running the container as the image's user, but before it starts the container it checks that Lambda's user could enter the working directory (`ImageConfig.WorkingDirectory`, or the image's `WORKDIR`). Lambda's user owns nothing in the image, so a directory on that path must be executable by other users. Symlinks on the path are followed, and the check stops at a file system the function mounts from EFS, which Lambda enters as the access point's user. When a directory is not executable by other users, such as a `0700` home directory owned by the image's user, the invocation fails with `Runtime.InvalidEntrypoint`, as on AWS. Set `WORKDIR` to a directory everyone can enter, such as `/`.
## Examples
```bash