mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
7dc514b52f2c96bdd1ea32ae64a02703f85be2aa
185
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d951fd532c |
fix(docker): retry core and EKS archive uploads (#5916)
* fix(docker): retry core and EKS archive uploads * fix(docker): fail fast on local host archive errors * test(docker): skip backoff in archive retry regressions Allow package-private caller entry points to select the archive backoff while production retains the shared defaults. Remove the unused user-data tar builder requested in review. * test(resourceexplorer2): isolate empty-query count assertions The shared integration fixture can contain exactly 1000 resources, where a capped total does not imply incomplete results. Search a tracked single-resource view and cover 999, 1000 and 1001 matches with deterministic service tests. |
||
|
|
a90482f030 |
fix(apigatewayv2): trust Floci's own CA when fetching a JWT issuer's keys (#5933)
With TLS on, an issuer Floci serves itself, a Floci Cognito user pool for one, presents a certificate of Floci's local CA. The JWT verifier fetched its discovery document and JWKS with the JVM's default trust store, which does not hold that CA, so every token of a Floci pool was refused with 401 by an HTTP API JWT authorizer (and by an AppSync OIDC provider), where the same authorizer on a Cognito pool verifies on AWS. FLOCI_SECURITY_ALLOW_PRIVATE_JWT_TARGETS only lets the fetch reach the private address; the handshake still failed. The verifier now trusts the CA bundle Floci already writes for the containers it launches: the JVM's roots followed by Floci's own trust anchor (the local CA, or the user's certificate file). ContainerCaBundle gains sslContext(), an SSL context over that bundle, empty when TLS is off or the bundle cannot be read, in which case the JVM's roots alone are trusted as before. A readable bundle with no certificate in it is refused the same way, since a trust store over it would trust nothing, public issuers included. The warning for a missing bundle now also says that JWT authorizers will refuse an issuer Floci serves. The TLS server context of a certificate this CA issues moves from the RDS proxy into FlociCertificateAuthority.serverSslContext, so the proxy and the test that serves an issuer over HTTPS build it one way. Tests: JwtSignatureVerifierTest serves an issuer over HTTPS with a certificate Floci's CA issues, the bundle written by ContainerCaBundle and the verifier built through its injected constructor, as in production: refused by the JVM's roots, verified with the bundle (it fails on main). ContainerCaBundleTest pins that the bundle's context still trusts every JVM root and the anchor, and that an empty bundle falls back. OidcAuthValidatorTest's mocked config now answers tls(). |
||
|
|
9e6be8ff21 |
fix(docker): run boto3 on Python 3.12 in the compat image (#5649)
* fix(docker): run boto3 on Python 3.12 in the compat image * fix(docker): link python3 and pip3 in /usr/bin so absolute-path hooks keep working |
||
|
|
050f93e600 |
feat(core): make the init hook directory configurable (#5801)
* feat(core): make the init hook directory configurable
Hook directories were fixed at /etc/floci/init/{boot,start,ready,stop,
shutdown}.d, which only the image can provide. floci.init-hooks.dir
(FLOCI_INIT_HOOKS_DIR) now sets that root, defaulting to /etc/floci/init so
the image is unchanged; the LocalStack-compat tree is still read as well.
Hooks also run on Windows, where there is no /bin/sh: .ps1 with
PowerShell, .cmd and .bat with cmd, and .py with python. A .sh hook there
is skipped with a warning unless another shell is configured; on Linux and
macOS the Windows script types are ignored.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): match Windows hook extensions in any case and warn about a skip once
Review follow-ups for the configurable hook directory:
- Windows file names are case-insensitive, so SETUP.BAT and Init.PS1 are
now hooks there; elsewhere the extension must stay lower case, as before.
- The warning for a hook Windows cannot run is logged once per file
instead of on every directory listing, and Windows script types are
ignored silently on Linux and macOS.
- The environment variable reference and application.yml list shutdown.d
with the other hook directories.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): always resolve hook directories from the configured root
findMergedScripts called getPrimaryPaths() for the default root and
getPrimaryPaths(hooksRoot) otherwise, though both return the same
directories; the no-argument form only survived because five tests stub
it on a mocked hook. The runner now always passes its root, the overload
is gone, and those tests stub getPrimaryPaths(anyString()).
The runner tests this branch added drop @DisplayName, per AGENTS.md.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
|
||
|
|
f1e00eff5c |
fix(docker): preserve explicitly configured DNS resolvers (#5727)
* fix(docker): preserve explicitly configured DNS resolvers Honor explicit --dns entries before injecting the embedded resolver and public fallbacks. Keep automatic DNS for containers without configured resolvers, and verify the shared builder and Lambda launcher preserve the requested list. Signed-off-by: Andre Kurait <akurait@amazon.com> * fix(lambda): keep AWS endpoints reachable with explicit DNS Signed-off-by: Andre Kurait <akurait@amazon.com> --------- Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
1d1479f9fb | fix(core): keep JSON requests in their selected region (#5697) | ||
|
|
ae3ff3405a | fix(core): reject colons in region names (#5705) | ||
|
|
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 |
||
|
|
cb58b12b41 |
ci: cut a release at 00:30 Central on the 15th and last day of the month (#5698)
Schedule release-cut.yml at 00:30 on the 15th and on days 28-31 with timezone America/Chicago, so GitHub handles DST. A gate job passes only on the 15th or on the actual last day of the month; manual dispatch is unchanged. The release-cut concurrency group moves to the release job so skipped scheduled runs never hold or replace a pending cut. README.md, CONTRIBUTING.md and the docs/ pages now describe the new train: stable releases on the 15th and the last day of each month, cut automatically at 00:30 US Central time. Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
d4d4f16dfd |
feat(ui): add a light and dark theme toggle to the landing page (#5695)
* feat(ui): add a light and dark theme toggle to the landing page The landing page was dark only. A button in the top bar, shown on the dashboard and on the /_floci/ui wait view, switches between a dark and a light theme. With no choice made the page follows the OS colour scheme, including a change while it is open; a choice is remembered in localStorage under floci.theme, next to the news setting, and the page still switches for the current view when storage is blocked. The theme is set by the head script before the stylesheet paints, so a light page does not flash dark on load. The dark palette is unchanged. The light one keeps the same accent family with every text colour at 4.5:1 or better against the page backgrounds, and the five colours that were written as literals (logo dot, button text, code snippets, error box, the copied border) are now variables both themes set. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * feat(ui): name the emulator in the top bar and keep a page-view theme choice The page will be shared by the other Floci emulators, so the top bar now says which one serves it, floci-aws, next to the logo, and the page title and the version pill's tooltip name it too. A theme picked with the toggle while storage is blocked could be undone by an OS colour-scheme change later in the same page view, because the OS listener only checked the stored choice. The click is now remembered in memory as well, so the OS is followed only until the user picks. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * chore(ui): pin the floci-ui console image to 0.7.0 The console image defaulted to floci/floci-ui:latest, and a cached latest tag is never pulled again, so a machine kept whatever console it first downloaded. The default is now the released 0.7.0 tag, in the config default, application.yml and the three docs tables that list it. FLOCI_SERVICES_UI_IMAGE still overrides it. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
8145ffd00e |
feat(opensearch): allow configuring a data volume for domain containers (#5581)
* feat(opensearch): allow configuring a data volume for domain containers * fix(opensearch): isolate configured storage and prepare bind mounts Include account and Region from the domain ARN in configured volume names and bind paths, preserving the optional deployment namespace. Treat missing ownership markers as FLOCI_MANAGED and remove name-based ownership inference. Retain explicitly operator-owned storage and use persisted volume names for managed cleanup. Reuse the storage helper container lifecycle to prepare bind-directory ownership and owner write access from the selected image. Leave existing files untouched, propagate preparation failures, and release reserved ports when storage preparation fails. Preserve Linux daemon path syntax on Windows while keeping native Windows paths and named volumes working. Consolidate OpenSearchDomainManagerTest setup, add regression coverage and a Linux Docker integration test, and update configuration comments and documentation examples. Fix an existing bug where opensearch container names did not include account or region id. |
||
|
|
3afb5b430e |
fix(partitions): source the China CloudFront suffix and GovCloud API Gateway zones (#5618)
* fix(partitions): source the China CloudFront suffix and GovCloud API Gateway zones Two values listed as open questions have a published source in the China and GovCloud user guides, so they become vendored facts in aws/region-facts.json instead of a commercial constant. A generated CloudFront distribution domain name ended in cloudfront.net in every partition. The China guide's CloudFront page names the default domain there as *.cloudfront.cn (https://docs.amazonaws.cn/en_us/aws/latest/userguide/cloudfront.html), and the commercial suffix is the one in the example name of the botocore CloudFront model (Distribution$DomainName, DistributionSummary$DomainName). floci.services.cloudfront.domain-suffix loses its cloudfront.net default and becomes optional: unset, the suffix follows the request's partition, with the commercial one where a partition has no CloudFront; set, it applies in every partition as before. CloudFront distributions and streaming distributions, Cognito and AppSync custom domains and edge-optimized API Gateway domains all resolve it through CloudFrontEdgeDomain.domainSuffix. A regional API Gateway custom domain reported one placeholder hosted zone id in every region. The GovCloud guide's API Gateway page states the regional endpoint zone for us-gov-west-1 (Z1K6XKP9SAGWDV) and us-gov-east-1 (Z3SE9ATJYCRCZJ) (https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-abp.html); those two regions now report it, and the generator resolves each region through its description in partitions.json. No source gives the zone for any other region, which keeps the placeholder and stays an open question. The generator reads both sentences from either rendering of a guide page: the page text, or the Markdown AWS serves at the same URL with .md, which escapes the asterisk in the CloudFront sentence. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(partitions): require each sourced fact and resolve edge domains in the request's partition The GovCloud API Gateway page parser accepted a page stating only one region's regional hosted zone, so an edited guide would have dropped the other zone from region-facts.json without failing. It now requires a zone for every aws-us-gov region. The region-facts self check validated cloudfrontDomainSuffix only when it was present. It now requires the suffix for aws and aws-cn, and the regional hosted zone for both GovCloud regions, as it already requires consoleHost; a missing commercial suffix would otherwise have reached the orElseThrow in CloudFrontEdgeDomain.domainSuffix at runtime. CloudFrontEdgeDomain.create resolved its partition from the region alone, falling back to the commercial one, so an AppSync or API Gateway custom domain in a region no partition publishes (allowed under allow-unknown-regions) took the commercial suffix and hosted zone in a China deployment. It now takes the partition the caller's RegionResolver resolves, which falls back to the deployment's partition, as the CloudFront and Cognito paths already do. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
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> |
||
|
|
7c4d1c913a |
fix(ses): delete by id and filter by source in /_aws/ses (#5159)
* fix(ses): delete by id and filter by source in /_aws/ses
The inspection endpoint follows LocalStack's contract, as
docs/services/ses.md says, but differed from it in two ways. LocalStack
documents that "The query parameter id can be used to delete only a
specific message", and that "Query parameters id and email can be used
to filter by message ID and message source respectively".
- DELETE /_aws/ses?id=<id> cleared every message. It now deletes only
that message, in whichever region it was sent. An unknown id deletes
nothing.
- GET /_aws/ses?email=<address> matched the address against each
message's ToAddresses. It now matches the message's Source, as
LocalStack does.
GET also listed messages in storage hash order. It now lists them
oldest first by Timestamp, the order LocalStack keeps them in.
Floci's own tests read Cognito codes and other mail with
?email=<recipient>. They now list the mailbox and pick the recipient's
messages out of it, through a new SesMailbox test helper in src/test and
the same filtering in the Java and Node compatibility tests. A raw
send's mailbox entry shows RawData without its recipients, so the test
for recipients read from a raw message's headers checks the stored
record.
* fix(codeartifact): run the pypiserver sidecar under an init process so a stop ends it at once
The pypiserver image's entrypoint execs pypi-server, which installs no SIGTERM handler. The kernel
gives PID 1 no default signal actions, so the container ignored every stop request and went only
when Docker sent SIGKILL at the end of the 5-second timeout: each reset, repository delete and
shutdown waited that long for every pypi repository's container, one after another.
ContainerBuilder gains withInit(), carried on ContainerSpec as init and passed to Docker as
HostConfig.Init (docker run --init), and PypiserverSidecarManager uses it. Docker's init runs as
PID 1 and forwards the SIGTERM, so a stop now returns in a fraction of a second. Verdaccio already
handles the signal itself and is unchanged.
* fix(firehose): check buffers every second so delivery follows the buffering interval
AWS delivers a Firehose buffer once the first buffer condition is met. Floci checked for elapsed
buffering intervals on a 10-second tick, so a buffer was delivered up to 10 seconds after its
IntervalInSeconds ended: a 5-second interval landed anywhere from 5 to 15 seconds after the first
record. The default tick is now one second; the check is a scan of the in-memory buffers.
FirehoseFlushIntegrationTest's profile only set the same one-second tick, so it is removed and the
class shares the default test application. The compat tests that wait for a delivery checked S3
every 2 or 5 seconds; against Floci they now check every 250 ms, and keep their cadence against
real AWS.
* test: make subclass mocks the default so mocking stays cheap in a loaded test JVM
Mockito's default inline mock maker redefines every class it mocks in the running JVM. A
redefinition gets slow once the test JVM has loaded the Quarkus applications of the classes that
ran before, which in CI is most of the run: a unit class's first test spent seconds building its
mocks, and EmulatorLifecycleTest, which mocks some fifty types, spent 22 seconds. Subclass mocks
generate a subclass instead and redefine nothing. After twelve Quarkus applications in one JVM, the
fourteen Mockito classes whose first test was slowest in CI take 20.5 seconds instead of 41.9, and
their first tests 6.9 seconds instead of 27.8.
mockito-extensions/org.mockito.plugins.MockMaker makes the subclass mock maker the default. A
subclass cannot extend a final class, record or enum, so those mocks go through
InlineMocks.inlineMock and inlineSpy, or @Mock(mockMaker = MockMakers.INLINE), and
EmulatorLifecycleTest's static mock of Quarkus asks for the inline maker. The ContainerSpec mocks
a mocked ContainerBuilder.Builder returned were opaque values, so they are real specs now.
* fix(cloudformation): leave the last rollback's failed delete to ContinueUpdateRollback
#4949 refuses an update over UPDATE_ROLLBACK_FAILED until ContinueUpdateRollback finishes the
rollback, as AWS does. #4834, merged minutes earlier, had seven tests that update over that
status, and main has failed them since
|
||
|
|
9df4ffbfa1 |
fix(cognito): refuse user pool custom domains in GovCloud and EUSC (#5614)
* fix(cognito): refuse user pool custom domains in GovCloud The AWS GovCloud (US) User Guide lists "Custom domains for user pools are not available" among the Cognito differences (https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-cog.html), but CreateUserPoolDomain and UpdateUserPoolDomain treated a CustomDomainConfig the same in every partition. In a GovCloud region the request only failed later, on the us-east-1 certificate check, with a message about the certificate rather than about the feature. Both operations now refuse a CustomDomainConfig when the request region is in aws-us-gov, before the certificate is looked at, with an InvalidParameterException, which the cognito-idp model declares for both. No source shows AWS's message, so the wording is Floci's own, as for the API Gateway EDGE gate. Prefix domains keep working in GovCloud. EUSC is left as it is because no source covers it, and China and the ISO partitions have no user pools. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(cognito): refuse user pool custom domains in EUSC too The European Sovereign Cloud guide lists user pool custom domains as not available, in the same words as the GovCloud guide, so a CustomDomainConfig in eusc-de-east-1 is now refused with InvalidParameterException instead of falling through to the us-east-1 certificate check. The issued-certificate ACM stub the user pool domain unit tests each carried a copy of moves to one helper, CognitoCertificateStubs. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
255162654f |
fix(lambda): refuse function URLs in GovCloud and China (#5615)
The AWS GovCloud (US) User Guide lists "AWS Lambda Function URLs is not available" (https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-lambda.html) and the China guide "Amazon Lambda Function URLs is not available in the China Regions" (https://docs.amazonaws.cn/en_us/aws/latest/userguide/lambda.html), but CreateFunctionUrlConfig created one in every partition, on a host no source publishes for either of them. CreateFunctionUrlConfig now refuses a request whose region is in aws-us-gov or aws-cn with an InvalidParameterValueException, which the lambda model declares for the operation. No source shows AWS's message, so the wording is Floci's own, as for the API Gateway EDGE gate. The AWS::Lambda::Url provisioner creates through the same service method, so a stack in those partitions fails with that error. Get, Update and Delete act on an existing config and are unchanged. The ISO and EUSC partitions are left as they are because no source covers them, and the open question about the function URL host now names only those two. The Java compat suite skips LambdaFunctionUrlTest in those two partitions, so the China partition nightly stays green. Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
8bd88bfb40 |
fix(codepipeline): link approval notifications to the partition's console host (#5595)
* fix(codepipeline): link approval notifications to the partition's console host The approval-needed notification built consoleLink and approvalReviewLink on the commercial console host for every pipeline, so a pipeline in China or GovCloud sent its approver to a console where the pipeline does not exist. The console host becomes a vendored per-partition fact, consoleHost in aws/region-facts.json, read by the generator from the user-guide snapshots under local/aws/aws-docs/partition-guides: cn/console.md for aws-cn (console.amazonaws.cn), gov/configure-account.md for aws-us-gov (console.amazonaws-us-gov.com) and gov/govcloud-organizations.md for the commercial host. The China guide also spells the host console.www.amazonaws.cn once, in cn/managing-aws.md; the console page's own statement is the one used. A guide page that lost its sentence, or states two hosts with it, fails the generation instead of leaving a stale value. CodePipelineEventPublisher resolves the host from the execution's region, since it runs on a worker thread without a request context. No source states a console host for the ISO or EUSC partitions, which keep the commercial one and are listed as an open question. The path after the host stays the commercial console's: no source gives the per-service path per partition. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(codepipeline): parse the China console host from the Markdown guide page, require sourced hosts AWS serves each user-guide page as Markdown at the same URL with .md in place of .html, and that rendering writes the China console host as a link, "[https://console.amazonaws.cn](https://console.amazonaws.cn).". The aws-cn pattern only took the page-text form, so a snapshot saved from the Markdown page failed the generator, and with it the rest of "make aws-data-sync". The pattern now takes both forms. The docstring names the three guide page URLs and the path each is saved under. self_check now requires consoleHost for the three partitions that have a source (aws, aws-cn, aws-us-gov). The shape-only check used when the sources are not checked out accepted a file without them, which would link approval notifications to the commercial console. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
d5c6a36ac9 |
fix(auth): explain signature date and service mismatches (#5591)
* fix(auth): explain expired query signatures and service mismatches * fix(auth): distinguish future and expired signatures |
||
|
|
a017c94ecc |
fix(auth): verify query signatures and retain STS caller identity (#5584)
* fix(sts): retain caller identity for query credentials * fix(sts): retain form token precedence for caller identity * docs(sts): clarify credential header precedence * fix(sts): verify presigned caller identity requests * test(sts): respect the configured signature-checking mode * fix(auth): verify query signatures across services |
||
|
|
1b7c79fd9e |
fix(signin): accept the cross-device redirect on each partition's sign-in host (#5557)
The cross-device redirect_uri was matched against the commercial <region>.signin.aws.amazon.com only, so a login that resolved another partition's Sign-In host was refused with invalid_request. regen_partitions.py now reads botocore's signin endpoint ruleset and vendors one signinHost per partition into aws/partitions.json. The redirect is accepted on the Sign-In host of a region in the deployment's partition, and another partition's host is refused. The device authorization client ids keep their literals: the Sign-In model spells them the same way in every partition. Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
0d71894153 |
docs(partition): bring the partition pages up to date with the smoke coverage and EDGE rules (#5489)
* docs(partition): bring the partition pages up to date with the smoke coverage and EDGE rules partitions.md still listed the eleven services the smoke test started with and said Step Functions runs in all eight partitions through the emulator, which only IAM does. It now states the rule (every minting service has a case or a listed exemption), names EUSC among the partitions without CloudFront, and replaces the sign-in client id open question, which the model answers, with the one that is open: the cross-device redirect host. lambda.md said a layer ARN outside the aws partition is refused; the check is against the caller's partition. appsync.md implied the AppSync service principal varies by partition; it does not. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * docs(partition): note the endpoint's own origin in the cross-device redirect question Since #5552 the cross-device redirect is also accepted on the endpoint the authorize request arrived on, so the open question is only about which AWS host is accepted outside the commercial partition. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
1aabc8b4fe |
fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS (#5486)
* fix(efs): report the zone id EC2 reports for the same zone EFS derived its own availability-zone id (use1-az1) by splitting the region on hyphens, while EC2 publishes <region>-az<n> for subnets and zones, so a mount target and its subnet disagreed. The abbreviation also only worked for three-part regions: us-gov-west-1a and eusc-de-east-1a kept the whole region. EFS now takes the id from the helper EC2 and VPC flow logs use. Also drops an allowlist pattern for flow-log region abbreviations that matches no source line since flow logs moved to the same helper. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS EC2 published <region>-az<n> as a zone id and EFS its own abbreviation, so a mount target and its subnet disagreed and neither matched AWS in every region. AvailabilityZoneIds in core.common now derives the id for all three: AWS's short region prefix and -az<n> (use1-az1, apne1-az1, usgw1-az1, cnn1-az1). The prefix rule is attested for the commercial, China and GovCloud regions; AWS publishes no zone id for an ISO or EUSC region, so those keep the whole region as the prefix instead of a guessed one. Zone a is still az1, b az2, and so on: AWS maps names to ids per account, which Floci does not model. CreateSubnet resolves AvailabilityZoneId in the new shape and refuses the old one. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
98100054a8 |
feat(core): make the Docker call timeout configurable (#5431)
* feat(core): make the Docker call timeout configurable Ordinary Docker calls failed after a hard-coded five minutes without a response. floci.docker.api-timeout-seconds (FLOCI_DOCKER_API_TIMEOUT_SECONDS) now sets it for both pools, defaulting to 300 so nothing changes by default; a shorter value bounds how long a hung daemon can hold a request. Like the connection request timeout, it must be at least 1, because httpclient5 reads 0 as no limit. Long-lived streams (container waits, exec and attach output, followed logs, streamed stats, events, image pulls and builds) stay exempt. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * docs(core): say the Docker call timeout applies to each attempt The control-plane pool retries a request that is safe to repeat up to six times, and a response timeout is one of the failures it retries. The docs, the config Javadoc and the application.yml comment said the setting bounds a request; it bounds each attempt, so a silent daemon can hold a replayable request for about six times the limit, plus backoff. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
fb202cce6a |
fix(eks): accept a role ARN from another partition the way STS does (#5398)
* fix(eks): accept a role ARN from another partition the way STS does An account keeps one IAM namespace whichever partition a request is for (partitions.md, Known gaps). STS AssumeRole already resolved a role ARN from another partition to the account's role, while EKS Pod Identity and add-ons required the cluster's partition and an exact stored-ARN match. Move the STS role-ARN matcher to IamService.roleArnMatches and use it for the Pod Identity roleArn and the add-on role ARNs; targetRoleArn accepts any well-formed partition. The Pod Identity session names the stored role's ARN, as an STS session does. The EKS model sets no pattern on roleArn or targetRoleArn. * fix(eks): keep a role recreated under another path out of a pod identity session The credentials endpoint finds the association's role by name only. Since the session started naming the stored role's ARN, a role deleted and recreated under another path gave the session its ARN and role id through the old association. The found role now has to match the association's role ARN the way roleArnMatches does everywhere else; one that does not is treated as absent, as before this branch. The association test also checks that a rejected role update leaves the stored role ARN as it was. * fix(eks): refuse pod identity credentials when the association's role is gone EKS Auth assumes the association's role through STS, so a role that no longer exists gets no credentials. The endpoint still issued them, and since enforcement loads a session's policies by role name, a pod whose role was recreated under another path ran with the replacement's policies. A role that is missing, or that does not match the association's role ARN, is now a 400 AccessDeniedException and no session is registered. |
||
|
|
a1f90453fb |
fix(apigateway): refuse EDGE REST APIs outside the commercial partition (#5397)
Edge-optimized endpoints exist only in the commercial partition. CreateRestApi and an UpdateRestApi switch of /endpointConfiguration/types now run the same check custom domains already use, so an EDGE REST API in China, GovCloud, ISO or EUSC is a BadRequestException. REGIONAL APIs, and a move away from EDGE, are still accepted everywhere. |
||
|
|
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. |
||
|
|
ddc47a465d |
fix(core): make Docker read timeouts real on a Unix-socket host, except for long-lived streams (#5294)
* fix(core): make Docker read timeouts real on a Unix-socket host, except for long-lived streams docker-java's UnixSocket reads through a blocking channel stream that ignores SO_TIMEOUT, so on the default unix:// Docker host no call ever timed out: a 2-second response timeout let a container wait run 153 seconds, and a hung daemon blocked its caller forever. It is also why httpclient5's stale-connection check, a read with a 1 ms timeout, cannot be enabled there. FlociDockerHttpClient now connects to a unix:// host through UnixDomainSocket, which keeps the channel non-blocking and waits on a selector, so a read with a timeout fails with SocketTimeoutException. Making the timeout real would cut off streams that are silent while healthy, so requests that hold a stream open (container wait, exec and attach output, followed logs, streamed stats, events, image pulls and builds) get no response timeout on any host, which also keeps a TCP host's container wait from dying at five minutes. Every other call keeps the 5-minute timeout. * fix(core): keep the Unix socket's failures IOExceptions on close and interrupt Closing the socket while another thread waited in a read or write could end that wait with the selector's unchecked ClosedSelectorException, since close() may shut the selector between select() and selectedKeys(); callers expecting an IOException did not handle it. It is now a SocketException. A thread reading a silent stream with no timeout spun once interrupted, because select() returns at once while the interrupt flag is set; it now closes the socket and throws ClosedByInterruptException, as the blocking channel it replaced did. The tests wait with a timed get that expects a TimeoutException rather than a fixed sleep, so an early return fails at once, and cover a close during a blocked read and an interrupted read. |
||
|
|
da53fc1c05 |
docs(partition): document deployment, test coverage and known gaps (#5292)
* docs(partition): document deployment, test coverage and known gaps partitions.md said every partition-dependent rule had integration tests over all eight partitions and that the China compat allowlist only shrinks. Neither is accurate now: most services are tested in China alone, and the allowlist is empty. The page now states the coverage as it is (unit tests over every partition, IAM, Step Functions and the cross-service smoke test through the emulator, China end to end), gives a recipe for running a China, GovCloud, ISO or EUSC deployment, and lists the known gaps: global state shared across partitions in one process (now naming the Identity Center instance, which the smoke test's inventory exempts for that reason), the commercial managed-policy catalog, and client tooling untested outside the commercial partition. API Gateway, IAM and Step Functions gain a Partitions section, and the WAFv2 scope note names the partition's CloudFront region and where the CLOUDFRONT scope exists. * docs(partition): say only custom domains refuse EDGE, and when FLOCI_HOSTNAME is enough The API Gateway Partitions section said EDGE was refused outside the commercial partition and that REGIONAL and PRIVATE worked everywhere. Only custom domains are checked: createRestApi and the REST API update path accept EDGE in any partition, and createDomainName refuses PRIVATE in all of them. The section now says so. The deployment recipe offered FLOCI_HOSTNAME for a different port, but it replaces only the host and keeps FLOCI_BASE_URL's port, so a different port needs FLOCI_BASE_URL. |
||
|
|
985921c3db |
fix(core): fail a Docker call after 30 seconds when its connection pool is full (#5285)
* fix(core): fail a Docker call after 30 seconds when its connection pool is full With no connection-request timeout set, a call that could not lease a pooled connection waited httpclient5's default three minutes before failing. A full pool means the emulator is saturated, so the wait is now configurable through floci.docker.connection-request-timeout-seconds (default 30), applied to both pools. The transport retry already treats a lease timeout as pool exhaustion and never replays it, so the call fails once, after the timeout. * fix(core): reject a Docker lease timeout below one second httpclient5 reads a zero connection-request timeout as no timeout, so floci.docker.connection-request-timeout-seconds=0 let a call on a full pool wait forever, and a negative value reached the client unchecked. It now has to be at least 1, checked the way the two pool sizes are, through one helper that names the setting and its environment variable. The two producer tests that build the beans from a mocked config now stub the timeout; they ran with zero before. The lease test's socket list is shared with the acceptor thread, so it is a concurrent list. |
||
|
|
8a1d1ddcd3 |
fix(partition): read strict-mode service availability from endpoint rulesets too (#5231)
* fix(partition): read strict-mode service availability from endpoint rulesets too Strict partition mode refused services AWS serves. The per-partition service list came from botocore's endpoints.json alone, which leaves out IAM, Route 53, Budgets and Cost Explorer in aws-eusc and IAM and Cost Explorer in aws-iso-e, although each service's endpoint ruleset has an explicit branch for the partition (iam.eusc-de-east-1.amazonaws.eu). The generator now adds those partitions, for services endpoints.json lists somewhere, and records them under servicesFromRulesets. The execute-api signing name was mapped to Connect Participant only, so IAM-authorized API Gateway invokes were refused in China, EUSC and the ISO partitions. A signing name is now left out of the alias map when a service whose own endpoint prefix is that name is listed nowhere, so strict mode no longer judges execute-api. The docs and config comments no longer say IAM is absent from aws-eusc. * test(partition): assert API Gateway answers the strict-mode execute-api probe The execute-api strict-mode test accepted any response but a 200 that lacked the strict-mode error, so a 500 or an unrelated rejection would also pass. It now requires API Gateway's own answer for a missing API: a 404 NotFoundException with "Invalid API id specified". |
||
|
|
e1cd6fe6d4 |
fix(partition): serve a pseudo signing region as its partition's global region (#5233)
A request whose SigV4 scope named a <partition>-global pseudo-region (aws-cn-global) kept the label as its region, so regional services stored state under it and minted ARNs such as arn:aws-cn:sqs:aws-cn-global:... for a region that does not exist. AWS never signs with a pseudo-region: endpoints.json maps each to a real credential scope region. RegionResolver now serves such a scope as the partition's implicit global region (aws-cn-global becomes cn-northwest-1) wherever it reads the region from a request. With floci.partitions.allow-unknown-regions in a non-commercial deployment, an unknown label was scoped to the deployment's partition but RegionResolver.buildArn minted it as aws. buildArn now uses the same partition as the request. ARNs built directly with Arn.of keep the commercial fallback, which partitions.md now states. |
||
|
|
6568700e02 |
test(partition): positive China Lambda layer test, partitions.md gaps, drop AwsRegions.ALL (#5023)
Close-out items of the multi-partition initiative (#4272): - Lambda layers were only tested across partitions negatively. A layer published under a cn-north-1 scope now has its own test: the returned ARN is arn:aws-cn:lambda:cn-north-1:..., GetLayerVersionByArn resolves it, and a China function attaches it (BL-104). - partitions.md names FLOCI_PARTITIONS_ALLOW_UNKNOWN_REGIONS under Related and lists two more unsourced values: the EKS Pod Identity token audience outside the commercial partition, and the exact error AWS WAF returns for the CLOUDFRONT scope where the partition has no CloudFront (BL-105). - AwsRegions.ALL, the commercial advertised list kept as a deprecated alias during the partition sweep, had no caller left in src/main. It is removed and its three tests call advertised("aws"); the KNOWN_IDS javadoc no longer points at it (BL-106). |
||
|
|
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. |
||
|
|
2170c89d88 |
fix(lambda): include the resource namespace in code volume names (#4872)
* fix(lambda): include the resource namespace in code volume names Code volumes, their completion markers and the populate helper container are named through prefixedDockerName, so FLOCI_DOCKER_RESOURCE_NAMESPACE follows the container name prefix as it already does for Lambda containers. Two namespaced instances on one daemon no longer share a code volume, and one's superseded-volume cleanup can no longer remove the other's. Names are unchanged without a namespace. * fix(lambda): keep two resource namespaces from sharing a code volume Greptile and pgermosen on #4872: a namespace and a function name may both contain dashes, so namespace ci with function foo-code-bar and namespace ci-code-foo with function bar spelled the same volume name for the same code, and the superseded sweep, which works from a per-process map of names, could remove the other instance's volume. A namespaced code volume name now ends with a short hash of the namespace (names without a namespace are unchanged), and the sweep checks the volume's floci_namespace label before deleting, so a volume of another namespace is left alone however its name parses. Also imports the Mockito types in ContainerLauncherCodeVolumeReuseTest instead of qualifying them inline. |
||
|
|
24c655050f |
feat(docker): give internal Docker labels io.floci.* names and keep the old keys as aliases (#4871)
* feat(docker): give internal Docker labels io.floci.* names and keep the old keys as aliases Owner, ECS run, credentials-proxy, security-group and VPC network labels move to io.floci.owner, io.floci.ecs.run, io.floci.ecs.credentials-proxy, io.floci.security-group.helper/workload, io.floci.component and the standard resource-identity keys. The previous keys (floci_owner_port, floci.ecs-run, floci.ecs-task-role-credentials-proxy, floci.security-group-*, floci.component, floci_component, floci_vpc_id, floci_vpc_region, floci_vpc_owner_port) are still written as legacy aliases with the same value. Readers take the new key first and fall back to the legacy one, label filters query both key sets, and owner-scoped cleanup leaves an object alone when the two disagree. All alias keys are reserved from extra-labels. VPC networks are now owned by ownerIdentity (namespace and port) instead of the bare API port, so two namespaced instances on the same port no longer reconcile each other's networks. * fix(ec2): keep pre-upgrade VPC networks of a namespaced deployment its own Greptile and pgermosen on #4871: a VPC network created before the owner label took the resource namespace carries only floci_vpc_owner_port with the bare API port, so with a namespace set the deployment read its own surviving network as a CIDR collision and the startup sweep left it behind. Such a legacy-only network is now this deployment's when it holds this port and its floci_namespace label names this deployment's namespace, the identity the new io.floci.owner key encodes. Matching the bare port alone would also claim, and let the sweep delete, the pre-upgrade networks of another namespace on the same port. Also imports List in ContainerStorageHelperTest instead of qualifying it inline. |
||
|
|
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. |
||
|
|
ea06896984 |
test(compat): run the Java SDK suite nightly in cn-north-1 against an allowlist of known failures (#4790)
* test(compat): run the Java SDK suite nightly in cn-north-1 against an allowlist of known failures Part of #4272 (P11). The partition work is covered by unit and integration tests over all eight partitions, but nothing ran a real SDK whose own partition logic (arn:aws-cn: ARNs, China signing scopes, the LocationConstraint S3 CreateBucket sends) has to round-trip. The Partition Compatibility workflow runs after each Nightly against the image it published, or on dispatch with an image and region: Floci starts with FLOCI_DEFAULT_REGION=cn-north-1 and sdk-test-java runs with AWS_REGION set, which TestFixtures now reads (default us-east-1, so the per-PR legs are unchanged). It runs once a night rather than per PR, to keep the shared runner pools free. compat-allowlist-check.py compares the JUnit results with compat-partition-allowlist-<region>.txt and fails on a failure the list does not name, on an entry that no longer fails, or on missing results, so the list only shrinks. The cn-north-1 list holds the 112 failures measured locally on main plus #4787: 96 tests that pin commercial ARNs, regions or zones, 13 that exercise commercial-only behaviour, and 3 still to explain. * test(compat): pin the nightly China run to its image's commit and catch an aborted suite Greptile on #4790: the workflow checked out the Nightly run's head_sha but pulled the mutable floci/floci:nightly tag, so the image and the tests could come from different commits; it now pulls the image first and checks out the commit in its org.opencontainers.image.revision label. And Maven exits non-zero for allowlisted failures too, so a suite that stopped partway could pass; the checker now takes --test-sources and requires a report for every test class in that tree. The cn-north-1 allowlist groups its entries by the verified cause: the RDS and SSO portal entries are Floci bugs (an RdsService ownership check against the literal partition "aws", and an arn:aws: seeded Identity Center instance), and SsoAdminAccountAssignmentTest#createInstanceQuotaUsesAwsSdk passes alone and fails only after OrganizationsTest leaves an organization behind. |
||
|
|
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. |
||
|
|
99c1c4129a |
fix(iam): derive the AWS managed policy catalog per partition (#4742)
The bundled managed policy catalog is the commercial one, so arn:aws-cn:iam::aws:policy/AdministratorAccess did not resolve and a China deployment listed commercial ARNs. Every other partition's catalog is now derived from the bundled data on first use and cached per partition: every arn:aws: inside a document takes the partition, as AWS's SAM translator does for managed policy ARNs (arn_generator.py), and the region-bearing kms:ViaService hosts (s3.*.amazonaws.com) take the partition's DNS suffix. Bare service principals and service-linked role paths are universal (#4633) and are left alone, as is the ::aws:policy/ owner slot. IamService resolves a managed policy under the partition its ARN names, so a China ARN resolves under any signing scope, and ListPolicies lists the catalog of the caller's partition. Partition literal baseline 4 -> 3. Part of #4272 |
||
|
|
43ed79d15b |
fix(core): service principals are universal in every partition; accept the legacy forms (#4633)
* fix(core): service principals are universal in every partition; accept the legacy forms A service principal is <service>.amazonaws.com in every partition, the rule the CDK applies (region-info.ts, principals.ts). Floci now emits it through ServicePrincipals.of: generated trust policies, SAM's Lambda permissions, CloudTrail's eventSource, service-linked role paths (Macie, GuardDuty, Connect, Application Auto Scaling, RAM, SSO) and the Redshift COPY trust check. Policies may still name a service in the per-partition form AWS accepted before (elasticmapreduce.amazonaws.com.cn, logs.cn-north-1.amazonaws.com.cn, config.c2s.ic.gov), and AWS still honours them. ServicePrincipals.canonical folds a published DNS suffix and a regional label away, and the trust-policy evaluator and CreateServiceLinkedRole compare in that form, so either spelling matches. DescribeVpcEndpointServices now lists China's S3 interface service, cn.com.amazonaws.<region>.s3, beside the com.amazonaws gateway one, each with its own type; where the names agree it stays one service carrying both types. Partition literal baseline 34 -> 4 occurrences. The web-identity and pod-identity audiences keep their commercial literals, escaped for the STS phase. Part of #4272 * fix(iam): put a legacy-named service-linked role under the universal principal CreateServiceLinkedRole derived the role name from the universal principal but kept the caller's legacy spelling (es.amazonaws.com.cn) in the path and the trust policy. All three now use the universal principal, so the role lists under /aws-service-role/es.amazonaws.com/ like one created from the universal name. ServicePrincipals.canonical no longer lower-cases: service-principal matching is exact and case-sensitive since #4555, and AWS matches principals case-sensitively, so only a suffix written the way AWS publishes it folds. |
||
|
|
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. |