mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
5da8045bb2ed954f4df652be2f2c38ae22c19150
54
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7cf443fcee |
chore: rename the package to io.floci.aws (#7689)
Move the Java sources from io.github.hectorvent.floci to io.floci.aws, matching io.floci.gcp, io.floci.az and io.floci.oci. Generated by tools/rename/rename_package.py apply on the base commit, with no other edits. Logger categories and the arn.fail-on-blank-region property move to the io.floci.aws prefix. The pom groupId becomes io.floci; the artifactId stays floci. Refs #6589 Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
89be5c1742 |
feat(lambda): make reactive S3 sync toggleable and optionally async (#6548)
* feat(lambda): make reactive S3 sync toggleable and optionally async, reporting LastUpdateStatus while it runs * fix(lambda): run async reactive S3 syncs as the uploader's account, keep InProgress continuous, and queue the latest source per function * fix(lambda): clear a failed reactive sync's LastUpdateStatus on UpdateFunctionConfiguration, and test async syncs from a second account * test(lambda): share LambdaCodeSourcesProfile for the async reactive sync test, reuse LambdaWebZips, and extract the failed-sync setup |
||
|
|
4d35617518 |
feat(lambda): add init-timeout-seconds so a cold runtime gets its own init budget (#6442)
* feat(lambda): add init-timeout-seconds so a cold runtime gets its own init budget * fix(lambda): count the init budget from container start, apply it only until the first /next poll, and cover it in SQS visibility * test(lambda): check the dispatch wait directly instead of on the clock, and correct the init budget docs |
||
|
|
ba353021e1 |
feat(sqs): publish AWS/SQS queue metrics to CloudWatch (#6280)
* feat(sqs): publish AWS/SQS queue metrics to CloudWatch Every active queue now reports the AWS/SQS metrics once a minute on the QueueName dimension: the depth gauges, ApproximateAgeOfOldestMessage, the send, receive, delete and empty-receive counters, SentMessageSize, and for FIFO queues the in-flight groups and deduplicated sends. The samples follow what SQS sends on AWS, so alarms, GetMetricData and GetMetricStatistics see queue metrics without PutMetricData. The CloudWatch metric store is now journaled under persistent mode, as the CloudWatch Logs event store is, since it takes a write per metric per active queue every minute. Closes #6275 * fix(sqs): stamp queue metrics with the minute that ended The publisher now ticks just after each minute boundary and stamps its samples with the minute that ended, so a call counts in the minute it was made instead of the minute of a startup-relative tick. A queue whose write fails no longer stops the others, and the log names it. A queue deleted and created again between the snapshot and the lookup is skipped instead of reporting the old queue's depth under the new one. * fix(sqs): bound AWS/SQS metric history and finish the tick on shutdown The publisher now drops AWS/SQS datapoints older than the 15 days AWS keeps one-minute data, once an hour, so the history it generates for an active queue stays bounded. On shutdown it stops before the storage flush and waits for a running tick, so the last minute is not written after the store closed. * test(sqs): keep the scheduled metrics tick out of the test run The acceptance test publishes its own ticks, but the scheduled one could still stamp the test queue's depth into a complete period newer than them, since a tick stamps the minute that just ended. floci.services.sqs. cloudwatch-metrics-enabled now turns the tick off, and the test configuration does, as it does for the S3 lifecycle sweep. It also lets a user opt out of the AWS/SQS metric volume. * test(sqs): build the metrics test's queue service with SqsServiceFactory |
||
|
|
691499d335 |
feat(sqs): opt-in AWS QueueUrl form via endpoint strategy (#5517)
* feat(sqs): opt-in AWS QueueUrl form via endpoint strategy FLOCI_SERVICES_SQS_ENDPOINT_STRATEGY=standard returns queue URLs in the AWS form, https://sqs.<region>.<dnsSuffix>/<account>/<name>. The default, path, keeps the current form. Every input form resolves under either setting. * fix(sqs): endpoint strategy accepts path or standard * refactor(sqs): queue URL forms are floci and aws, with shared round-trip tests * test(sqs): strategy names in tests and config comments read floci and aws * docs(sqs): list endpoint-strategy on the application.yml page The yml block and the env var table both list the setting, and the base-url comment names the aws strategy. |
||
|
|
98b2429e58 |
fix(ecs): launch a container with its linuxParameters, checked as RegisterTaskDefinition does (#5951)
* fix(ecs): launch a container with its linuxParameters, checked as RegisterTaskDefinition does
RegisterTaskDefinition kept a container's linuxParameters and
DescribeTaskDefinition returned them, but the container was launched
without any of them. A worker that set initProcessEnabled so its orphaned
browser processes would be reaped ran with its own command as PID 1, and
they stayed zombies until the container ended; capabilities, devices,
/dev/shm size, tmpfs mounts and swap limits were ignored the same way.
ECS documents each member as a docker run option, and the container is
now created with them: initProcessEnabled is --init (through
ContainerSpec.init, the flag main already has for it), capabilities are
--cap-add and --cap-drop, devices are --device (read, write and mknod when
no permissions are given, at the host path when no container path is),
sharedMemorySize is --shm-size in MiB, each tmpfs entry is a --tmpfs of
its size in MiB with its mount options, maxSwap is --memory-swap as the
container's hard limit plus that many MiB, and swappiness is
--memory-swappiness. ContainerSpec gains LinuxOptions for the rest,
applied in ContainerLifecycleManager's HostConfig; a constructor with the
former signature keeps every other caller unchanged.
A container behind a security group already had NET_ADMIN and NET_RAW
dropped, because the group is enforced by nftables in the namespace the
task's containers share. Docker applies a named --cap-add over a
--cap-drop, so those two are now also removed from what the container
asks to add; ALL can stay, since Docker grants every capability but the
dropped ones then (measured: docker run --cap-add ALL --cap-drop NET_ADMIN
--cap-drop NET_RAW reports CapEff 000001ffffffcfff, bits 12 and 13 clear).
Measured on RegisterTaskDefinition (eu-west-1, 2026-10-03 and 2026-10-16),
with the SDK's own validation off, and now checked the same way before
anything is stored:
- every capability must be one the KernelCapabilities reference lists, in
any case and without a CAP_ prefix ("Unrecognized Linux capabilities in
add: [CAP_NET_ADMIN]", likewise for drop);
- a device needs a hostPath ("Device cannot have empty hostPath") and only
read, write and mknod as permissions, as written ("Invalid permission:
READ for device /dev/null");
- a tmpfs mount needs a containerPath, a size above zero and options the
Tmpfs reference lists, as written ("The NOEXEC tmpfs mount option
specified is invalid.");
- sharedMemorySize must be above zero, maxSwap zero or more and needs a
swappiness ("When a container has a swap memory, it must also specify a
swappiness value."), from 0 to 100;
- the checks run capabilities, devices, tmpfs, then swap, all before the
Fargate rules;
- on Fargate a non-empty devices list, sharedMemorySize, maxSwap and
swappiness are refused in that order ("Fargate compatible task
definitions do not support devices", with no trailing period, unlike
AWS's other Fargate refusals), and any capability added but SYS_PTRACE
as written ("NET_ADMIN is not allowed on Fargate.");
- a swappiness without maxSwap is accepted and dropped, and capabilities
are stored with both an add and a drop list.
EcsLinuxParameters holds all of it, validation, the stored form and the
launch, and reads the members through one set of helpers, so EcsService
only calls it.
Not done: swap is not limited for a container with no hard memory limit,
since Docker cannot limit swap without one, and a daemon on cgroup v2
discards swappiness, as Amazon Linux 2023 does on ECS.
Tests: EcsLinuxParametersTest and ContainerLifecycleManagerLinuxOptionsTest
for what reaches Docker, EcsLinuxParametersDockerIntegrationTest for a
real container (PID 1, capabilities, device, /dev/shm, tmpfs),
EcsFargateEdgeCaseIntegrationTest for the measured refusals and the stored
form, and EcsLinuxParametersRegistrationTest in sdk-test-java for the
same through the SDK.
* fix(ecs): read linuxParameters as RegisterTaskDefinition does, and guard devices like host volumes
Review of #5951 (Qodo).
A device hands the container the host's hardware, and reached Docker with
no check, where a host volume at the same path is refused by default.
HostVolumePolicy now covers each device's hostPath too, naming the field
it checks: refused unless floci.services.ecs.host-volume-roots holds it or
allow-unsafe-host-volumes is set, at RegisterTaskDefinition after AWS's
own checks (so their messages still come first) and again at launch,
through EcsContainerManager.checkDeviceHostPaths. The registration check
sits in EcsService rather than beside the host volume one in
EcsJsonHandler, so a template's definition gets it too.
Measured with raw requests on RegisterTaskDefinition (eu-west-1,
2026-10-18):
- a member of the wrong JSON type is refused with an
InvalidParameterException from the deserializer, before any rule on the
values: "Unexpected field type" for a scalar where an object or a list
is expected, "Unexpected value type in payload" for a device or a tmpfs
mount that is not an object, "Start of structure or map found where not
expected" for an object where a list or a scalar is expected,
"NUMBER_VALUE cannot be converted to String", "STRING_VALUE cannot be
converted to Integer", "TRUE_VALUE ...", "NUMBER_VALUE cannot be
converted to Boolean", "Unexpected token received from parser" for text
that is not true or false, and no message at all for a list where none
is expected;
- numbers are read as integers, the fraction dropped (sharedMemorySize
1.9 is stored as 1, 0.5 as 0 and refused) and the range capped
(3000000000 is 2147483647); a boolean may come as text in any case; a
null member or list entry is absent, and a null device is an empty one.
Floci kept such values as written and silently skipped what it could not
read, so a definition stored one size and launched another. The stored
form now holds what AWS stores.
Tests: EcsFargateEdgeCaseIntegrationTest for every measured shape, the
stored numbers, booleans and nulls, and a device refused by default; the
Docker test allows /dev/null through host-volume-roots. All fail on the
previous head.
* refactor(ecs): check linuxParameters' JSON types against the vendored ECS model
Review of #5951. EcsLinuxParameters hand-wrote the deserializer's type
check member by member, where Floci already drives that check from
botocore for DynamoDB and SES v2 (RequestShapeModel, with the shapes
vendored by tools/aws/request_shapes.py).
tools/aws/regen_ecs_shapes.py vendors botocore's ECS model as
src/main/resources/aws/ecs-request-shapes.json (botocore 1.43.113, the
release requirements.txt pins), registered in make aws-data-sync and
aws-data-check and in the shared generator's tests. EcsRequestShapes
walks a container's linuxParameters against the LinuxParameters shape
with ECS's InvalidParameterException messages, the ones measured on
RegisterTaskDefinition; EcsLinuxParameters' own member list is gone.
The messages and their order are unchanged.
The device change named host volumes only in two more descriptions of
floci.services.ecs.host-volume-roots: docs/configuration/
environment-variables.md and the configuration table in
docs/services/ecs.md now name devices too, as does the host volume
section and the allow-unsafe-host-volumes Javadoc.
Tests: EcsRequestShapesTest for every measured message against the
vendored model; EcsFargateEdgeCaseIntegrationTest passes unchanged.
* refactor(core): walk request shapes once, with each service's messages
Review of #5951: EcsRequestShapes walked the vendored model the same way
DynamoDbRequestShapes and SesV2RequestShapes do (a null is absent, an
unknown member is skipped, a structure's values are read as members and a
list's or a map's as elements, a boolean reads from "true" or "false" in
any case, a scalar of the wrong kind is named by its JSON token), with only
the error code and a few messages apart. That walk is now
RequestShapeCheck, next to RequestShapeModel in core.common, and each
service hands it its deserializer's wording as RequestShapeCheck.Messages:
DynamoDB's SerializationException with DECIMAL_VALUE and the base-64
message for a blob, SES v2's SerializationException with its "can not be
converted to a" wording and only strings and blobs checked, as probed, and
ECS's InvalidParameterException with no message for a list where none is
expected.
The three services' tests pass unchanged. SES v2's wording becomes
constants in SesV2Json, which its member helpers and the walk share.
|
||
|
|
cbd2f61dc4 |
feat(s3): apply lifecycle expiration rules (#5158)
A bucket's lifecycle configuration was stored and returned but never evaluated. A background sweep now applies its expiration actions: - Expiration (Days, Date) deletes the current version of a matching object, or adds a delete marker in a versioning-enabled bucket. Day counts run from the last-modified time and round up to the next midnight UTC, as on S3. - ExpiredObjectDeleteMarker, and a Days or Date expiration once the marker is old enough, remove a delete marker with no other versions. - NoncurrentVersionExpiration (NoncurrentDays, NewerNoncurrentVersions) permanently deletes noncurrent versions, counting from when the next newer version was written. - AbortIncompleteMultipartUpload (DaysAfterInitiation) aborts uploads under a prefix-only filter. Filters are Prefix, Tag, ObjectSizeGreaterThan, ObjectSizeLessThan, an And of them, or the older rule-level Prefix. Disabled rules are skipped, versions under Object Lock retention or a legal hold are never deleted, and each bucket is swept in its owning account. Lifecycle deletions are notified as s3:LifecycleExpiration:* rather than s3:ObjectRemoved:*, with S3 itself as the requester, and their EventBridge reason is "Lifecycle Expiration". A rule S3 would have refused on put, such as Days 0, a size bound that is not a number or a Tag without a Value, is skipped as a whole, so a bad value never widens what a rule deletes. A body that is not one well-formed LifecycleConfiguration document has no rules. Each key is planned from one pass over its account's objects, then read again by its known store keys and applied under the bucket monitor. Lifecycle configuration changes and tagging now change under that monitor too, and a multipart upload is aborted only while its bucket and the rules are still the ones the sweep started on. Versions written in the same millisecond keep the order they were written in, for ListObjectVersions as well as for lifecycle. PutObject, GetObject and HeadObject on a current version that an Expiration rule matches return x-amz-expiration with the expiry date and the URL-encoded rule id. The sweep runs every 60 seconds by default, configured with floci.services.s3.lifecycle-sweep-enabled and floci.services.s3.lifecycle-sweep-interval-seconds. Transition actions are still not applied. Closes #5137 |
||
|
|
fb6adc00d8 |
feat(rds-data): opt into retryable database resume errors (#5703)
* feat(rds-data): opt into retryable database resume errors * fix(rds): keep lease release safe after timer shutdown * refactor(rds): share pause cancellation between acquisition modes * docs(rds-data): list resume errors in configuration references |
||
|
|
17c40cecbd |
fix(cognito): reject token validity outside AWS's limits (#5160)
* fix(cognito): reject token validity outside AWS's limits CreateUserPoolClient and UpdateUserPoolClient accepted any positive token validity, so a client with one-minute access and ID tokens, or a 20-minute refresh token, worked locally and failed on deploy. AWS allows access and ID tokens between 5 minutes and 1 day and refresh tokens between 60 minutes and 3,650 days, in each token's TokenValidityUnits unit (hours for access and ID tokens, days for refresh tokens, by default). A client outside them now fails with InvalidParameterException "Invalid range for token validity.", the message AWS returns. floci.services.cognito.enforce-token-validity-limits (env FLOCI_SERVICES_COGNITO_ENFORCE_TOKEN_VALIDITY_LIMITS, default true) turns the check off for tests that want tokens shorter than AWS allows. * test(scheduler): start recurring test schedules in the future Since #5610 a rate schedule's first occurrence is its creation time, so a schedule is due the moment it exists. The application's own dispatcher keeps ticking every 10 seconds during @QuarkusTest and sees every schedule, so a tick that lands between CreateSchedule and the test's own dispatcher fires the schedule once more than the test expects. Four tests create an enabled rate(1 minute) schedule and count exact deliveries: recurringScheduleStartsOneExecutionPerOccurrence, stepFunctionsDeleteScheduleStopsFutureOccurrence, rateScheduleDeliversEachOccurrenceWithItsScheduledTime and executionIdsDifferBetweenOccurrences. They now create the schedule through SchedulerTestHarness.createRecurringSchedule, which sets a StartDate a day ahead, and tick past it on their scoped dispatcher. The application's dispatcher skips a schedule before its StartDate, and the test profile and its tick interval stay as they are. * test(compat): poll OpenSearch domain readiness every 250 ms against Floci OpenSearchTest waited for the domain to finish processing in its own loop that slept 5 s between checks and swallowed InterruptedException. Floci flips Processing to false on its own 3 s readiness poll, so the test could sit up to 5 s past the moment the domain was ready. The wait now goes through TestFixtures.await, polling every 250 ms against Floci and keeping the 5 s cadence against real AWS, with the same 3 minute timeout. * fix(opensearch): run domain containers under an init process so a stop ends them at once The OpenSearch image's entrypoint is a bash script that starts the server as its child instead of exec'ing it. Running as PID 1, that script ignores SIGTERM, so every DeleteDomain, and every shutdown for each domain, waited out the whole 5 s stop timeout before Docker sent SIGKILL. The server never saw the SIGTERM either way. Domain containers now run under Docker's init process, which takes the SIGTERM and ends the container at once. Stopping a ready 2.11.1 container took 5.27 s (exit 137) without it and 0.26 s (exit 143) with it, and DeleteDomain in the compatibility OpenSearchTest took 5.3 s. The two startDomain tests' shared setup moves into one helper, which the new init test uses too. * fix(cognito): keep a RefreshTokenValidity of 0 at 30 days in any unit AWS replaces a RefreshTokenValidity of 0 with "the default value of 30 days". Floci stored the bare number 30 in the client's refresh token unit, so a client with RefreshToken=minutes issued 30-minute refresh tokens. With the token validity limits, any later UpdateUserPoolClient that left the validity alone re-checked that stored 30 minutes and failed with "Invalid range for token validity.", for a client Floci had accepted. A 0 now becomes 30 days in the client's refresh token unit (2592000 seconds, 43200 minutes, 720 hours or 30 days), on create and on update, and the limits check runs on that normalized value. Also imports UUID on a test line that spelled it out in full. * fix(cognito): reset the settings UpdateUserPoolClient omits to their defaults AWS: "If you don't provide a value for an attribute, Amazon Cognito sets it to its default value." The developer guide adds that an update with one parameter "sets all others to a default value". Floci kept the stored value of every setting the request left out, so a client could end up with a combination AWS never produces: an AccessTokenValidity of 60 kept from a minutes client, read in the hours of a units-only update, was refused as out of range, where AWS resets the validity and accepts. CreateUserPoolClient and UpdateUserPoolClient now build their settings in one place, with a new client's default for each one the request omits, and the update copies them onto the stored client. ClientName is the exception: the API documents no default for it, so an update without one keeps the name. The id, the secrets, the dates and the branding are not settings and stay as they are. An explicitly empty list still clears the setting. The AuthSessionValidity tests and the boto3 compatibility test that asserted the old keep-on-omit behaviour now expect the 3-minute default. * test: share one self-signed and one user-cert TLS profile across the TLS integration tests CustomDomainTlsIntegrationTest, TlsEnsureHostIntegrationTest, TlsHttp2HostRoutingIntegrationTest and EcrTlsDataPlaneDockerIntegrationTest each declared a self-signed TLS profile whose static block wrote its own CA-issued leaf before boot, and under @QuarkusTest that leaf is the one served. They now share SelfSignedTlsProfile, which writes one leaf for all four: the SANs TlsConfigSource uses by default, without 127.0.0.1, plus the API Gateway custom domain the HTTP/2 test routes to. The custom domain and ensure-host tests connect by IP and expect a name the leaf doesn't cover yet to be refused, and the JDK falls back to the peer address when the SNI name doesn't match, so a 127.0.0.1 SAN would let those handshakes through. The leaf and its metadata are written fresh every run, which also drops hostnames an earlier run learned at runtime, and the container CA bundle the ECR test relied on is written beside them. TlsIntegrationTest and TlsUserCertIntegrationTest declared the same user-provided certificate setup apart from paths. They share UserCertTlsProfile, which keeps the certificate file carrying its private key, since TlsUserCertIntegrationTest checks /_floci/ca.pem never echoes it. Both profiles live in the config test package, beside every class that uses them and the package-private default SAN list, and expose their paths as compile-time constants, so a test can read them without initializing the profile class and rerunning its static block under the running application. Sharing an application also means no class may leave anything behind for the next. TlsHttp2HostRoutingIntegrationTest now removes the bucket, CloudFront public key, key group and distribution, and the REST API, domain name and base path mapping it creates. EcrTlsDataPlaneDockerIntegrationTest deletes the manifest it pushes, TlsIntegrationTest its queue and TlsUserCertIntegrationTest its parameter. CustomDomainTlsIntegrationTest and TlsEnsureHostIntegrationTest already end with a state reset, which keeps the configured names from the profile's metadata, so neither changes the leaf a later class is served. The ECR test's registry container also outlived every run: keep-running-on-shutdown defaults to true and the test config never overrides it, and the next application to start adopted the container by name, a developer's own Floci registry included. SelfSignedTlsProfile now names it in the run's sidecar namespace, which SidecarContainersProfile exposes for this, and stops it at shutdown. The test checks for Docker through SidecarContainersProfile.requireDockerAndImage, so a registry a killed run left behind is removed like any other abandoned sidecar. Part of #4542. --------- Co-authored-by: Priamo <pgermosen@gmail.com> |
||
|
|
517409a7aa |
fix(cloudcontrol): bound the worker queue and reject overflow (#4479)
Replace the unbounded fixed thread pool with a bounded worker queue, sized by floci.services.cloudcontrol.create-worker-threads (default 4) and create-queue-capacity (default 64). These are Floci limits, not AWS quotas. A new CreateResource past them is refused with ThrottlingException, HTTP 400, which is the status the Cloud Control API reference gives it on CreateResource and in Common Errors. The pending token is dropped so it is not left unfulfillable. Startup replay of persisted CREATE requests does not apply that bound. When the worker queue is full, an already-accepted request is parked and handed to the executor by a daemon drainer once a slot frees, instead of blocking the request that constructs Cloud Control until a provisioning task finishes. Shutdown interrupts the drainer; parked requests stay persisted and replay on the next start. A create that fails while Cloud Control is shutting down is no longer recorded as FAILED. Shutdown interrupts in-flight provisioning, so the failure is the shutdown's: the request stays IN_PROGRESS and replays on the next start, like the queued and parked ones. Worker threads are now numbered. Narrow the persisted-state parse catch so a submission failure is no longer misreported as invalid JSON. Document the limit and both settings. |
||
|
|
9f224d9de6 |
fix(core): verify SigV4 header signatures for every service under validate-signatures (#5268)
* fix(core): verify SigV4 header signatures for every service under validate-signatures FLOCI_AUTH_VALIDATE_SIGNATURES verified signatures for S3 only, so SQS, KMS, IAM, Scheduler and every other service accepted a request signed with the wrong secret. SigV4HeaderSignatureFilter verifies the Authorization header of every request outside S3 and execute-api when the flag is on, rebuilding the canonical request from the request as it arrived and answering in the protocol the request used. Unsigned requests are left alone, and the default configuration is unchanged. The filter runs after matching so it can hash the body. The SQS queue-URL router now records the bytes it appends to a Query body, and the CBOR content type is read from the header that preserves it, so neither rewrite breaks a valid signature. With the flag on, an unknown or synthetic access key is now refused by every service, as S3 already refused it. Closes #5195 * fix(core): skip signature checks by matched resource, strip the spoofable content-type header The filter skipped any request whose credential scope named s3 or execute-api, so a caller could sign an SQS or KMS call under either and pass with the wrong secret, and S3 Control was never checked. It now steps aside only for the resources another verifier owns: S3Controller and the API Gateway execute controllers. AwsCborContentTypeFilter removes any client-sent X-Floci-Original-Content-Type, so a signed Content-Type cannot be swapped behind a forged copy. REST-XML services (Route 53, CloudFront, S3 Control) get XML errors. Header and scope parsing reuse SigV4AuthorizationHeader and CredentialScope, and the canonical request moves into SigV4Canonicalization, shared with ExecuteApiSigV4Authorizer. * fix(core): leave AppSync GraphQL signatures to AppSync's own check AppSync's GraphQL endpoint verifies IAM signatures itself and answers a failure with the UnauthorizedException envelope AppSync clients parse. With validate-signatures on, the header filter reached it first and answered with a JSON InvalidSignatureException. AppSyncExecutionController joins the resources the filter steps aside for. |
||
|
|
f074dd3c40 |
feat(lambda): allow per-runtime image reference overrides (#4552)
* feat(lambda): allow per-runtime image reference overrides * test(lambda): cover runtime image YAML configuration * docs(lambda): show quoted runtime image env key * test(lambda): verify quoted runtime image env key --------- Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com> |
||
|
|
1531537559 |
fix(docker): retry transient daemon I/O at the transport seam and split streaming pools (#4614)
Under fan-out load the single Docker socket drops connections mid-call (Broken pipe, Connection reset) and the operation fails. Split out of #2707. - Retry transient I/O at the transport: RetryingDockerHttpClient retries replay-safe control-plane calls with capped backoff (policy in DockerRetry). Interrupted I/O is not retried, except SocketTimeoutException, and the interrupt flag is kept. - Split log-follow streams onto their own @StreamingDocker client and pool (floci.docker.streaming-max-connections, default 512) so they cannot starve create/start/stop calls. Exec and wait streams stay on the main pool for now. - Adopt the container a replayed named create already made (409 matched by a per-attempt label) instead of failing and leaking it. Unnamed container creates, network creates, restart and network connect/disconnect are never replayed. - Retry tar copies at the call site with RetryingTarCopier (Lambda launcher, EC2 authorized_keys, EKS webhook kubeconfig and registries.yaml, MWAA); a local tar-writer failure is reported at once. - Send Connection: close on control-plane requests, since the Apache transport reuses pooled sockets the daemon has already closed (Podman). Hijacked requests and the streaming pool are unchanged. |
||
|
|
73b8c6124c |
feat(lambda): bound the warm pool globally with LRU eviction (#4683)
* feat(lambda): bound the warm pool globally with LRU eviction Adds warm-pool-max-per-function (replaces the hardcoded max(4, cpus)) and warm-pool-max-total (0 = unbounded). When the total would be exceeded, the least-recently-used idle container of any function is stopped before the released one is pooled, so the function that just ran keeps its container. Busy containers are not counted; their ceiling is region-concurrency-limit. WarmPool now takes a Clock so LRU order and the idle sweep are testable without sleeping. Closes #4682 * fix(lambda): warn when warm-pool-max-total is negative instead of treating it as unbounded Math.max(0, value) turned -1 into 0, the documented opt-out, so a mistyped cap silently restored the unbounded pool. Resolve it like warm-pool-max-per-function: a negative value is logged and the total stays unbounded. * docs(lambda): state the warm-pool peak bound per region region-concurrency-limit applies independently in each region while warm-pool-max-total is emulator-wide, so a single sum understated peak container count with more than one active region. Describe the cap as an idle-only, emulator-wide bound and the peak as the cap plus in-flight invocations across every active region. Also document that a negative value is ignored with a warning. * fix(lambda): do not stop a drained container again from the global cap eviction evictIdleBeyond snapshots each idle deque, then removes the chosen handles under the pool lock. drainEnvironment and drainFunction detach the deque from the pool and stop its contents themselves, so a drain between the snapshot and the removal left the eviction holding the orphaned deque: remove(handle) still returned true and the container was stopped a second time. Check the deque is still the live one for its environment before removing from it. |
||
|
|
8f904afa5a |
fix(s3): verify header and presigned POST signatures under validate-signatures (#4786)
* fix(s3): verify header and presigned POST signatures under validate-signatures floci.auth.validate-signatures verified only presigned URL signatures. A header-signed request or a presigned POST with a forged signature or an unknown access key was accepted unless enforce-auth was on, and enforce-auth also turns on bucket-policy evaluation, so there was no way to authenticate S3 requests without authorizing them. S3 verifies a signature before, and independently of, deciding from policies and ACLs whether the caller may act. validate-signatures now does the first step for every placement: S3HeaderSignatureFilter runs under either flag, and a browser POST that carries SigV4 form fields is verified. Bucket policies are still not evaluated, and unsigned requests are still left to enforce-auth, which decides anonymous access from policies and ACLs as AWS does. docs/services/s3.md now says what each flag verifies. * chore(s3): keep validatePresignedPostAuth's Javadoc on its method * docs(s3): clarify multi-account credentials under signature verification * docs(s3): update docs/configuration/multi-account.md Signed-off-by: Abhigya <abhigyakrishna21@gmail.com> --------- Signed-off-by: Abhigya <abhigyakrishna21@gmail.com> |
||
|
|
fa4d4663a2 |
feat(lambda): honour the Invoke Qualifier and wait between asynchronous retries as AWS does (#4733)
* feat(lambda): honour the Invoke Qualifier query parameter * feat(lambda): wait between asynchronous retries as AWS does A failed Event invocation now waits floci.services.lambda.async-retry-delay-seconds before its first retry and twice that before its second (default 60, matching AWS), capped at the event's remaining maximum age. The concurrency permit is held only for each attempt, and an emulator reset drops retries still waiting. * test(lambda): prove asynchronous retries end to end * docs(lambda): document asynchronous retry timing and the Invoke Qualifier * fix(lambda): drop retries of deleted functions and tighten async retry edges - Drop a pending asynchronous retry when its function (or version) was deleted. - Decide expiry once, on the injected clock, when a retry is scheduled. - Check the reset generation at routing, so no stale outcome is delivered. - Restore upstream behavior when an attempt throws: stop retrying and route the previous result, or UnknownError when there is none. - Harden tests: in-order permit release, deterministic reset, error types and an unqualified-ARN Qualifier case for Invoke. * fix(lambda): drop a deleted function's pending events on every path Replace the store lookup with a per-function deletion counter, captured when the event is invoked and checked wherever an event is attempted or routed. This covers the expiry path, which bypassed the old check, and a delete-and-recreate of the same name during the wait, which the lookup could not see. Verified against AWS that DeleteFunction drops pending retries without delivering a record. * fix(lambda): clear deletion counts before bumping the reset generation An invoke between the two statements of clear() captured the new generation with a stale deletion count and its event was dropped. The expiry-path deletion test now drops inside the first attempt, so it no longer races the one-second maximum event age. * fix(lambda): keep deletion counts across a reset Clearing them while the old generation was still current let a deleted function's pending event see a zero count and be routed. A reset now only bumps the generation, in one atomic step. * fix(lambda): drop an Event invoke that races DeleteFunction An Event invoke that resolved the function just before a concurrent DeleteFunction could take its deletion-count snapshot after the delete had already moved the count. The event then never looked stale, so the deleted function could still be started and a failure record could still reach its destination. DeleteFunction now moves the deletion count only after the function has left the store, and an Event invoke checks that the function is still in the store after it takes its snapshot and before it queues the event. Either the check sees the function gone and the invoke answers 202 without queueing anything, or the snapshot predates the count change and the event is dropped as stale later. * fix(lambda): validate the Invoke Qualifier query parameter Invoke treated an empty or blank Qualifier as if none had been given and ran $LATEST, and it passed a qualifier longer than 128 characters on to the lookup, which answered 404. AWS rejects both with a 400. A supplied Qualifier must now be 1 to 128 characters of letters, digits, $, _ and -, or Invoke fails with ValidationException. The controller reads the parameter from the raw query, because @QueryParam reports a present but empty value as null and the check could not see it. * fix(lambda): stop pending events before a delete or reset removes state DeleteFunction moved a function's deletion count only after it had removed the function's code and store entry. A retry whose timer fired in that gap still passed the staleness check, tried to start a function with no code, and could deliver a failure record to its destination. An attempt that finished in that gap could deliver its OnFailure record. DeleteFunction now moves the count before it deletes anything, which stops every queued or running event, and again after the store entry is gone, which stops an Event invoke that read the count in between. An emulator reset wiped storage before the executor's clear() moved the reset generation, so a retry firing during the wipe could run or deliver against half-cleared state. The executor now also moves the generation in beforeReset(), which runs before the wipe. clear() still moves it, to drop events accepted between the two. * test(lambda): fix a doc comment and name the tolerated Docker ping failure The class comment now reads "wait as they do on AWS". The Docker ping check names its caught exception "expected" and says why returning false is safe: the test is then skipped rather than failed. * fix(lambda): count version and alias invokes against the function's reservation Routing the Invoke Qualifier to a published version meant a qualified invoke took its permit against the version's snapshot, which carries no reservation, so a reserved concurrency of 0 on the function no longer throttled it and a positive one stopped counting those invokes. The name-qualified path (fn:1, fn:alias) already had the same gap. Reserved concurrency is function-wide in AWS, so the executor now takes the permit against the function's $LATEST record, which holds the reservation. That covers direct Invoke with a Qualifier, qualified names and ARNs, aliases, event source mappings and asynchronous retries alike. It reads the stored record rather than the limiter's region registry because event source pollers can invoke before LambdaService has rehydrated that registry after a restart. * fix(lambda): drop a deleted function's pending events before draining its containers DeleteFunction drained the warm pool before fencing pending asynchronous events, and draining blocks while idle containers stop. A retry whose timer fired in that window still passed the staleness check and could cold-start a container after the drain, leaving it warm for a function that no longer exists. The fence now goes up first. |
||
|
|
d73e33fe4b |
fix(ecs): pull task images at launch so a moved tag reaches the next task (#4583)
* fix(ecs): pull task images at launch so a moved tag reaches the next task Floci resolved an image reference to an image id the first time it saw it and reused that id for the life of the process, so a rebuilt :latest pushed to the registry never reached a new task, even through a new task definition revision and a forced deployment, and nothing reported the mismatch. ECS now pulls every container image when a task starts, before creating any of its containers, following the agent's ECS_IMAGE_PULL_BEHAVIOR (configurable as floci.services.ecs.image-pull-behavior, default "default": pull, and fall back to the cached image when the pull fails). The cached image is whatever the local tag names at launch rather than a remembered id. Each container reports the manifest digest it runs as containers[].imageDigest. * fix(ecs): create task containers from the image id their pull resolved to An overlapping RunTask could pull the same moved tag between this task's pull and its container creation, so the container was created from whatever the shared tag cache named by then while reporting the digest this task pulled. resolveForLaunch now returns the resolved image id with its digest, and ECS builds each container from that id, so the image a task runs and the digest it reports always come from the same pull. The pull also now uses the reference the container is created from, including floci.docker.image-registry-base, instead of the unprefixed name. * fix(ecs): launch image ids without a pull and report the digest the pull resolved A bare sha256 image id under always, or on the first once launch, went to the registry as if it were a repository reference and failed the task although the image was local. resolveForLaunch now runs an image id as it is, like ensureImageExists. The reported digest took the first RepoDigests entry for the repository, which is not necessarily the manifest the tag resolved to when the image holds more than one (an index and a platform manifest). It now comes from the Digest line the daemon streams for the pull, kept while the tag still names that image; a cached image falls back to its repo digest only when there is exactly one. The shared test config uses prefer-cached so the other ECS Docker suites stop adding a registry round trip per launch; the image pull integration test pins default in its own profile. ContainerBuilder imports are back in order. * fix(ecs): report a pull's digest only for the launch that pulled The digest a pull reported was kept per reference and reused while the tag still named the same image id, but on the classic image store an id is the config digest and several manifests can share it, so an outside pull could move the tag to another manifest and leave the reused digest stale. Only the launch that pulled now uses the streamed digest. A cached launch uses the image's repo digest for the repository when there is one, or the one equal to the id (the containerd store names an image by its manifest), and otherwise none. Also sorts the ContainerLifecycleManager imports. * fix(ecs): pull the image-pull test's busybox and registry from Docker Hub EcsImagePullDockerIntegrationTest pulled both images through the public.ecr.aws/docker/library mirror, whose anonymous quota is shared per runner IP; shard 3 failed on toomanyrequests: Data limit exceeded. Take them from TestImages like the other Docker-backed tests, pinning the registry image there, and prefetch both for the shard that runs the class. * test(ecs): name the registry readiness probe's tolerated exception expected |
||
|
|
be21e86057 |
fix(sqs): match AWS on stale, gone and invalid receipt handles (#4730)
* fix(sqs): reject empty, malformed and foreign receipt handles * fix(sqs): accept receipt handles of gone and re-received messages * fix(sqs): reject expired FIFO receipt handles * fix(sqs): reject receipt handles that were never issued * chore(sqs): parse receipt handles once and share the handle checks * fix(sqs): sign receipt handles with a configurable secret * test(sqs): merge the receipt handle error tests into one table * fix(sqs): give a message moved by a move task a new message id |
||
|
|
0bc85f3ef8 |
fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode (#4743)
* fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode GetCallerIdentity's root fallback, the AssumeRole family's session ARNs, the OIDC provider ARN and GetFederationToken built their ARNs with an empty region, which falls back to the commercial partition, so they carried arn:aws: whatever partition the request signed. They now go through RegionResolver.buildGlobalArn. GetAccountSummary reports GlobalEndpointTokenVersion only where the partition publishes a global STS host, which is aws alone. floci.partitions.strict (FLOCI_PARTITIONS_STRICT, default false) refuses a request signed for a service AWS publishes in another partition but not in the request's one (CloudFront in GovCloud, IAM in aws-eusc) with the unknown-service guard's 404, mirroring the host that never resolves on AWS. endpoints.json omits the services that ship only an endpoint ruleset, so a service the data lists nowhere is served everywhere. Credential scopes carry signing names, and 46 of them differ from the endpoints.json keys they cover (73 keys, such as ecr for api.ecr); regen_partitions.py vendors that map as signingNames and AwsPartition.offersSigningName joins it. Part of #4272 * fix(core): read the gzipped botocore models the pip package ships when collecting signing names The botocore wheel ships each service model as service-2.json.gz, while the checkout under local/aws/botocore ships it plain. collect_signing_names looked only for the plain file, so in CI, which resolves botocore to the installed package, it found no models, generated an empty signingNames and failed aws-data-check against the committed map. It now reads either form, as regen_dynamodb_shapes.py already does. * fix(sts): keep an assumed-role session in its role's partition, and answer strict-mode Query requests in XML GetCallerIdentity rebuilt an assumed-role session's ARN with an empty region, which falls back to the commercial partition, so a session AssumeRole issued as arn:aws-cn:sts:: came back as arn:aws:sts::, and a chained AssumeRole was then refused by a China trust policy as a caller from another partition. The session ARN now takes the partition its role ARN names. Strict partition mode refused a form-encoded Query request (IAM in aws-eusc) with a JSON body; it now returns the Query XML error the unknown-region guard beside it already returns for such requests. * fix(iam): mint IAM resource ARNs in the request's partition and keep them there CreateUser, CreateGroup, CreateRole, CreatePolicy, CreateInstanceProfile and CreateOpenIDConnectProvider minted arn:aws: whatever partition the request signed, while STS now followed the request. Under China that denied AssumeRoleWithWebIdentity (the trust policy names the arn:aws: provider ARN CreateOpenIDConnectProvider returned, matched against arn:aws-cn:), and AssumeRole reported the request's partition while GetCallerIdentity reported the role's. An IAM resource is now created in the request's partition and keeps it: UpdateUser and UpdateGroup re-mint in the stored ARN's partition. Anything derived from a stored role follows the role: all three AssumeRole handlers, resolveCallerArn and the web identity OIDC provider ARN take the role ARN's partition through AwsArnUtils.partitionOrDefault. The credential report's root row takes the request's partition. * fix(sts): mint a session from the stored role, and keep one credential report per partition AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML find the role by account and name, but minted the session ARN from the RoleArn the request named. A China role assumed with an arn:aws: RoleArn therefore came back as an arn:aws:sts:: session, while AssumeRole registered the session under the stored role's ARN, so GetCallerIdentity reported aws-cn. All three handlers now mint the session from the stored role's ARN when the role exists and register it under the same ARN. The credential report was cached once per account, so a report generated for one partition was handed to a caller in another for four hours, with the wrong partition's root row. It is now kept per partition. |
||
|
|
55d37cfc41 |
feat(ecs): let the startup container sweep be turned off, and derive the credentials proxy owner from the shared helper (#4696)
* feat(ecs): let the startup container sweep be turned off, and derive the credentials proxy owner from the shared helper The ECS startup sweep removes every task container carrying this deployment's floci_owner_port label, so two Flocis sharing a Docker daemon with the same API port and no resource namespace remove each other's task containers. EC2's sweep already has an opt-out; ECS now has the same one, FLOCI_SERVICES_ECS_RECONCILE_CONTAINERS_ON_STARTUP (default true). With it off, containers are left alone and tasks start at once. The recorded load balancer targets and Cloud Map instances are still released, since each Floci releases only what its own persisted state recorded. EcsCredentialsProxy.owner() now uses ContainerStorageHelper.ownerIdentity and OWNER_LABEL instead of its own copy of the rule. * fix(ecs): leave task-role credentials proxies alone when the startup sweep is off The credentials proxy removed every proxy carrying this deployment's owner label at startup regardless of reconcile-containers-on-startup. With the sweep off for two instances sharing an owner identity, the second instance's startup still tore down the first's proxy, and its running tasks lost their credentials endpoint. The proxy's startup reap now follows the same setting. |
||
|
|
49501acb5a |
feat(dns): transparent AWS endpoint interception for spawned containers (#4610)
* feat(dns): resolve amazonaws.com to Floci inside spawned containers when spoof-aws-endpoints is on SDK clients built with explicit real-AWS endpoints override AWS_ENDPOINT_URL and would otherwise escape to real AWS; off by default. * fix(tls): cover every region and S3 endpoint form in the spoof SANs The default-region-only SANs failed the TLS handshake for any other region. * fix(dns): warn when spoof-aws-endpoints is set where the TLS certificate cannot see it Startup logs a WARN when the flag is only in application.yml and TLS is on. * fix(dns): derive spoofed AWS suffixes and SANs from partitions Intercept every partition DNS and dual-stack suffix and name each region's certificate SANs under its own partition suffix, so China, EUSC and ISO endpoints are covered and cn-* regions are no longer named under the commercial suffix. Add the s3-control SAN, drop the lambda-url SAN (function URLs live under on.aws, which is not intercepted), and log the startup warning with LOG.warnv. * test(dns): name the new certificate tests as sentences * docs(dns): document every AWS partition suffix spoof-aws-endpoints intercepts The flag covers each partition's DNS and dual-stack suffix, not just amazonaws.com. List them in the config comments, env-var docs and EmulatorConfig javadoc, call out that live suffixes like api.aws and amazonaws.eu resolve to Floci, and use a single literal in the TLS visibility warning. Rename the certificate regeneration test to a sentence. |
||
|
|
cea6d3e99f |
fix(s3): journal the object index under persistent storage (#4642)
* fix(s3): journal the object index under persistent storage Under persistent mode every PutObject, CopyObject and DeleteObject rewrote s3-objects.json in full, and that file holds the metadata of every object in every bucket, so the cost of one write grew with the total object count (two rewrites per write on a versioned bucket). Create the object store with WriteProfile.APPEND_HEAVY, as CloudWatch Logs events already are: a change is appended to s3-objects.wal and the JSON file is rewritten on the WAL compaction interval and at shutdown. An existing s3-objects.json is read as the first snapshot. * fix(s3): journal both index entries of a current version's metadata update A versioned put indexes the new object under its version key and the latest key. Tagging, retention, legal hold, ACL and the SSE-C fields set on multipart completion wrote back only one of the two. With the object index journaled, each entry replays on its own, so a restart before compaction brought the other entry back with the old metadata. Write both entries when the update targets the current version. The restart tests now shut down every factory and replay a copy of the stopped process's directory, so no two writers share a journal. * test(lambda): stub the WriteProfile overload for S3 stores in the stream poller test * fix(s3): write object metadata under the bucket lock and the owner account A metadata update checked whether the latest key still pointed at the object and then wrote it without holding the bucket lock that puts and deletes take, so a concurrent delete marker or overwrite could be replaced by the object it had superseded. The check and both writes now run under that lock, and the latest key is written only while it still refers to the updated object. Multipart completion wrote the SSE-C fields back through the caller's account partition, so with the global bucket namespace a cross-account completion left a shadow latest entry and version in the caller's partition. It now goes through the same helper with the bucket owner's account. |
||
|
|
c326dce977 |
feat(dynamodb): optional DynamoDB Local backend (#4504)
* feat(dynamodb): add the external Local operation client Adds DynamoDbLocalClient, which forwards DynamoDB and DynamoDB Streams wire calls to an external DynamoDB Local over SigV4-signed HTTP/1.1. The caller's account becomes the access key and its region the signing region, so Local keeps each account and region apart. Requests are never retried. Reply.successBody now owns the AWS error body conversion, which the API stream reader reuses. * feat(dynamodb): add the DynamoDB Local backend Adds DynamoDbLocalBackend, a DynamoDbBackend that forwards every wire call to an external DynamoDB Local through DynamoDbLocalClient. - Namespaces: the caller's account and region select the Local namespace; table and stream ARNs from another account or region are rejected. - Identities: table, index and stream ARNs in replies are rewritten from Local's fixed ddblocal shape to public ARNs, and stream records carry the caller's region. - Metadata: tags live in a Floci store because Local keeps none; replica updates are refused; a global table is its single-region table; stream enable and disable are idempotent like native. - Lifecycle: startup waits up to 30s for Local to accept connections, and emulator resets are refused because the data lives outside Floci. DynamoDbBackend groups the four seam interfaces so one object is the whole engine. * feat(dynamodb): enable the optional Local backend floci.services.dynamodb.backend selects the engine: native (default) or local, which forwards to the DynamoDB Local at local-endpoint. Both engines are client proxies, so the unselected one is never constructed. With local selected, the stream reader keeps checkpoints for the life of the stream, and /_floci/info reports the backend in dynamodb_backend. DynamoDbLocalBackendIntegrationTest runs against a real DynamoDB Local when FLOCI_SERVICES_DYNAMODB_LOCAL_ENDPOINT is set. * docs(dynamodb): document the DynamoDB Local backend * fix(dynamodb): harden the Local backend endpoint check, stream paging and startup probe Reject AWS endpoints in every partition, with a trailing dot, and endpoints with user info. Translate ListStreams paging ARNs, retry any I/O failure until the startup deadline, and call DescribeTable outside the tag lock. * fix(dynamodb): tighten Local ARN ownership, batch table names and global TableId A table ARN of another account or partition is ResourceNotFoundException, a stream ARN of another partition is refused, and a batch naming one table twice is a ValidationException instead of a dropped entry. A global table on Local has an empty TableId instead of a random one. Document the Resource Explorer limit. * fix(dynamodb): mark the Local readiness probe region as partition-invariant * test(dynamodb): pin the table record of an untagged typed Local create * docs(dynamodb): state the Local readiness bound and stack delete protection * fix(dynamodb): lift deletion protection on the Local direct delete and cap the readiness probe - DynamoDbTableAccess.deleteTable is the direct engine delete with no deletion-protection check. The Local backend now clears DeletionProtectionEnabled before DeleteTable, so CloudFormation deletes behave the same on both backends. The wire DeleteTable still enforces it. - Each readiness probe is bounded by the remaining 30 second budget and never exceeds the configured request timeout, so startup fails within the budget. * fix(dynamodb): align Local tag errors with the native wire path - ListTagsOfResource on a missing table is AccessDeniedException, as on the native wire path. - A table ARN whose partition is not an AWS partition is a ValidationException instead of a foreign resource. - Tag operations report a table ARN of another region as ResourceNotFoundException, as native does; TableName fields keep the region-mismatch ValidationException. - Document which regions Resource Explorer searches, and note that a failed direct delete leaves deletion protection off. * docs(dynamodb): state the tested DynamoDB Local version |
||
|
|
76f8c09341 |
fix(docker): make the Docker client pool size configurable, default 1024 (#4276)
The shared DockerClient's connection pool was hard-coded to 100. Each live Lambda container holds two of those connections for its whole lifetime (the followed log stream and the exit watcher), so about 50 warm containers exhaust the pool. Create, start, stop and remove then wait for a free connection, including the idle-container stop that would release one, and the emulator stalls. Expose the size as floci.docker.max-connections (FLOCI_DOCKER_MAX_CONNECTIONS), reject values below 1, and default it to 1024 so that the 500-port Lambda runtime API range, not the Docker pool, is the ceiling on concurrent Lambda containers. Refs #2219, #2224 Co-authored-by: Goooooooooody <205637002+Goooooooooody@users.noreply.github.com> |
||
|
|
81e646b86d |
docs(ecs): document task-role credentials configuration (#4500)
The wiring landed in #4486 but none of the four FLOCI_SERVICES_ECS_TASK_ROLE_CREDENTIALS_* settings were written down anywhere, and nothing said the credentials proxy needs a user-defined Docker network rather than the default bridge. Adds them to the environment variable reference, the application.yml example and the ECS service page, the last with a short section on how the endpoint is reached and the two cases where a task does not get credentials: one that sets its own, and one under security-group enforcement. Also fixes two things the same work left behind in the source. The cleanupProtectedNetwork javadoc was orphaned when prepareTaskRoleCredentials was inserted between it and its method, and two config javadocs still described the wiring and the proxy as follow-up work. |
||
|
|
6fcfc0450a |
fix(core): refuse a SigV4 scope region that no AWS partition publishes (#4393)
* fix(core): refuse a SigV4 scope region that no AWS partition publishes
P2b of the multi-partition plan. RegionResolver.resolveRegionFromAuth took the
credential-scope label with no membership test, so polygondwanaland-west-1
became a region with its own storage namespace and its own ARNs. A label that
no partition publishes or admits by its regionRegex is now refused with a 400:
S3-signed requests get S3's XML AuthorizationHeaderMalformed ("the region '...'
is wrong", the S3 and minio wording), everything else InvalidSignatureException.
The pattern rule is the AWS SDKs' own, so a region launched after the vendored
data was refreshed (eu-south-9) is still served. moto
(MOTO_ALLOW_NONEXISTENT_REGION) and LocalStack (ALLOW_NONSTANDARD_REGIONS)
refuse the same way by default; floci.partitions.allow-unknown-regions
(FLOCI_PARTITIONS_ALLOW_UNKNOWN_REGIONS) restores the old any-label behaviour.
* fix(core): answer an unknown scope region in the caller's protocol, including presigned POST
A form-encoded request now gets a Query ErrorResponse instead of JSON, which Query SDKs cannot parse, and an S3 presigned POST's form credential is checked for an unknown region with S3's AuthorizationHeaderMalformed, as minio does.
|
||
|
|
0dd080a46f |
feat(core): partition foundation from botocore's published partition data (#4317)
P1 of the multi-partition initiative (#4272). tools/aws/regen_partitions.py vendors botocore's partitions.json and endpoints.json (8 partitions, 46 regions, the partition-wide endpoints with their signing regions) plus the CDK's opt-in and S3 website rules into src/main/resources/aws/partitions.json, checked by make aws-data-check. AwsPartition and AwsPartitions replace the hand-typed rules behind AwsRegions; RequestContext carries the request's partition from its SigV4 signing region; RegionResolver mints global ARNs in that partition and buildArn routes a blank region there; floci.partitions.id pins the deployment's partition behind a startup validator that refuses a contradiction with the default region. Behaviour a reviewer will see, all AWS-faithful: DescribeRegions follows the request's partition and the opt-in model (17 commercial regions by default, all 34 with AllRegions=true, RegionName.N filters, endpoints on the partition's DNS suffix); TLS SANs cover every published region; the EKS registry mirrors follow the deployment partition's regions. The partition-literal baseline drops by two. Part of #4272 |
||
|
|
a0cb86cc13 |
fix(cloudwatchlogs): journal log events instead of rewriting the store under persistent mode (#4187)
* perf(storage): append WAL batches once and skip compaction of an unchanged store A putAll batch was N locked appends and N flushes; it is now one contiguous run of records and one flush. Compaction rewrote the snapshot on every tick even when nothing had changed since the last one, so an idle store kept rewriting its file; the store now tracks whether it changed and compaction returns early otherwise. Entries replayed from the log at load mark the store changed so the next compaction folds them in. * fix(storage): recover from a corrupt WAL tail instead of failing boot The replay reader trusted the signed length headers it read: a negative length threw IllegalArgumentException out of load() and failed the owning service at boot, and a length past the end of the file read to EOF. After any stop, the writer reopened behind the unreadable bytes, so every entry appended after a torn tail was lost on the next load until a compaction happened. Lengths are now bounded by the bytes left in the file, every framing or decode failure stops replay with a warning, and the unreadable tail is cut off before the writer reopens. An unreadable snapshot is quarantined to a .corrupt sibling like the other file-backed stores do, instead of being overwritten by the next compaction. * fix(storage): journal append-heavy stores under persistent mode PersistentStorage rewrites the whole store file on every mutation, so the cost of a write grows with the store. A store can now declare an APPEND_HEAVY write profile on StorageFactory.create; under persistent mode such a store is backed by WalStorage with the store's own JSON file as the snapshot and a .wal file next to it. The snapshot layout means an existing store file is picked up as the first snapshot and the file is current again after a clean shutdown, so no migration is needed in either direction. The other modes ignore the profile. * fix(cloudwatchlogs): journal log events under persistent storage Every PutLogEvents batch rewrote the whole cwlogs-events.json file under persistent mode, so the cost of one batch grew with the number of stored events. The events store now declares the APPEND_HEAVY write profile: a batch is appended to cwlogs-events.wal and the JSON file is rewritten on the WAL compaction interval and at shutdown. Groups, streams, filters and policies keep the file that is rewritten on every call. Closes #2500 * docs(storage): describe journaled stores under persistent mode Explain that CloudWatch Logs events are journaled to cwlogs-events.wal under persistent mode, that the compaction interval now governs that store too, and that the JSON file is current after a clean shutdown and up to one interval behind while running. Also corrects the documented CloudWatch Logs flush interval default from 5000 to 15000, which is what EmulatorConfig ships. * docs(storage): describe journaled stores as append-heavy The pages said the CloudWatch Logs event store only ever grows, but the 20,000-event cap, retention pruning and DeleteLogStream all remove events. What qualifies a store for journaling is its write pattern, which is what WriteProfile.APPEND_HEAVY says, so the pages now say that. |
||
|
|
a3da2a3767 |
feat(rds): add SQL Server support to RDS (#3752)
* feat(rds): add SQL Server support * fix(rds): align SQL Server master handling * fix(rds): reject SQL Server DBName * fix(test): import Mockito matchers |
||
|
|
75d1c2ae62 | feat(lambda): support custom Docker flags (#3751) | ||
|
|
6ce3fbbd2e |
fix(cloudwatchlogs): bound stored events and enforce retention (#3611)
* fix(cloudwatchlogs): cap stored log events and enforce retention on ingest * docs(cloudwatchlogs): document max-stored-events and the slower log flush interval * fix(cloudwatchlogs): scope eviction to the ingesting account Use explicit account storage operations for retention and capacity eviction. * docs(cloudwatchlogs): note the stored-event ceiling applies per account * docs(cloudwatchlogs): document that the stored-event ceiling is best-effort under concurrent ingest |
||
|
|
1482d45b6e |
fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range (#3626)
* fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range A new queue reported MaximumMessageSize 1048576, four times the AWS default and above the AWS maximum, and nothing rejected an out-of-range value on CreateQueue or SetQueueAttributes. GetQueueAttributes with All also omitted SqsManagedSseEnabled, which AWS returns for every standard queue. Default max-message-size is now 262144, values outside 1024 to 262144 are rejected with InvalidAttributeValue, and All returns the AWS attribute set including SqsManagedSseEnabled (true unless KmsMasterKeyId is set). Raising FLOCI_SERVICES_SQS_MAX_MESSAGE_SIZE above the AWS maximum widens the accepted range with it, so the configured default stays settable explicitly. * fix(sqs): address review findings Cover the shipped default itself: ApplicationDefaultsTest now reads src/main/resources/application.yml and the EmulatorConfig @WithDefault, so reverting either one fails a test rather than passing on the explicit value in src/test/resources/application.yml. Report the MaximumMessageSize that SendMessage enforces. A queue persisted by a build that allowed 1 MB advertised a payload the send path would then reject; GetQueueAttributes and the size check now share parseMaxMessageSize, which also trims like the validation path does. Pin the SNS fan-out size boundary. SNS accepts a publish up to 262144 bytes and SQS accepts a message up to the same 262144, so a non-raw sqs subscriber whose notification envelope pushes the body past the limit is dropped with a warn. That mirrors AWS, and SnsSqsFanoutMessageSizeTest now holds it in place from both sides. Trim the InvalidAttributeValue message to the bare AWS form used elsewhere in the file. * fix(sqs): keep SqsManagedSseEnabled consistent when KmsMasterKeyId changes Creating a queue with a KmsMasterKeyId stored SqsManagedSseEnabled=false. That value outlived the key: clearing KmsMasterKeyId left the stored false behind, and the read path, which only fills the attribute in when absent, kept reporting managed SSE as disabled for a queue that no longer had a KMS key. Stop storing the derived value at all. CreateQueue no longer writes SqsManagedSseEnabled, so anything stored under that name is a value the user set, and it survives. GetQueueAttributes derives the answer on every read: a KMS key wins, an explicit setting stands, and a queue with neither reports the AWS default of true. There is no derived state left to go stale. AWS does not document crisply what happens to SSE-SQS when a KMS key is cleared, so returning to the default is a deliberate choice; the code and docs both say so rather than implying it is copied behaviour. * fix(sqs): raise MaximumMessageSize bounds to the AWS value of 1 MiB The previous commits on this branch set MaximumMessageSize to a default and maximum of 262144 bytes. That was wrong: it is SNS's Publish limit, not SQS's. AWS raised both the SQS maximum and the SQS default from 262144 to 1048576 bytes in August 2025, so the valid range is 1024 to 1048576 with a default of 1048576. Corrected AWS_MAXIMUM_MESSAGE_SIZE, the EmulatorConfig fallback, both application.yml files and the docs. The reject-out-of-range path in validateMaximumMessageSize is unchanged apart from its bounds, as are the SqsManagedSseEnabled derive-on-read behaviour and the DelaySeconds, ReceiveMessageWaitTimeSeconds, MessageRetentionPeriod and VisibilityTimeout backfills. Several tests had been shrunk to fit the wrong ceiling and are restored to the payload sizes they had before this branch. getQueueAttributes now stores an above-ceiling 2097152 so the clamp path stays covered, and a new test pins the ceiling itself: with a lowered configured maximum, a queue may still be set to 1048576, which the old constant rejected. Deleted SnsSqsFanoutMessageSizeTest. Its premise was that an SNS notification envelope reliably pushes a body past the queue's MaximumMessageSize, which no longer holds for the ordinary text it published: SNS caps a publish at 262144 bytes and SQS now accepts 1048576, so the envelope overhead alone does not cross the limit. The boundary has not disappeared, it has moved somewhere the test did not look. Because the envelope is serialized as JSON, escaping expands every control character below 0x20 to six bytes, and publish validates size without inspecting character classes, so a publish made largely of control characters can still overflow a 1 MiB queue. That case is untested; covering it needs a test built around the expansion rather than around envelope overhead. The SNS comment that asserted SQS shared the 262144 ceiling is corrected, and states the escaping caveat rather than claiming the envelope can never cross the queue limit. |
||
|
|
95079965a8 |
fix(ecr): enforce immutable image tags (#3009)
Route Docker Distribution traffic through Floci so repository mutability applies to manifest writes. Keep legacy registry storage reachable while moving public ECR endpoints to the guarded listener. |
||
|
|
126af73141 |
fix(ecs): enforce host-volume bind-mount safety fail-closed at register and run time (#3543)
* fix: enforce host-volume bind-mount safety fail-closed at register and run time Reject volumes[].host.sourcePath by default unless an operator opts in via floci.services.ecs.host-volume-roots or allow-unsafe-host-volumes. Block the Docker socket and any ancestor directory that contains it (/var/run, /run, /var) unconditionally, even with the unsafe flag set. Extract the check into HostVolumePolicy and enforce it again immediately before each bind mount in EcsContainerManager.startTask, not only once at RegisterTaskDefinition, to narrow the window for a swapped-in symlink and to cover task definitions persisted before this policy existed. * fix(ecs): protect the Docker socket Floci actually connects to The host-volume policy only blocked the literal /var/run/docker.sock and /run/docker.sock paths, so a task definition could bind-mount the daemon socket when Floci reached it through DOCKER_HOST or an active Docker context (Colima, OrbStack, Rancher Desktop, Podman). Resolve the daemon endpoint through the same DockerClientProducer path the Docker client uses and add its unix:// socket path to the protected candidates. The literal paths stay protected as defence in depth. |
||
|
|
0fce2d2407 |
fix(lambda): bound ZIP extraction resources (#3127)
* fix(lambda): bound ZIP extraction resources Limit Lambda ZIP compressed and expanded sizes and configurable entry counts for function and layer deployments. Preserve previous extracted code when a package exceeds a resource limit. * refactor(test): centralize ZIP fixture encoding * docs(test): explain ZIP fixture headers |
||
|
|
3c6c005ff1 |
feat(tls): a local root CA that signs Floci's server certificate (#3078)
* refactor(acm): one issuer-signing primitive in CertificateGenerator
buildCertificate always signed with the subject's own key. signCertificate now
takes the issuer DN and key explicitly; generateCaCertificate and
generateIssuedCertificate sit on top of it, with serverAuth or clientAuth EKU on
leaves. Existing public methods keep their signatures and output; metadata now
follows ACM: colon-separated hex serial and the certificate's real signature
algorithm in upper case.
* refactor(cloudhsmv2): sign emulated hardware certificates through CertificateGenerator
Deletes the private generateCert copy; the shared primitive also marks the two
CA levels of the chain as CAs, which the old code did not.
* refactor(acm): normalize imported certificate metadata and check issued key relationships
ImportCertificate now stores the serial as colon-separated hex and the
signature algorithm in upper case, the same shape generated certificates
report. generateIssuedCertificate verifies the leaf against the issuer's
certificate and refuses a supplied key pair whose halves do not match.
* refactor(acm): refuse a supplied key pair that is not of the requested algorithm
* refactor(acm): match a supplied EC key pair by named curve, not field size
* feat(tls): FlociCertificateAuthority, a persistent local root CA
Loads or creates {persistent-path}/tls/floci-root-ca.{crt,key} with an
owner-only key, signs serverAuth and clientAuth leaves through
CertificateGenerator, and regenerates with a WARN when the pair is corrupt,
expired, not a CA, or the key does not match the certificate. A CDI producer
exposes the same pair to beans, using the directory the config bootstrap used.
* feat(tls): issue the HTTPS server certificate from the local CA
The leaf is floci-server.{crt,key}, signed by floci-root-ca; a pre-CA
self-signed leaf, a leaf from a regenerated CA and an expired leaf are replaced
on boot. Published through quarkus.tls.key-store.pem.0.* so the TLS registry
owns it and can reload it. The server key is written owner-only.
* feat: serve the local CA at GET /_floci/ca.pem
TlsLocalCaIntegrationTest boots the HTTP server on the TLS registry keys and
completes a handshake trusting only the PEM this endpoint serves.
* fix(lambda): inject the local root CA into containers instead of the server leaf
The leaf will be reissued as SANs grow; pinning it would break after the first
reissue. The CA is stable.
* docs(tls): trust the local CA once instead of disabling verification
* feat(tls): create private key files owner-only and log why a CA was regenerated
* feat(tls): serve the user certificate from ca.pem in custom-cert mode, log the CA fingerprint
With floci.tls.cert-path set, GET /_floci/ca.pem returns that file, the same
file the Lambda launcher mounts, and creates no local CA. The CA's SHA-256
fingerprint is logged at startup so an out-of-band copy can be checked, and a
file system without POSIX permissions gets a WARN instead of a silent default.
* feat(tls): ca.pem is a bundle in custom-cert mode; clear the bootstrap directory on every boot
With a user-provided certificate the endpoint returns that file followed by
the local CA, so both the HTTPS endpoint and anything Floci issues validate
from one file. TlsConfigSource resets its resolved directory on construction
so a later boot in the same JVM with TLS off or a user certificate never
reuses a stale value.
* docs(lambda): drop two em-dashes from the CA trust javadoc
* test(tls): cover an expired leaf, an expired CA, a missing CA key and the producer's directory choice
* docs(tls): describe IoT device certificates as a follow-up of the local CA
|
||
|
|
23728e0b75 |
feat(ecr): prefer locally present images over the loopback registry rewrite (#3022)
* feat(ecr): prefer locally present images over the loopback registry rewrite EcrRegistryManager.rewriteImageUri rewrote every AWS-shaped <account>.dkr.ecr.<region>.amazonaws.com/<repo>:<tag> URI to Floci's loopback registry unconditionally, so a container image Lambda function (or ECS task) whose image was built locally and tagged with its real ECR URI could never run: the launcher started the registry:2 sidecar and tried to pull from it, failing with "failed to resolve reference ..." (Lambda.InitError) even though the daemon already held the image. The rewrite now first asks the Docker daemon whether the image exists under the URI as given; if it does, the URI is used unchanged and the registry container is not started. Images the daemon does not have keep the existing rewrite-and-pull path, so CDK DockerImageFunction flows are unaffected. floci.services.ecr.prefer-local-images (FLOCI_SERVICES_ECR_PREFER_LOCAL_IMAGES, default true) restores the old behaviour when set to false. Verified with a provided.al2023 Go image tagged 000000000000.dkr.ecr.ap-southeast-2.amazonaws.com/e2e/hello-image:local: Invoke fails on 2.0.1 and succeeds with this change, both with Floci as a host process and inside a container sharing the host's docker.sock; an image absent from the daemon still takes the rewrite path. * fix(ecr): inspect the image reference ContainerBuilder launches when preferring local images With floci.docker.image-registry-base set, rewriteImageUri inspected the bare AWS-shaped URI while ContainerBuilder later prefixed it, so a locally present image was reported as found and then missed at launch. Resolve the image through ContainerBuilder before asking the daemon so both paths agree. |
||
|
|
7fdd145c0c |
fix(lambda): honor configured function architecture (#2994)
* fix(lambda): honor configured function architecture * fix(lambda): isolate Docker images by platform * fix(lambda): reject unsupported architectures early * fix(lambda): require one function architecture Note: pre-existing full-suite flakes in EC2, Kinesis Analytics, and RDS Data passed in isolated reruns. * fix(lambda): preserve legacy architecture fallback * fix(lambda): reject malformed architecture fields * fix(lambda): reject invalid persisted architectures |
||
|
|
39b19d1c92 |
refactor(config): move max-request-size and ecr-base-uri into sub-mappings (#2902)
floci.max-request-size and floci.ecr-base-uri sat at the config root but belong with related settings. Relocate them: - max-request-size -> floci.protocols.max-request-size (ProtocolsConfig) - ecr-base-uri -> floci.services.lambda.ecr-base-uri (LambdaServiceConfig) A new FlociConfigRelocationsInterceptor (SmallRye ConfigSourceInterceptor, registered via META-INF/services) keeps the old flat keys and their FLOCI_MAX_REQUEST_SIZE / FLOCI_ECR_BASE_URI env vars working: the legacy key is consulted when the new key is requested, and iterateNames() rewrites it so config-mapping validation does not flag it as unknown. Future relocations are one entry in its RELOCATIONS list. ImageResolver, both application.yml files, the affected tests and the configuration docs are updated to the new keys. |
||
|
|
c90c5adfcb |
feat(lambda): code-signing endpoints and account settings (#2646)
* feat(lambda): GetAccountSettings with usage-derived account limits Adds the Lambda GetAccountSettings operation. AccountUsage (total code size and function count) is derived from the caller's stored $LATEST functions in the region; AccountLimit reports the configured regional concurrency limit and its unreserved share after per-function reserved concurrency. * fix(lambda): widen the default Runtime API port pool to 12000-12499 One Runtime API port is held for the lifetime of each running Lambda container, so the width of the range is a hard ceiling on concurrent Lambda executions. The old default of 9200-9299 gave 100, which a multi-account AWS Landing Zone Accelerator deployment exhausts: it fans out several custom-resource Lambdas per account and can want well over a hundred at once. Exhaustion did not announce itself as a capacity limit either. The custom resource reported FAILED and CloudFormation rolled the stack back, so an operator saw an apparently unrelated CloudFormation error with no hint that a port pool was the cause. 12000 rather than a widened 9200 because the old range's tail collides with ports floci and its sidecars already use: 9200 is OpenSearch's own REST port, 9400-9499 is the OpenSearch host-binding pool, 9092 is Kafka and 9644 Redpanda's admin port. Both application.yml and the @WithDefault annotation are updated. application.yml is a config source, not a set of defaults, so a value set there wins over the annotation; changing only the annotation would have been a silent no-op (issue #2225). The new test asserts the two agree, so they cannot drift apart again. Refs #2206 * fix(lambda): make the Runtime API port-pool exhaustion error self-describing The old message did not name the pool, its width, or the property that widens it. It also rarely reaches an operator directly: the Lambda failure surfaces as a custom resource reporting FAILED and CloudFormation rolling the stack back, so this text is buried in floci's own log alongside a CloudFormation error that looks unrelated. The message now carries its own diagnosis — which pool ran dry, how many ports it had, that one port is held per running container so this is the concurrent-execution ceiling, and the two properties that widen it. Previously the only way to learn those knobs existed was to find this class in the source. Refs #2206 * feat(lambda): add ListFunctionsByCodeSigningConfig Net-new endpoint, GET /2020-04-22/code-signing-configs/{arn}/functions, always returns an empty FunctionArns list since this codebase has no CodeSigningConfig management (no Create/PutFunctionCodeSigningConfig), so no function can ever actually have one attached. Implemented as its own controller class with its own class-level @Path("/2020-04-22") rather than folding it into the existing LambdaCodeSigningController (/2020-06-30): a JAX-RS class-level @Path is load-bearing for route-matching priority, and stripping it to share one class across two API-version prefixes causes both endpoints to fall through to a more general catch-all route elsewhere in the app. * fix(lambda): scope code storage, publish-version counters, and S3 sync-reload to the owning account CodeStore resolved extracted code to baseDir/<functionName> with no account segment, so two accounts' same-named functions in one region shared a single on-disk directory and overwrote each other's package -- while codeObjectKey already wrote the same package to an account-prefixed S3 key. Cross-account invoke resolves a function by the ARN's own account, so a collision here silently serves one account's code under the other's ARN. The PublishVersion counter was keyed region+"::"+functionName and the delete path removed that same unscoped key; both now key on the owning account, via the shared ownerAccount() helper the S3 key already used. onS3ObjectUpdated runs on the CDI event thread with no RequestContext, so its ambient scan only ever saw the default account's partition and its save wrote back into that partition. It now lists across every account (keeping the region and $LATEST filters) and saves into the function's own account. listAll(), whose only caller is the startup concurrency rehydration, is broadened the same way so a restart no longer drops non-default accounts' reserved concurrency. Recovered from 613db7bd1, re-derived onto upstream's current shape: CodeStore's methods are re-signed rather than overloaded (the unscoped forms had no remaining consumer), and the sync-reload uses a new region-filtered listAllAccounts() instead of widening listAll() at that call site. * fix(lambda): carry persisted version counters across the account-scoped key change The counter map is persisted precisely so a restart cannot re-issue a version number that already names a snapshot. Re-keying it on the owning account made every pre-existing entry unreachable, so the next PublishVersion on an upgraded deployment would have started again at 1 and overwritten the live :1 snapshot. The counter now adopts and clears the pre-account key on a miss, and deleting a function clears both forms. Also covers the widened listAll(): the reserved-concurrency pool is per region and shared across accounts, so the startup rehydration that feeds it has to see every account or a restart silently frees capacity that steady-state PutFunctionConcurrency had already accounted for. * fix(lambda): validate CodeSigningConfigArn on ListFunctionsByCodeSigningConfig The handler took @PathParam("codeSigningConfigArn") and never read it, so any input — including "not-an-arn" — got a 200 with an empty FunctionArns array. It also dropped the modeled Marker/MaxItems query parameters. Botocore models InvalidParameterValueException (400) and ResourceNotFoundException (404) for this operation, and carries a pattern on the CodeSigningConfigArn shape: arn:(aws[a-zA-Z-]*)?:lambda:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\d{1} :\d{12}:code-signing-config:csc-[a-z0-9]{17} (max 200 chars). That pattern is now applied verbatim, whole-string. The 404 for a well-formed ARN is a derivation, not an observation against real AWS: ResourceNotFoundException is modeled for this operation, the only resource the path parameter can name is a code-signing config, and Floci implements no CreateCodeSigningConfig / PutFunctionCodeSigningConfig — therefore every well-formed ARN necessarily names a config that does not exist. The previous always-empty 200 asserted the opposite (config exists, has no functions), which is the stronger and false claim. Validation order matches AWS: ARN shape, then MaxItems range (botocore MaxListItems: min 1, max 10000), then resource resolution — so a bad MaxItems is reported as such instead of being masked by the not-found. Marker is accepted and stateless: the result set is always empty, so no NextMarker is ever emitted. The pre-existing test asserted the 200-empty behaviour using an ARN whose csc- suffix was 9 characters, which the model's pattern rejects; it is replaced by six cases covering the two error classes and both MaxItems bounds. docs/services/lambda.md's two "always empty" claims are corrected to match. * docs(lambda): derive the operation count from the routed operations The branch adds two operations (GetAccountSettings and ListFunctionsByCodeSigningConfig) but bumped docs/services/index.md by one, 30 -> 31. Rather than hand-correcting to 32, the count was re-derived from the routes, because 30 could not be reconstructed from anything in the tree. index.md's own preamble states the rule for REST services: "the count reflects distinct AWS SDK operations, collapsing routes where one JAX-RS handler fans out via query-string or header markers". Counting JAX-RS methods across the Lambda controllers on upstream/main gives: LambdaController 24 LambdaConcurrencyController 3 LambdaEventInvokeController 5 LambdaLayerController 5 LambdaTagController 3 LambdaUrlController 4 -- 44 Two collapses applied. LambdaCodeSigningController's /2020-06-30 route and LambdaController's /2015-03-31 route are the same SDK operation (GetFunctionCodeSigningConfig) and count once. LambdaUrlInvocationController (5) and the lambda-package ApiGatewayController (5) are data-plane proxies with {proxy: .*} catch-alls, not Lambda SDK operations, so they are excluded. 44 + GetAccountSettings + ListFunctionsByCodeSigningConfig = 46. Corroboration that 44 is the real base and 30 is drift: docs/services/lambda.md's Supported Operations table lists 34 rows on upstream/main and omits exactly the 5 layer and 5 event-invoke operations — 34 + 10 = 44. Those 10 missing table rows are pre-existing and left alone here; only the count is in scope. * fix(lambda): match the current CodeSigningConfigArn pattern for isolated partitions The inlined regex predated the model's (eusc-)? prefix and widened -iso(b?) alternation, so a well-formed ARN in aws-iso-e/iso-f or the European sovereign cloud was rejected as malformed instead of reaching the modeled 404. * fix(lambda): validate FunctionName length, Role ARN, and Handler on config paths botocore models FunctionName up to 256 chars with dots allowed in the name segment; LambdaArnUtils rejected dots and never bounded length. Also close the gap where UpdateFunctionConfiguration accepted a malformed Role ARN or a whitespace-containing/oversized Handler and stored it verbatim. * fix(lambda): close leaked directory-listing streams and block dot-segment traversal in CodeStore Files.walk/Files.list returned streams that were never closed, leaking file descriptors and making delete() flaky on platforms that refuse to remove an open file. Separately, sanitizeName replaced disallowed characters but let a segment consisting entirely of dots (".", "..") pass through untouched, so an account or function name of exactly ".." resolved outside baseDir via Path.resolve instead of being rejected. * fix(lambda): reclaim pre-account-scoped code directories on delete and update A function created before code storage was account-scoped left its extracted code at <codePath>/<functionName>. DeleteFunction only ever targeted the new <codePath>/<accountId>/<functionName> path, and UpdateFunctionCode re-extracted to the new path without touching the old one, so the legacy directory (and its disk usage) lingered indefinitely after either operation. CodeStore now also clears the legacy path on delete, and re-extraction reclaims it on success. * fix(lambda): reject an explicit null Handler on UpdateFunctionConfiguration validateHandler treated null as "clear the handler", matching how Description is handled, but null is not a string at all -- and unlike Description, Handler names the file AWS invokes. A request with "Handler": null silently cleared it instead of failing with a 400, which would have broken every subsequent invocation of the function instead of the one bad request that caused it. * fix(lambda): do not reclaim a legacy code directory another account's function still uses The pre-account-scoped layout gave every account's same-named function the exact same on-disk directory. CodeStore.delete() and code re-extraction both reclaimed that legacy directory unconditionally once a function migrated to the account-scoped path, so a delete or code update in one account could destroy the legacy directory while another account's never-migrated $LATEST still served invocations from it -- its next cold start would then fail with a missing code directory. CodeStore.delete() no longer touches the legacy path at all; only LambdaService calls deleteLegacy() explicitly, after checking every account's $LATEST functions (via the existing cross-account listAllAccounts) for one still pointing its codeLocalPath at that directory. * fix(lambda): check published versions, not just $LATEST, before reclaiming a legacy code directory publishVersion snapshots codeLocalPath verbatim (required so a version-qualified invoke doesn't launch a container with no code, #1987), so a version published while $LATEST was still on the pre-account-scoped legacy path keeps that directory alive on its own after $LATEST migrates. The unused-check only scanned $LATEST records via listAllAccounts(region), so a later delete or code update reclaimed the directory out from under that published version's own future invokes. Switched to functionStore.listAll(), which has no $LATEST or region filter, matching the fact that the legacy path itself carries neither. * fix(lambda): close a publish-vs-legacy-cleanup race on the code directory publishVersion read codeLocalPath and persisted a snapshot of it with no synchronization against extractZipCodeBytes's/deleteFunction's decision to reclaim the pre-account-scoped legacy code directory (added in |
||
|
|
715bab68e7 |
feat(networkfirewall): emulate AWS Network Firewall (#2580)
* feat: emulate AWS Network Firewall
* docs: register Network Firewall service
* feat(networkfirewall): add AssociateFirewallPolicy
Sets FirewallPolicyArn on the stored firewall, validating that both the
firewall and the policy exist. Round-trip covered by an integration test
(create -> associate -> describe shows the new policy ARN).
FirewallPolicyChangeProtection is not enforced; documented as a limitation.
* docs(networkfirewall): register the generated action table
* docs(networkfirewall): correct the service matrix protocol and action count
The Network Firewall row claimed JSON 1.1 with 25 actions; the service speaks
x-amz-json-1.0 and the generated action table lists 27.
* test(networkfirewall): assert list membership instead of positional indexes
hasSize(1) and [0] assertions coupled these tests to JUnit's method order and
to being the only resource in the store.
* fix(networkfirewall): declare the storage key and mode in the service catalog
The service persists four backends through StorageFactory, but its descriptor
left storageKey and storageMode null, so it was skipped by PersistentPathValidator
and by per-service storage configuration.
* fix(networkfirewall): reject DeleteFirewall when delete protection is enabled
AWS raises InvalidOperationException rather than deleting a protected firewall;
the emulator deleted it regardless of the flag it had already stored.
* fix(networkfirewall): give the subnet and AZ association ops real semantics
All four routed through updateFirewall, which copies request fields onto the
stored firewall wholesale. That ignored SubnetChangeProtection and
AvailabilityZoneChangeProtection, and a Disassociate call left the mappings it
was meant to remove in place. Associate now adds deduplicated mappings,
Disassociate removes the named ones, and either is rejected with
InvalidOperationException while the matching change protection is set.
DescribeFirewall only synthesises endpoints for a firewall created without
SubnetMappings, so draining every subnet now reports no sync states.
* fix(networkfirewall): name the resource kind in ResourceAlreadyExistsException
createNamed passed the response wrapper field, so a duplicate create reported
"RuleGroupResponse already exists" instead of "RuleGroup already exists".
* fix(networkfirewall): validate association requests before touching the firewall
mappingsOf() creates the mappings array on the live stored node, so it ran
before the request array was validated: a rejected DisassociateSubnets on a
firewall created without SubnetMappings left an empty array behind and
permanently suppressed the synthetic sync states in DescribeFirewall.
* fix(networkfirewall): name the resource kind in ResourceNotFoundException
describeNamed passed the response wrapper field as the kind, so a miss reported
"RuleGroupResponse not found". Same defect as the create path; the now-unused
responseField parameter goes with it.
* fix(networkfirewall): return the deleted firewall and its status from DeleteFirewall
AWS responds with {Firewall, FirewallStatus}; the emulator returned only the ARN
and name, so an SDK client parsed an empty response. The handler already had the
region in scope, so no controller change was needed.
* fix(networkfirewall): enforce modeled enums on rule group Type and logging config
Three modeled enums were read and stored without being checked.
CreateRuleGroup/UpdateRuleGroup Type: the model enumerates STATELESS, STATEFUL
and STATEFUL_DOMAIN. The prefix choice was a two-way branch, so every unmodelled
value (including a lowercase "stateful") silently fell through to the
stateful-rulegroup ARN and was persisted as a rule group AWS would have
rejected. The branch keeps its meaning deliberately: only STATELESS gets the
stateless prefix, and both stateful variants share stateful-rulegroup, matching
AWS. A test pins STATEFUL_DOMAIN to that prefix so the mapping is no longer
implicit.
UpdateLoggingConfiguration LogType (ALERT/FLOW/TLS) and LogDestinationType
(S3/CloudWatchLogs/KinesisDataFirehose): the LoggingConfiguration is stored
verbatim, so an unmodelled or wrongly-cased value was persisted and echoed back
by DescribeLoggingConfiguration. Enforced case-sensitively, as the model spells
them and as LZA's network-firewall construct sends them.
Rejections use InvalidRequestException, which both operations list.
* fix(networkfirewall): validate association requests before mutating stored mappings
mappingsOf handed back the live stored array (or installed one), so a
request with a valid mapping followed by an invalid one mutated the
firewall before the rejection. The mappings are now a detached copy,
validated in full, and attached only when storeAndRespond commits.
* fix(networkfirewall): whitelist mutable fields on the shared UpdateFirewall* path
The generic update loop copied every raw request field onto the stored
firewall, so an UpdateFirewallDescription request carrying SubnetMappings
or AvailabilityZoneMappings persisted them without the change-protection
checks the Associate/Disassociate ops enforce. The loop now copies only
the union of fields the six UpdateFirewall* operations actually model
(Description, the four protection flags, EnabledAnalysisTypes), matching
AWS dropping unmodeled request members.
* fix(networkfirewall): scope UpdateFirewall* to the invoked op's own field
The shared updateFirewall path copied any field present in the raw
request that appeared in the union of all UpdateFirewall* mutable
fields, regardless of which specific action was invoked. A plain
UpdateFirewallDescription request could therefore smuggle
DeleteProtection (or any other operation's field) past its own
dedicated operation and change-protection checks.
Each UpdateFirewall* operation models exactly one mutable field
(botocore 2020-11-12); replace the shared whitelist with a per-action
field map so a request only ever mutates the field its own action
models.
* fix(networkfirewall): default DeleteProtection/SubnetChangeProtection/FirewallPolicyChangeProtection to true
botocore's network-firewall 2020-11-12 model documents CreateFirewall as
initializing these three flags to TRUE when the caller omits them;
AvailabilityZoneChangeProtection is the lone exception, documented as
defaulting to FALSE (already correct). Floci defaulted all four to false,
so the enforcement code in firewallForChange/deleteFirewall was correct
but unreachable in the common case of an SDK/Terraform caller that omits
the flags entirely.
RED-first: createFirewall_withoutProtectionFlags_defaultsToProtected
failed against the old defaults (DeleteProtection false, expected true).
Existing tests that relied on the old false default to exercise
mutation paths now pass explicit false for the flags they don't intend
to test, matching how a real caller opts out of protection.
NetworkFirewallIntegrationTest: 27/27 green.
* fix(networkfirewall): flatten UpdateFirewall* response to the modelled shape
All six UpdateFirewall* operations shared updateFirewall(), which returned
firewallResponse()'s nested {Firewall, FirewallStatus} envelope -- the
CreateFirewall/DescribeFirewall shape. botocore 2020-11-12 models each
UpdateFirewall*Response as a flat {FirewallArn, FirewallName, <field>,
UpdateToken}, confirmed for all six ops (UpdateFirewallDescription,
UpdateFirewallDeleteProtection, UpdateSubnetChangeProtection,
UpdateFirewallPolicyChangeProtection, UpdateAvailabilityZoneChangeProtection,
UpdateFirewallAnalysisSettings). A typed SDK client got null back from every
modelled accessor.
RED-first: updateFirewallDeleteProtection_returnsTheFlatModelledShape failed
(FirewallArn/DeleteProtection/UpdateToken were all null at the top level;
present one level down inside Firewall). CreateFirewall/DescribeFirewall
still use firewallResponse() and are unaffected -- only the six Update*
callers changed. NetworkFirewallIntegrationTest: 28/28 green.
* fix(networkfirewall): omit optional update fields instead of echoing null
UpdateFirewallDescription and UpdateFirewallAnalysisSettings read the response
member back with path(), so a firewall created without Description or
EnabledAnalysisTypes serialised the resulting MissingNode as an explicit null.
Both members are optional on these ops (botocore 2020-11-12 marks no required
members on either), so the response now omits what was never set.
* docs: correct service count to 79 after the #2579 merge
The upstream/main merge (
|
||
|
|
f912c3b717 |
feat(servicequotas,ram): add Service Quotas and AWS RAM resource sharing (#2579)
* feat(servicequotas,ram): add Service Quotas and RAM sharing stub
Two Landing Zone Accelerator pipeline prerequisites:
- servicequotas: ListServiceQuotas/GetServiceQuota (+ AWS-default
variants) over JSON 1.1 with curated real quota codes for codebuild
and lambda, deterministic generated quotas for other services, and
offset-token pagination
- ram: EnableSharingWithAwsOrganization returning {returnValue: true}
* feat(ram): model resource shares with the reads LZA's TGW share flow needs
RamController previously registered only /enablesharingwithawsorganization;
every other restJson1 RAM path fell through to S3's /{bucket} template route
and returned an XML error the LZA Lambdas' JSON parser choked on
(SyntaxError: Unexpected token '<'). Adds CreateResourceShare,
GetResourceShares (SELF vs OTHER-ACCOUNTS visibility incl. org/OU
principals), GetResourceShareInvitations (always empty — organization
sharing auto-accepts, matching real AWS), and ListResources with RAM
resource-type derivation.
* fix(ram): show every non-owned share to OTHER-ACCOUNTS callers
Launched-container credentials resolve to the emulator default account,
so LZA's Custom::GetResourceShare Lambda never matches an account-ID
principal check for the account it actually runs in. Principal-based
visibility hid IPAM pool shares from the accepting NetworkVpcStack while
org-ARN shares (TGW) passed, failing Network_VPCs. The Lambda filters
client-side by owningAccountId + name, so returning all non-owned shares
is safe.
* feat(servicequotas): add RequestServiceQuotaIncrease
Persists the requested increase and returns a RequestedServiceQuotaChange
the subsequent Get/List operations can read back. Limitations documented in
docs/services/servicequotas.md.
* fix(config): restore EmrServerless config body lost in rebase
The rebase onto upstream/main collided where both upstream and this branch
declare a new service config interface sharing a trailing body; the
EmrServerless interface was left open, so the file did not parse.
* fix(ram): persist resource shares
* feat(ram): add principal associations and resource-share lifecycle
* fix(test): conform RAM storage test doubles to upstream StorageFactory API
e9826026 introduced SharedStorageFactory overriding StorageFactory.create with
the pre-upstream return type StorageBackend<String,V>; upstream now returns
AccountAwareStorageBackend<V>. Matches the template used by upstream's own
CodeBuildServicePersistenceTest.
* fix(ram): restrict resource-share mutations to the owning account
Every mutating RAM operation resolved the share ARN with a global
all-accounts scan, so any caller holding an ARN could rename, retag,
associate resources into, or delete another account's resource share.
Thread the caller's account into the mutation paths and resolve the
share only within it; a non-owner now gets the same
UnknownResourceException an unknown ARN gets, matching AWS, which
resolves share ARNs inside the caller's account. Read visibility under
OTHER-ACCOUNTS is unchanged.
* fix(ram): return 400 SerializationException for a malformed request body
An unparseable body left readTree throwing UncheckedIOException, which
escaped the controller and surfaced as a 500 InternalFailure. Reject it
with the modeled restJson1 client error instead.
* fix(config): restore the bedrock-agent-core-control enabled flag
A rebase left the key with a null body in both the main and test
application.yml, silently dropping the service's enabled flag.
* docs(servicequotas): fix the docs path in the consumer test javadoc
* docs: correct the service count and the Service Quotas and RAM matrix rows
docs/index.md still claimed 75 services and listed RAM under JSON 1.1;
the canonical count in docs/services/index.md is 78 and RAM speaks
restJson1. Bring the Service Quotas row up to its five handled actions
and the RAM row up to its twelve REST operations.
* docs(tooling): acknowledge the RAM controller in the docs registry
RAM's action table is hand-written and carries a method-and-path column
the generator does not emit, so register it as a deferred handler rather
than a rest-mode source.
* test(ram): cover owner mutation over HTTP and pin the non-owner error message
The ownership checks were asserted only against the service; nothing
exercised the caller account the controller now threads through, so a
mismatch between the identity stamped at create time and the one
resolved at delete time would have gone unnoticed. Select the existing
SELF assertion by share name, since the store is shared across the
class.
* docs(ram): generate the action table from the controller
The RAM table was hand-written and only acknowledged in the docs
registry, so the drift sentinel could never fire on it. Fold the method
and path into each description the way the FIS REST controller's doc
does, add the generator markers, and register the controller as a
rest-mode source. Also record that mutations are owner-only.
* fix(ram): enforce the modeled resourceOwner enum on the share read paths
GetResourceShares, ListPrincipals and ListResources all read resourceOwner and
fed it to a two-way visibility fork: "SELF" meant owned shares, and literally
anything else meant OTHER-ACCOUNTS. The model enumerates exactly SELF and
OTHER-ACCOUNTS, so a caller who sent "self" or "OTHER_ACCOUNTS" was silently
handed the inverse of what they asked for rather than the InvalidParameterException
AWS returns — an error all three operations list.
Validated at the three entry points rather than inside the per-share visibility
check, so the rejection does not depend on the store being non-empty.
* test(ram): cover the resourceOwner enum rejection on the HTTP path
The service-level test proved the check; this pins the wire behaviour LZA
actually exercises. RamController substitutes "SELF" via asText("SELF") only for
an absent or null resourceOwner, so a present-but-unmodelled value — including a
non-string that Jackson coerces — must still reach the service and surface as a
400 InvalidParameterException on all three read routes. The absent case is
asserted to still return 200, so the default is not silently changed.
* fix(ram): stop exposing the contents of a deleted resource share
ListResources and ListPrincipals reported a deleted share's resources
as AVAILABLE to non-owning consumers. Both now skip DELETED shares,
while GetResourceShares keeps returning the share with DELETED status,
matching the retention window real RAM applies.
* fix(ram): reject a malformed GetResourceShareInvitations body
The endpoint ignores its body semantically, but malformed JSON is a
client error: it now goes through readTree and answers the modeled 400
SerializationException instead of 200 with an empty list.
* fix(ram): reject mutations on DELETED resource shares
A deleted share stays readable via GetResourceShares for the retention
window, but real RAM treats it as terminal: update, associate,
disassociate, tag, untag, and a second delete all raise
UnknownResourceException. findOwnedShare now filters DELETED so every
mutation path resolves a deleted share the same as an unknown ARN.
* fix(ram): apply the GetResourceShares filters and advance lastUpdatedTime
Four response-fidelity gaps from the maintainer review, interleaved in
the same two files:
GetResourceShares read only resourceOwner, so name, resourceShareArns
and resourceShareStatus were silently dropped and a caller narrowing by
share name got every visible share back. All three are applied now, and
an unmodelled resourceShareStatus is rejected with
InvalidParameterException the way resourceOwner already is.
lastUpdatedTime never advanced: ResourceShare had no such field and
creationTime was echoed in its place, on the share node, on the
association rows, and on ListPrincipals. The field now exists and is
stamped in putForOwner, the single seam every create and mutation
already passes through. State written before the field existed reads
back with creationTime, which is correct for a share never mutated
since.
Shares also report the modeled featureSet (STANDARD — floci has no path
to produce a policy-derived share), and DeleteResourceShare echoes the
clientToken the caller sent, both of which the model carries.
* docs(ram): record the filter support and the unrouted-operation behavior
* fix(ram): require resourceOwner on the share read paths
GetResourceShares, ListPrincipals and ListResources all substituted
SELF for a missing resourceOwner, which the model marks required. That
answered a question the caller never asked, and answered it with the
caller's own shares rather than an error. All three now pass a missing
or null value to the validator that already rejected unmodelled ones,
so it surfaces as InvalidParameterException.
* docs(ram): name GetResourceShareAssociations in the fall-through note
Per review, the unrouted-operation note is more useful if it names the
operation Terraform's association resources read on every refresh, and
says the symptom is an S3 NoSuchBucket XML body rather than a
credentials problem.
* fix(ram): reject trailing tokens after a valid JSON body
Jackson's default readTree stops at the first complete value, so a body
like "{} not-json" parsed as an empty object and the request executed
instead of returning the modeled 400 SerializationException. Read with
FAIL_ON_TRAILING_TOKENS, the convention the JSON 1.0/1.1 controllers,
FIS, Signin and EventBridge already follow.
* fix(servicequotas): validate the ServiceCode shape
ServiceCode was only checked for emptiness. Because an unknown code
deliberately generates a quota catalog, that meant a caller typoing
"!!!" got three invented quotas back instead of an error. Validate
against the modeled [a-zA-Z][a-zA-Z0-9-]{1,63} and 63-character cap;
unknown-but-well-formed codes keep generating as before.
|
||
|
|
943b4c1b45 |
feat(efs): add Elastic File System (file systems, mount targets, access points) (#2371)
* chore(efs): initialize service structure * feat: implement EFS service models for file system and mount target management * feat(efs): implement EFS metadata service emulator This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API. - Scaffolded and generated EFS DTO models with Jackson PascalCase mapping Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies Created EfsController for all mapped REST-JSON routes under /2015-02-01 Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle Created EFS service documentation in docs/services/efs.md * feat(efs): implement EFS metadata service emulator This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API. - Scaffolded and generated EFS DTO models with Jackson PascalCase mapping - Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies - Created EfsController for all mapped REST-JSON routes under /2015-02-01 - Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog - Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle - Created EFS service documentation in docs/services/efs.md * fix(efs): address code review comments - Fixed describe listings to be appropriately region-scoped - Ensured idempotency token caching for AccessPoint and FileSystem creations - Altered creation timestamps to use standard epoch seconds * fix(efs): register models for reflection to satisfy native-image requirements * fix(efs): resolve remaining review comments and add documentation - Prevented file system deletion when mount targets exist - Cleaned up policies and access points upon file system deletion - Validated parent file system exists during Access Point creation - Added proper logging for tolerated exceptions during mount target deletion - Created missing documentation page docs/services/efs.md * fix(efs): prevent deletion races by locking on file system ID Wraps all state-mutating operations on file systems and their dependent resources in synchronized blocks keyed by the file system ID. This guarantees that CreateMountTarget, CreateAccessPoint, and similar operations cannot race with DeleteFileSystem, satisfying the Greptile review for P1 Deletion races dependent creation. * fix(efs): resolve additional concurrency bugs identified by Greptile - Prevents duplicate access point creation when concurrent requests reuse the same ClientToken across different file systems by adding a dedicated token lock. - Prevents resurrection of deleted mount targets by wrapping modifyMountTargetSecurityGroups and deleteMountTarget in target-specific locks. * fix(efs): enforce idempotent parameter matching for access points * fix(efs): enforce parameter matching for idempotent creation requests - Compares all parameters in CreateFileSystem (PerformanceMode, ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps) when CreationToken matches - Compares all parameters in CreateAccessPoint (FileSystemId, PosixUser, RootDirectory) when ClientToken matches - Throws IdempotentParameterMismatch if parameters differ on a retried token, satisfying Greptile bot review * fix(efs): enforce idempotent parameter matching for nested access point fields - Compares PosixUser.SecondaryGids - Compares RootDirectory.CreationInfo (OwnerUid, OwnerGid, Permissions) - Throws IdempotentParameterMismatch if nested parameters differ on a retried token, satisfying Greptile bot review * fix(efs): enforce idempotent parameter matching for default field omission and tags - Treats null PerformanceMode as 'generalPurpose' for equality checks - Treats null ThroughputMode as 'bursting' for equality checks - Treats null Encrypted as false for equality checks - Strictly compares tag lists in both CreateFileSystem and CreateAccessPoint - Throws IdempotentParameterMismatch if these differ on a retried token, satisfying Greptile bot review * fix(efs): override equals and hashCode on Tag model to enable correct idempotency comparison - Resolves issue where identical tag values on retries were evaluated as mismatched due to object identity comparison - Satisfies Greptile bot review for Tag idempotency checks * fix(efs): enforce idempotent parameter matching for AvailabilityZoneName and Backup settings - Persists AvailabilityZoneName (and derived ID) on the FileSystem during creation if supplied - Implicitly creates an ENABLED/DISABLED BackupPolicy during CreateFileSystem to match AWS default behavior - Compares AvailabilityZoneName on retry - Evaluates Backup request flag against stored BackupPolicy status - Satisfies final Greptile bot review for missing idempotency parameters * fix(efs): evaluate creation-time backup configuration rather than current mutable policy during retries - Adds originalBackupParameter to FileSystem model to immutably capture the configuration at creation time - Refactors idempotency check to evaluate this stored value rather than querying the potentially modified live BackupPolicy - Addresses Greptile P1 defect where PutBackupPolicy broke CreateFileSystem retries * fix(efs): resolve backup retry snapshot persistence across emulator restarts - Replaces @JsonIgnore FileSystem property with a dedicated originalBackupStore - Ensures the original backup parameter is properly persisted and reloaded from disk - Maintains AWS API contract fidelity while preventing IdempotentParameterMismatch on restarts * fix(config): resolve EmrServerless and EFS configuration syntax * fix(efs): prevent stale mount targets by deleting them inside the file system lock * fix(efs): correct file-system policy endpoint path to singular /policy * fix(efs): apply query string filters correctly for describe operations * fix: align EFS emulator with AWS specifications - Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint - Implement modern TagResource, UntagResource, and ListTagsForResource APIs - Dynamically resolve regions and ARNs via RegionResolver - Detect mount target subnet conflicts and dynamically resolve AZs - Remove unused obsolete EFS model classes - Ensure UpdateFileSystem returns 202 Accepted status code * docs: generate EFS action table from controller Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list. * fix: align EFS emulator with AWS specifications - Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint - Implement modern TagResource, UntagResource, and ListTagsForResource APIs - Dynamically resolve regions and ARNs via RegionResolver - Detect mount target subnet conflicts and dynamically resolve AZs - Remove unused obsolete EFS model classes - Ensure UpdateFileSystem returns 202 Accepted status code * docs: generate EFS action table from controller Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list. * fix: prevent stale count on mount target deletion failure Removes the generic catch block in deleteMountTarget so that an unexpected exception during the file system update causes the entire operation to fail, leaving the mount target intact instead of silently deleting it and causing an inconsistent parent count. * fix: store original creation requests to prevent false idempotency conflicts When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state. * fix: store original creation requests to prevent false idempotency conflicts When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state. * refactor: remove unused idempotent parameter stores in EFS Dropping originalFileSystemRequestStore, originalAccessPointRequestStore, and originalBackupStore, as parameter matching is no longer performed by the EFS emulator. These stores were persistent and written to on every create but never read, unnecessarily keeping state files around. * fix(efs): resolve compliance issues and reviewer feedback - Populate AccessPointDescription.Name from tags during create and describe - Return 404 FileSystemNotFound for unknown IDs or CreationTokens in DescribeFileSystems - Implement Marker/MaxItems pagination for DescribeTags - Refactor AZ-ID generation to match exact AWS shapes (e.g. usw2-az1) - Clear ProvisionedThroughputInMibps on transition to elastic/bursting mode - Reject update requests setting ProvisionedThroughputInMibps on non-provisioned filesystems - Add trailing newline to ThroughputMode.java - Expand integration tests for ThroughputMode transitions --------- Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in> |
||
|
|
04d120fdd5 |
feat(fis): add AWS FIS support (#2435)
* feat(fis): add AWS FIS support * refactor: add typed FIS persistence models * ci(fis): retrigger timed-out build * fix(fis): reject trailing JSON request bodies |
||
|
|
02898cf5e2 |
fix(iam): route long-term access keys to owning accounts (#2319)
* feat(storage): expose account ownership when scanning resources * fix(storage): validate account prefixes when scanning * fix(iam): resolve long-term access key accounts * test(iam): cover long-term access key account routing * docs(auth): clarify account-routing trust model |
||
|
|
9e7cdad29a | fix(rds): preserve configured database images (#2035) | ||
|
|
f417164d42 |
fix(rds): advertise reachable endpoints (#2074)
RDS endpoints currently expose the proxy's container port even when Docker publishes it on a random host port. That works when the host can route to the container network, but fails with VM-backed Docker runtimes. Resolve the current container's published port when an external endpoint host is configured while preserving the internal proxy port used by the listener. |
||
|
|
45ed00ebc7 |
feat(ecs): apply EFS access point POSIX ownership to shared local volumes (#1686)
* feat(ecs): apply EFS access point POSIX ownership to shared local volumes #1569 materialises an ECS task's efsVolumeConfiguration volume as a shared local Docker named volume (floci-efs-<fileSystemId>). Docker creates a named volume root:root 0755, so a task whose image runs as a non-root USER — as containers mounting an EFS access point typically do — cannot create files on it and fails with EACCES. Real EFS initialises an access point's root directory per RootDirectory.CreationInfo {OwnerUid, OwnerGid, Permissions} and applies the access point's PosixUser to all I/O regardless of the process uid. This change emulates that mechanism for the shared local volume, driven by generic config: - New floci.storage.efs.* block (owner-uid, owner-gid, root-permissions, setgid, init-image, mount-user, mount-group-add). Every value is empty/false by default, so a shared volume behaves exactly as before (a plain named volume, no ownership change) unless explicitly configured. - ContainerLifecycleManager.ensureSharedVolume(...) ensures the volume then, if ownership is configured, chowns/chmods the mount root once (run-once guard; optional setgid so subdirectories inherit the owner gid) inside a short-lived helper container. - ContainerSpec/ContainerBuilder gain withUser/withGroupAdd; wired into createContainerCmd.withUser and HostConfig.withGroupAdd. - EcsContainerManager initialises the EFS volume root via ensureSharedVolume before mounting it. Unit tests cover the no-op default (no helper container, no image pull), the one-off chown/chmod/setgid helper with the run-once guard, the builder round-trip, and the EcsContainerManager wiring. * fix(ecs): apply configured EFS PosixUser to containers mounting a shared volume Wire the previously-inert floci.storage.efs.mount-user / mount-group-add config into the ECS container spec: a container mounting an EFS-backed shared volume now runs under the configured uid[:gid] and adds the supplementary group, emulating the access point's PosixUser squashing. Without this a non-root image USER could not write a volume owned by owner-uid/owner-gid. Also add the floci.storage.efs.* section to application.yml (the source of truth for effective defaults) and correct the root-permissions Javadoc, which implied leaving it empty always skips volume init even when owner/setgid are set. * docs: regenerate action tables |
||
|
|
f490bbefad |
feat(rds): add mock mode to create clusters and instances without Docker (#1655)
* feat(rds): add mock mode to create clusters/instances without Docker Floci backs RDS clusters and instances with real Docker containers and an auth proxy. In CI or environments without access to the Docker socket, CreateDBCluster/CreateDBInstance fail, so the resources never reach an available state. Add FLOCI_SERVICES_RDS_MOCK (default false), mirroring the existing mock mode of EC2/EKS/ECS/OpenSearch/MSK. When enabled, cluster and instance creation skip the container and proxy and are registered as AVAILABLE immediately with a localhost endpoint; delete and runtime restoration likewise skip all Docker calls. Non-mock behavior is unchanged. * fix(rds): make rebootDbInstance mock-aware In mock mode, reboot skipped the container restart (guarded by a null containerId) but still started a real TCP auth proxy, breaking the no-container/no-proxy invariant. Gate the container restart and proxy start on !mock so a mock reboot only flips status back to AVAILABLE. * fix(rds): give mock resources unique ports and gate delete proxy stop Address PR review: mock mode hardcoded proxyBasePort for every cluster and instance, collapsing all endpoints onto localhost:7001 and leaving usedPorts unreserved. Allocate a unique proxy port even in mock mode (still skipping the container and auth proxy), and preserve/reserve the persisted port on restore instead of resetting it. Also gate proxyManager.stopProxy on !mock in the delete paths, matching the reboot path. Add tests for standalone-instance deletion in mock mode and for distinct mock endpoint ports. * fix(rds): skip Docker volume name for mock cluster members and document mode switching Review feedback from #1655: - Cluster member instances created in mock mode no longer persist a volume name fabricated from the cluster's null volume id, which a later non-mock restore could try to reference. - Document RDS mock mode on the service page, including that switching FLOCI_SERVICES_RDS_MOCK over persisted state is best-effort in both directions, matching the other mock-capable services. |
||
|
|
42669aaed9 | fix(config): make runtime defaults explicit (#1389) |