Commit Graph
29 Commits
Author SHA1 Message Date
Franklin G. Mendoza 2d51259120 feat(verifiedpermissions): add full service emulation (#3128)
* feat(verifiedpermissions): add full service emulation

* fix(verifiedpermissions): harden OIDC and schema validation

* test(verifiedpermissions): add service layer coverage

* fix(verifiedpermissions): support native Cedar runtime

* fix(verifiedpermissions): package Cedar native FFI

* fix(verifiedpermissions): register Cedar deserializers for native

* fix(verifiedpermissions): bound JWKS refreshes

* fix(verifiedpermissions): avoid Cedar entity reflection

* fix(verifiedpermissions): register Cedar native reflection

* fix(verifiedpermissions): refresh rotated OIDC keys safely

* fix(verifiedpermissions): retry failed JWKS refreshes

* refactor(verifiedpermissions): isolate Cedar in sidecar

* fix(verifiedpermissions): harden Cedar sidecar runtime

* fix(verifiedpermissions): build cedar sidecar in compatibility CI

* fix(verifiedpermissions): remove stale cedar jni config

* fix(verifiedpermissions): recover cedar sidecar

* fix(verifiedpermissions): bound OIDC document responses

* fix(verifiedpermissions): start cedar sidecar in native sdk CI
2026-09-10 22:25:50 -04:00
Niels Kootstra 051a2f09db fix(github-actions): continue Docker compatibility tests after failures (#3351)
* fix: report compatibility suite failures

* test: cover all compatibility suites after build failure

* test: run Docker failure aggregation in CI
2026-09-10 16:56:50 -04:00
Mario Toffia a501eabbf9 fix(docker): produce a working native image from Dockerfile.native (#3325)
* fix(docker): build the native image on arm64

Dockerfile.native compiles inside the Mandrel builder image and passed no
extra build arguments, so on arm64 the compile stage ended with
BranchTargetOutOfBoundsException. It was the only native build left in the
repository without -H:-AOTSingleCallsiteInline; the workflow native builds
have passed it since #3175.

That option inlines a method reached from exactly one call site whatever its
size. Each Query handler is reached from one switch case, each switch from one
handle(), and each handle() from the single AwsQueryController.dispatch call
site, so the generated REST invoker for dispatch grows to about 1.2 MB. An
aarch64 conditional branch reaches 1 MB and the aarch64 backend has no long
branch fallback, so the branch cannot be encoded. x86_64 reaches 2 GB, which
is why amd64 builds.

* fix(docker): copy libz into the native image so the runner starts

The builder image carries zlib as a shared library only, so native-image
links zlib dynamically and the runner needs libz.so.1 at run time. The
ubi9-micro runtime base does not ship it, so the image built from this
Dockerfile exited at once with "error while loading shared libraries:
libz.so.1". The build stage now copies the library across.

This is not architecture specific; amd64 has the same gap. The published
images are unaffected: their binaries are compiled on the CI runners, where
zlib is available as a static library and is compiled into the binary.
2026-09-09 18:19:15 -05:00
Hector Ventura a6bd0554a7 perf(docker): trim the compat image's CLI extras and Python build leftovers (#3108)
The AWS CLI v2 install ships 26 MB of `aws <command> help` example pages
that were never viewable in this image: help rendering needs groff or
mandoc and ubi9-minimal has neither, so `aws sqs help` already failed
before this change. Tab completion has no user inside a container either,
so aws_completer (9 MB), its ac.index database (21 MB) and the /usr/bin
symlink the installer creates go with it. The command reference the CLI
reads at run time (dist/awscli/data) stays.

pip and setuptools stay: the image documents pip and init hooks use it to
install packages. The system Python loses only build-time extras nothing
imports at run time: the optimised .pyc variants, lib2to3 and ensurepip
(removed with a python3 one-liner, ubi9-minimal has no find). awslocal's
mode is set in the COPY instead of a chmod layer.

Measured on arm64 on top of #3085: compat image 924 to 839 MB on disk,
214.0 to 197.7 MB gzip; /usr/local/aws-cli 264 to 209 MB. Verified: aws
2.36.24, `aws sqs list-queues` still resolves its model, pip3 installs a
package, boto3 1.42.97 import with json, ssl and sqlite3, awslocal, init
hooks calling all three, the container healthy in 5 s, and the four
endpoint-resolution checks compatibility.yml runs against this image.
2026-09-05 19:25:01 -05:00
TATSUNO “Taz” Yasuhiro 64f06e090f perf(docker): shrink image by 28% using ubi9-micro (109 MB to 78 MB compressed) (#3085)
* perf(docker): move the native image to ubi9-micro

The binary needs only libc, and since #3037 the entrypoint needs only
bash and coreutils. ubi9-micro has both at 7 MB compressed instead of
ubi9-minimal's 40 MB. Measured on arm64 with the nightly-09042026
binary: 109 MB to about 78 MB compressed, 313 MB to 229 MB uncompressed.

ubi9-micro has no useradd and no curl, so the user is one /etc/passwd
line and the healthcheck is a bash /dev/tcp probe. Dockerfile.native
gets the same runtime stage and loses its unused gosu tools stage.
Dockerfile.compat needs microdnf, so it now starts from ubi9-minimal
and copies /app out of the native image.

* chore(docker): share the health probe and split the compat tools stage

The bash health probe is now docker/healthcheck.sh, used by all three
Dockerfiles. Dockerfile.compat gets a version independent tools stage;
the aws CLI shim test and the cache warm job build target: tools, so
they pull no floci image and their cached layers stay stable. ARG
VERSION and the native RUN steps move so only the binary copy changes
between builds.

* fix(docker): copy healthcheck.sh into the compat image from the build context

* ci(compat): build the whole compat image on pull requests and check it starts healthy
2026-09-05 14:46:41 -05:00
Hector Ventura b0a8dff206 perf(docker): drop the gosu layer and two no-op native-image inputs (#3037)
The native image's tools layer installed shadow-utils, which ubi9-minimal
9.7 already ships, and downloaded a gosu binary: 19 MB on disk, 3.66 MB
compressed, byte-identical on every release since 1.5.34. The entrypoint
still starts as root and still grants the bind-mounted Docker socket's
group to the floci user, but through coreutils, which the base image has:
`chroot --userspec=1001:0 --groups=0,<socket gid> --skip-chdir /` drops to
uid 1001 with the socket's gid as a supplementary group. The group is
passed by number, so no /etc/group entry is needed, and --skip-chdir keeps
/app as the working directory where the relative ./data paths resolve. The
layer is now 24.6 kB (one useradd). The JVM Dockerfile drops its gosu
download too: the entrypoint is shared, so once it execs chroot nothing
there calls gosu. Floci's release and nightly pipelines never publish that
image; build-images.yml is a reusable workflow a fork invokes to publish its
own copy, and its noble base carries the same coreutils chroot flags.

Two inputs to the native build go with it, neither changing a byte:
--allow-incomplete-classpath and --report-unsupported-elements-at-runtime
have been no-ops since GraalVM 22.1 (Quarkus passes --link-at-build-time
itself, so a missing reachable class already fails the build), and the
brotli4j platform JNI jars are excluded from quarkus-rest-jackson because
Floci never enables Brotli compression and the jar was never embedded
(resource count unchanged at 197). A native build without them produces
the same 232.25 MB image and the same reachable set.

Verified on the arm64 image: uid=1001 gid=0; a socket owned by gid 999
yields groups=0,999 end to end; /app/data writable; argv fallthrough
intact; sdk-test-java compat suite 1,667/1,667 against the native image
with the socket mounted.
2026-09-04 22:30:28 -04:00
MakerYuichianddoraemon2200 9fda5f5919 fix(compat): install AWS CLI v2 in the compat image so AWS_ENDPOINT_URL is honored (#2315)
* fix(compat): shim aws to inject --endpoint-url from AWS_ENDPOINT_URL, add CI smoke test

* fix(compat): migrate to AWS CLI v2, drop the endpoint-url shim

---------

Co-authored-by: doraemon2200 <106516578+doraemon2200@users.noreply.github.com>
2026-08-16 20:26:56 -05:00
Alex BannaandAlexander Banna 5d61e95239 perf(lambda): reuse a populated code volume across restarts via a completion marker (#1827)
* perf(lambda): reuse populated code volumes across restarts

* test(dynamodb): retain Quarkus port for cleanup

* chore: rerun CI after download outage

* ci: retry transient gosu downloads

---------

Co-authored-by: Alexander Banna <abanna@users.noreply.github.com>
2026-08-13 16:27:37 -04:00
Jason van Zyl 42d94c62ee ci: add reusable JVM and native image publishing (#1936)
* ci: add reusable image publishing

Provide a workflow_call contract that builds native amd64 and arm64 artifacts and publishes native and compat multi-architecture images for an exact caller-selected source revision. Keep registry authority in the caller and return immutable digest references plus provenance for downstream tests.

* fix(docker): use glibc in JVM development image

Use an Ubuntu-based Java 25 runtime so the JVM image can host glibc-linked integrations while preserving the existing entrypoint, tooling, and architecture behavior.

* ci: publish JVM images by default

* fix(ci): harden reusable image builds

* docs(ci): clarify image registry input

* fix(docker): locate the installed AWS CLI

* fix(ci): tag images by build time and revision
2026-08-05 17:06:07 -05:00
Juri Duval 7ade290312 fix(dockerfile): ensure docker-java compatibility (#2096) 2026-08-03 23:43:09 -05:00
Liam MacPherson 9e90e5cff3 perf(docker): stop duplicating the native binary into a second image layer (#2069)
Both native Dockerfiles wrote the ~196 MB binary into the image twice. A RUN that
renames or chmods a large file rewrites the whole file into a new layer, so the
published image carried two copies of it:

    110 MB   ubi9-minimal base
    18.8 MB  microdnf install
    196 MB   COPY --chown=1001:root native/<arch>/ /app/
    196 MB   RUN mv /app/*-runner /app/application && chmod +x /app/application

Set the mode in the COPY itself and move the rename out of the image and into the
build pipeline, which now stages the binary as native/<arch>/application.
Dockerfile.native does the same with a single COPY --chmod=755 --from=build.

Measured on linux/arm64 against floci/floci:1.5.34, with a 196 MB binary on both
sides so the comparison is like for like:

    uncompressed   521 MB -> 325 MB
    compressed     168 MB -> 104 MB   (sum of gzip -6 layer blobs; Docker Hub
                                       reports 166.1 MB for 1.5.34)
    layers           8    -> 6

No behaviour change. The only filesystem difference in the resulting image is
quarkus-artifact.properties, now 0755 rather than 0644, because --chmod applies to
every file in the staged directory. /app and /app/data keep 0775 and uid 1001:0 for
arbitrary-uid (OpenShift) runs, and /app/application keeps 0755 — docker/entrypoint.sh
gates its default command on [ -x /app/application ].
2026-07-31 22:02:59 -05:00
Hector Ventura fe49bee41e fix(s3): fail fast on unwritable data root instead of opaque 500s (#1868)
When the persistent path is not writable (read-only or root-owned bind
mounts), S3Service's constructor failed lazily and every S3 request
surfaced as an opaque plain-text 500 that REST-XML SDK parsers cannot
read.

- validate the persistent path at boot and refuse to start with an
  actionable error when any enabled service uses non-memory storage
- add class-scoped exception mappers so unhandled failures on S3 and
  S3-Control routes render the S3 InternalError XML contract instead of
  Quarkus's plain-text error page
- warn loudly from the container entrypoint when the state dir is not
  writable by the runtime user

Fixes #1664
2026-07-15 00:43:11 -04:00
Hector Ventura fb546d54c4 fix(docker): enable TLS and sync docker test runner with compatibility workflow (#1714)
* fix(docker): enable TLS and sync docker test runner with compatibility workflow

The local docker compose stack ran without FLOCI_TLS_ENABLED and the EC2 mock,
and run-docker-tests.sh lacked the hot-reload bind mount, so the node TLS/WSS
suites and the Java Lambda hot-reload test failed locally while passing in CI.
Mirror the compatibility workflow's configuration so local runs exercise the
same setup.

* fix: remove FLOCI_SERVICES_EC2_MOCK from docker-compose

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-07-03 01:10:06 -05:00
Hector Ventura 68fc4134c4 fix(iot): deflake MQTT lazy-startup test, align 1.5.28 version, make compat runner executable (#1580)
* test(iot): wait for broker port release in MQTT lazy-startup test

Vert.x MqttServer.close() can resolve before the OS releases the listening
socket, so a connect immediately after stop() may still succeed. @BeforeEach
now polls until the port refuses connections before each test asserts the
broker is not listening, fixing the IotMqttLazyStartupIntegrationTest flake
under the full ordered suite that was failing CI on main.

* chore(release): set version to 1.5.28

Align pom.xml with the 1.5.28 release commit and CHANGELOG header; it had
been left at 1.6.0.

* ci: make run-docker-tests.sh executable

The compat test runner lacked the execute bit, so ./docker/run-docker-tests.sh
failed with permission denied (exit 126).
2026-06-26 01:35:39 -05:00
Hector Ventura b9da266b16 ci: build native compat image on runner and run full matrix against it (#1578)
Replace the in-container GraalVM build (docker/Dockerfile.native) with a
runner build via graalvm/setup-graalvm + Maven cache, using the -Ob quick
build (appended so application.yml native args are preserved). The prebuilt
binary is packaged through docker/Dockerfile.native-package, matching the
nightly/release pipeline. Both jobs run on ubuntu-24.04-arm.

Drop the JVM build/compat-test jobs and run the full 8-test matrix against
the native image (porting the compat-cdk Docker-socket case). Remove the now
orphaned docker/Dockerfile.jvm-package.
2026-06-25 19:09:11 -05:00
Jason van Zyl ad785f95f6 feat(ec2): add Java-built Ubuntu AMI guest image (#1542) 2026-06-25 00:33:15 -05:00
TomDav28andTomer David ed74698d48 fix(compat): pre-create localstack/floci init hook dirs (#1337)
Co-authored-by: Tomer David <tomer.david+catonian@catonetworks.com>
2026-06-14 09:51:26 -05:00
TomDav28 3b03b1363c fix(docker): fall back to the default command when entrypoint argv is empty (#1283) 2026-06-10 07:40:05 -05:00
Hector Ventura 3387d29346 fix: move all built to graalvm 25 (#1107) 2026-05-31 10:23:13 -05:00
Hector Ventura 0123844d83 chore(docker): add OCI image metadata labels (#872)
* chore(docker): add OCI image metadata labels

Add OCI image spec labels to Dockerfile.native-package, Dockerfile.jvm-package,
and Dockerfile.compat so published images carry standard metadata.

Static labels (title, description, url, source, licenses, vendor) are baked into
the Dockerfiles and are present in every build including local ones. Dynamic labels
(version, revision, created) are injected at publish time via the labels: input of
build-push-action in release.yml and nightly.yml.

Closes #851

* chore: setting not opencontainers labels
2026-05-17 00:25:24 -05:00
Hector Ventura c8c77c9e6e feat(s3): virtual-hosted style addressing support (#805)
*.s3.localhost.floci.io, *.localhost.localstack.cloud, and
  *.s3.localhost.localstack.cloud as virtual-hosted style regardless of
  FLOCI_HOSTNAME — fixes 405 when SDK uses endpointOverride("http://localhost:4566")
  without forcePathStyle (closes #801)
- EmbeddedDnsServer ships localhost.localstack.cloud and localhost.floci.io
  as built-in suffixes so spawned containers resolve these domains to Floci's
  IP without extra config
- Compatibility test S3VirtualHostStyleTest covers the full virtual-host path
  end-to-end; TestFixtures.s3VirtualHostClient() prefers s3.localhost.floci.io,
  falls back to s3.localhost.localstack.cloud, or uses FLOCI_S3_VHOST_ENDPOINT
  in Docker
- run-docker-tests.sh and compatibility.yml inject --dns <floci-ip> and
  FLOCI_S3_VHOST_ENDPOINT=http://floci:4566 into test containers
- S3 and migrate-from-localstack docs updated with virtual-hosted style details
2026-05-11 23:53:28 -05:00
Hector Ventura 9e35046647 Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml
* docs: sync with main and new features
* docs: reverting docker-compose.yml
2026-05-10 11:53:31 -05:00
5befe8b619 feat: optional TLS/HTTPS support with self-signed certificate generation (#754)
* feat: optional TLS/HTTPS support with self-signed certificate generation

- Add TlsConfigSource (MicroProfile ConfigSource SPI) that injects Quarkus
  TLS properties before the HTTP server starts
- Auto-generate self-signed certificates with correct SANs including custom
  hostnames from FLOCI_HOSTNAME and FLOCI_BASE_URL
- Persist certificate metadata for change detection across restarts
- Fix CertificateGenerator to encode IP addresses as iPAddress SANs (RFC 5280)
- Serve HTTP + HTTPS simultaneously (LocalStack parity)
- Support user-provided certificates via FLOCI_TLS_CERT_PATH/KEY_PATH
- Add TLS configuration documentation
- Add Node.js SDK compatibility test for HTTPS connectivity
- Add comprehensive unit and integration tests (79 test cases)

Closes #711

* feat(tls): add TLS proxy server and WebSocket-over-TLS tests

- Add TlsProxyServer: TCP proxy on port 4566 that detects TLS ClientHello
  and routes to HTTPS (4511) or HTTP (4510) backend accordingly
- Add apigatewayv2-websocket-tls.test.ts: WSS compatibility tests covering
  connect/disconnect, route selection, broadcast, authorization,
  @connections API, binary frames, and payload size limits
- Update CI workflow to enable FLOCI_TLS_ENABLED=true for compat tests
- Update sdk-test-node Dockerfile with NODE_TLS_REJECT_UNAUTHORIZED=0
- Update tls.test.ts for HTTPS SDK client tests
- Update README with WebSocket-over-TLS test documentation

* fix(tls): address review comments — LocalStack parity and floci.io SANs

- Add USE_SSL and CUSTOM_SSL_CERT_PATH mappings to localstack-parity.sh
- Add localhost.floci.io and *.localhost.floci.io to default certificate SANs
- Update affected tests and documentation

---------

Co-authored-by: Dixit R Jain <dixitrjain@Mac-379.lan>
Co-authored-by: Dixit R Jain <dixitrjain@Mac.lan>
2026-05-10 10:21:03 -05:00
Niklas Herder 97b08f62bc chore(docker): ship awslocal wrapper in the -compat image (#746)
* chore(docker): ship awslocal wrapper in the -compat image

bin/awslocal was added to the repo in #638 but is not COPYed into any of
the published Docker images. That makes existing LocalStack init scripts
mounted at /etc/localstack/init/ready.d/ — which overwhelmingly use
`awslocal kinesis …` rather than `aws --endpoint-url=… kinesis …` —
fail with "command not found" on the supposedly drop-in -compat image.

The script also needed an entry in .dockerignore: the file is allow-list
style ("*" + "!path") and bin/awslocal was not in the allow list, so it
never reached the build context. Without that line the COPY fails with
"file not found in build context".

Closes #744. The orthogonal SQS endpoint-resolver issue tracked in #745
is unaffected by this change — awslocal as written only exports
AWS_ENDPOINT_URL, which the bundled botocore silently ignores for SQS.

* fix(awslocal): pass --endpoint-url explicitly to honor hard-pin contract

LocalStack's awslocal idiom is "hard-pin the endpoint" — that's the whole
point of the wrapper. Setting AWS_ENDPOINT_URL alone is not sufficient:
the bundled aws-cli/1.44.87 + botocore/1.42.97 silently bypasses the env
var for SQS via service-specific endpoint resolvers, sending requests
to public AWS. With real credentials in CI/dev, that would silently
provision real SQS queues — surfacing as the InvalidClientTokenId error
documented in #745.

Inject --endpoint-url before "$@" so the user's own --endpoint-url (if
any) still wins via last-flag-wins. Verified: awslocal sqs create-queue
and list-queues now route to Floci; kinesis/s3 still work; awslocal env
subcommand unaffected; user override behaves correctly.

Addresses Copilot's review feedback on #746 and the awslocal arm of #745.
2026-05-08 07:48:21 -05:00
Leonid Bogdanov 5d51052a51 fix(docker): /etc/floci/aws/config missing in published Docker images (#740)
* fix(docker): /etc/floci/aws/config missing in published Docker images

* Address PR feedback
2026-05-07 22:23:30 -05:00
Hector Ventura 023880b7d9 feat(parity): LocalStack drop-in compatibility (#696)
- Translate LocalStack env vars (LOCALSTACK_HOST, PERSISTENCE, LAMBDA_DOCKER_NETWORK, etc.)
  to Floci equivalents automatically at startup; opt out with LOCALSTACK_PARITY=false
- Serve /_localstack/init and /_localstack/health alongside /_floci/* equivalents
- Report executed scripts with path, state, and return_code in /_floci/init response
- Add /_aws/sqs/messages GET (non-destructive peek) and DELETE (purge) inspection endpoint
- Add /_aws/execute-api/{apiId}/{stageName} LocalStack-compat path for REST API invocation
- Add four-phase init hook lifecycle (boot/start/ready/stop) with dual-path discovery
  (/etc/floci/init/ and /etc/localstack/init/ compat paths)
- Install Python 3, AWS CLI, boto3 in standard image; wrap aws binary to pre-configure
  --endpoint-url=http://localhost:4566 so init scripts need no extra flags
- Wire entrypoint.sh + gosu privilege drop into all Dockerfile variants
- Add migration guide and update README, docker-compose, docker-images, SQS, and
  initialization-hooks docs
2026-05-04 01:15:59 -05:00
Hector Ventura db9eedc4cd chore: fix dockerfile issue with argument parameter 2026-05-02 23:21:38 -05:00
Hector Ventura 3c98efe615 chore: new docker image tag and compatibility (#691)
* chore: new docker image tag and compatibility
* chore: change nightly workflow schedule time
2026-05-02 22:46:25 -05:00
Conor Heine 43e9ca18a0 fix(docker): make bind-mounted /var/run/docker.sock work on all hosts (#602)
The published images run as USER 1001 with primary group root. On Docker
Desktop (macOS/Windows) /var/run/docker.sock is owned root:root inside
containers so the floci process can open it via the group-0 bit, but on
native Linux Docker (and Rootless/Podman) the socket is owned by
root:<docker-group> with mode 660 — and the floci user is not a member
of that group. This silently breaks ECR, Lambda, and RDS service
emulation on those hosts: floci's docker-java client gets BindException
/ SocketException and reports CREATE_FAILED on AWS::ECR::Repository.

Fix: ship a docker/entrypoint.sh modeled on the docker-library/postgres
pattern. It starts as root, stats the bind-mounted socket to learn the
host's docker GID, ensures a group with that GID exists, adds the floci
user to it, then `exec gosu floci` re-execs the same script as uid 1001
with the supplementary group set. The 'if id -u == 0' guard means
downstream `user:` overrides in compose files keep working unchanged.

Verified end-to-end on native Linux (Pop!_OS, docker GID 999) using a
minimal CDK bootstrap repro: AWS::ECR::Repository goes from CREATE_FAILED
to CREATE_COMPLETE and the registry:2 sidecar comes up cleanly. pid 1
runs as Uid:1001 Gid:0 Groups:999.

Implementation notes:
- All three Dockerfiles keep their original base images
  (quarkus-micro-image, ubi9-minimal, eclipse-temurin alpine).
- Dockerfile.native gains a tools builder stage that uses the canonical
  Red Hat pattern (`dnf install --installroot`) to install shadow-utils
  into a stagable /toolsroot, which the runtime stage wholesale-copies
  into quarkus-micro-image. Image growth: ~42 MB (quarkus-micro has no
  package manager and lacks groupadd/usermod by itself).
- Dockerfile.native-package adds shadow-utils via microdnf (already had
  the package manager).
- Dockerfile.jvm-package adds shadow + ca-certificates via apk so the
  entrypoint can use the same useradd/groupadd/usermod syntax across
  all three image variants.
- gosu 1.17 is downloaded and SHA256-pinned (rather than GPG-verified
  as Postgres does) to avoid pulling gnupg2 into the runtime layers
  and to sidestep a gpgme dependency conflict in ubi9-minimal.
2026-04-25 14:09:11 -05:00