* fix(lambdaweb): retry a failed request only when Floci saw the exit before sending it
A request that found its environment dead was retried when Docker's exit
time came before the request start. Docker takes that time from the
daemon's clock, which can be seconds behind Floci's. So a request the app
had received could run a second time. Docker also reports an exit late
under load. Until then the dead environment stayed in the pool, and the
next request got a 503 too.
Floci now follows each environment with an attach stream. The stream ends
when the process exits, and Floci notes the time on its own clock. A
failed request waits for that, up to one second. It is retried only if
the exit came before it was sent. Otherwise it gets the 503 page after
the dead environment has left the pool.
* docs(lambdaweb): note the short window after an exit in the 503 row
* fix(lambdaweb): clean up an exited environment off the reaper thread
Docker can take seconds to report an exit status under load. On the
reaper this held up the rearm of dropped exit watches and the idle checks.
* test(lambdaweb): wait for Floci to see the exit instead of polling for the container
* feat(redshift-serverless): add custom domain association actions
Add CreateCustomDomainAssociation, GetCustomDomainAssociation,
ListCustomDomainAssociations, UpdateCustomDomainAssociation and
DeleteCustomDomainAssociation. An association is recorded and echoed; Floci
serves no traffic on the domain and reads no ACM certificate. It is tied to the
workgroup by the workgroup's generated id, so a workgroup recreated under the
same name does not inherit it.
The domain name and certificate ARN patterns, lengths and the required members
come from the AWS model through RedshiftServerlessRequestShapes, so the service
carries no validation of its own.
* fix(redshift-serverless): address review findings for custom domains
- Expose custom domain name and certificate ARN in workgroup responses.
- Ensure custom domain names are unique across workgroups in a region.
- Remove ambiguous Pagination.paginate overload in favor of paginateNamespaced.
- Add domain name and certificate ARN validation patterns and length checks.
- Enforce validation for required parameters in custom domain operations.
* fix(redshift-serverless): enforce single custom domain per workgroup and populate certificate expiry
* fix(redshift-serverless): read certificate expiry dynamically and share custom domain serialization
* feat(iot): route shadow events through topic rules
Successful classic and named shadow changes, from the REST API and from MQTT
reserved topics, now reach the topic rules engine and MQTT subscribers on the
AWS response topics with AWS payload shapes. Shadow documents keep metadata,
clientid() reports N/A for messages without an MQTT client, and MQTT rejected
responses carry the numeric status code.
Closesfloci-io/floci#5256
* fix(iot): compute the shadow delta through nested objects
GetThingShadow and the update/delta event compared desired and reported only at the top level, so one differing nested field put the whole desired object in the delta. AWS compares nested objects key by key and arrays whole, and the delta event carries the stored desired metadata of exactly the delta values.
* fix(iot): give a shadow stored without metadata its leaf metadata
A shadow persisted before metadata was kept now reads back with a metadata mirror of its state stamped with its stored timestamp, so GetThingShadow and the update/documents and update/delta events carry metadata for its existing leaves, as AWS does for every state leaf.
* fix(iot): reject a shadow name outside the AWS pattern
A whitespace-only shadow name no longer addresses the classic shadow, so DELETE ?name=%20 cannot delete it. As on AWS, an empty name is the classic shadow and any name that is not 1 to 64 of [a-zA-Z0-9:_-] fails with InvalidRequestException.
* fix(iot): ignore a shadow request on a named topic with an invalid name
As on AWS, an MQTT request on $aws/things/<thing>/shadow/name/<name>/<op> whose name is not a valid shadow name, empty included, is not a shadow request: nothing is published and the classic shadow is untouched. Before, an empty name updated the classic shadow and a blank one was rejected on the classic shadow's topic.
* docs(iot): note that wildcard rule filters receive shadow events
Verified on AWS IoT: rules FROM '#' and '+/things/<thing>/shadow/#' receive the $aws shadow update events. Adds a test locking in the existing matcher behavior.
* fix(iot): keep only the most recent recorded publish events
The recorder kept every publish, and shadow events now go through it too. Only tests read it, so it now keeps the most recent 1,000 events and drops the oldest.
* test(iot): read shadow rule queues without the 5s poll
* fix(iot): match AWS shadow names, delta numbers and clientToken echo
Accept the reserved $package shadow name and reject any other name containing $ with 'Invalid shadow name : <name>'; a name failing the pattern answers 'Bad Request'. Compare delta numbers as AWS does (equal when both double and long values are, integers beyond long exactly), which also stops a number beyond the double range failing the update, and echo a whitespace clientToken.
* fix(config): drop a conformance pack's tags when the pack is deleted
* fix(config): serialize PutConformancePack and DeleteConformancePack per pack
An update Put is a get-then-put. A Delete landing between the two removed
the pack and its tags, then the Put re-inserted it under the old ARN: the
Delete reported success while the pack survived with its tags gone. Both
operations now take the per-key lock aggregation authorizations already use.
* test(config): force the pack update/delete overlap instead of sampling it
Replace the 100,000-round race sample with a deterministic test, as
SnsPolicyAndSandboxEditsTest does: park PutConformancePack in its persist
(inside the per-pack lock), start DeleteConformancePack, and assert with
ThreadStates.awaitBlockedOrDone that the delete waits. Removing the lock
from either put or delete fails it.
* test: share ParkingStore in floci.testing, parking the next read or write
Moves the two private copies (SNS parked a read, Config parked a write)
into one store next to ThreadStates; the caller arms parkNextRead or
parkNextWrite.
The native resource excludes dropped every Windows snappy-java library, and
JNA's dispatch library, which docker-java's named-pipe transport loads for
Docker Desktop on Windows, was never included. A Windows native binary would
therefore lack both.
The Windows x86_64 snappy library and JNA's win32-x86-64 dispatch library are
now selected by two build properties, floci.native.windows-jni-exclude and
floci.native.windows-jni-include. Their defaults keep every other build exactly
as before; the Windows release build sets them to keep both.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
The IAM page says S3 bucket, Lambda function and SNS topic policies take
part in request authorization, but not that SQS queue and API Gateway
REST API policies are stored without being evaluated.
Add that next to the S3, Lambda and SNS bullets. No behaviour changes.
* fix(dynamodb): compare numeric key attributes by value in UpdateItem
UpdateItem and the TransactWriteItems Update path rejected a request
whose key carried an equivalent but differently written number, such as
a sort key of {"N":"1700000000.0"} against a stored {"N":"1700000000"},
with "Cannot update attribute timestamp. This attribute is part of the
key". Stored numbers are normalized on write, and the key-modification
check compared AttributeValue JSON nodes structurally.
The check now uses attributeValuesEqual, which requires matching types
and compares N by numeric value, as DynamoDB does. The item lookup
already treated these keys as the same item.
* fix(dynamodb): reject key attribute values with more than one type member in UpdateItem
Comparing key attributes with attributeValuesEqual matches on the first
type member the two values share, so an UpdateExpression that set a key
attribute to a value carrying an extra type member passed the key check
and the malformed key was stored. The request key is already validated
for shape and schema type when the item key is built, so checking that
the updated value has exactly one type member is enough for the
comparison to imply a matching schema type.
Bridges the nuget package format to a real per-repository BaGetter
container, the same Manager/Client sidecar shape already established for
Maven (Reposilite), npm (Verdaccio), and pypi (pypiserver): a real NuGet V3
push/install round trip through CodeArtifactNuGetController, GetPackageVersionAsset
and GetPackageVersionReadme bridged to the live sidecar, and DeletePackage wired
through the same CONTAINER_BACKED_FORMATS dispatch the other three formats use.
GetPackageVersionReadme is answered live against BaGetter (its own readme-file
and nuspec-description endpoints) rather than captured at publish time, since
unlike Verdaccio and pypiserver, BaGetter can answer for a specific historical
version after the fact.
Pins bagetter/bagetter, the actively maintained fork of the original,
long-stale loic-sharma/BaGet (no commits since mid-2024, every one of its own
releases tagged -preview/-prerelease), confirmed directly against a live
container for push/download/readme/delete semantics before relying on them.
* fix(ec2): list i386 alongside x86_64 for t2 instance types
* fix(ec2): map i386 AMIs to the linux/386 container platform
t2 instance types now accept i386 images, but the resolver only mapped
arm64 and x86_64, so an i386 catalog image started without a platform
and ran as whatever the host defaults to.
* fix(ec2): allow i386 images on t2.medium
AWS lists t2.nano, t2.micro, t2.small and t2.medium as the t2 sizes that
can run 32-bit AMIs; t2.medium was missing i386 so RunInstances refused
an i386 image there.
* test(ec2): share catalog image setup and drop duplicated t2 pin
Extract serviceWithCatalogImage for the catalog image and resolver stubs
used by the arm64 and i386 runInstances tests, and stop
i386CatalogImageLaunchesOnTheLinux386Platform at the platform; the t2
sizes stay pinned in Ec2InstanceTypeCatalogTest.t2FamilySupportsI386AndX86_64.
* 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>
* fix(ses): check v2 configuration set request bodies against the service model
CreateConfigurationSet, UpdateConfigurationSet,
PutConfigurationSetSuppressionOptions, PutConfigurationSetVdmOptions and
Create/UpdateConfigurationSetEventDestination now check their body against
the vendored SES v2 shapes before any other validation, as the send
operations do. A member of the wrong JSON type, nested ones included, is a
SerializationException with the deserializer's message, ahead of the name
validation and the configuration set lookup.
The type checks the walk makes unreachable are removed from the option
parsers and parseSuppressedReasons. requireOptionObject and coerceBoolean
build their messages through the SesV2Json helpers. A non-object event
destination is now a SerializationException instead of "EventDestination is
required.", and these operations answer a non-object body with "Request
body must be a JSON object." while a blank body still reads as {}.
* fix(ses): read the suppression-options body like the other checked operations
PutConfigurationSetSuppressionOptions inlined the blank-body, parse and
requireJsonObject steps that readOptionBody already performs, which made
its order look different from the other checked operations. It now calls
readOptionBody, so all six read the body the same way before the shape
check. Behaviour is unchanged.
* test(ses): share the SES v2 member-type test helpers
The configuration set member-type test copied the send test's request
assertion and deserializer message constants. Both now use
SesV2SerializationErrors, which takes the HTTP method, so the Contact and
metrics/import/export PRs can reuse it.
regen_dynamodb_shapes.py and regen_sesv2_shapes.py carried the same
build() and main(); the SES v2 one only added the filter that drops
members bound to the URI, query string or headers, which leaves
DynamoDB's model unchanged since it has none. request_shapes.py now
holds load_model(), a build() that takes the generator's name, render()
and main(), and each script names its model and output. Both vendored
files regenerate unchanged.
* 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>
* fix(docker): fail a port-publishing container whose network does not exist
A container that publishes ports is created on the default bridge and
joins its service network only after start, and startCreated logged a
failed join and carried on. When the network does not exist, typically
a mistyped FLOCI_SERVICES_DOCKER_NETWORK, the container kept running on
the bridge alone, out of reach of the network it was meant for, while
its resource reported itself ready. A container that does not publish
ports joins its network at creation and already fails there.
startCreated now throws when Docker reports the network as not found,
and createAndStart removes the container as for any failed start. Other
join failures are still only logged.
* fix(docker): keep Docker's reason when joining a network returns 404
Slice 9 of #4542.
TimestreamInfluxDbDockerIntegrationTest and EksImdsDockerIntegrationTest
each declared a profile of their own, the first for real InfluxDB
containers on host ports 18186 to 18285 and the second for the
link-local IMDS endpoint on the node and its pods. They now share
ContainerDataPlaneProfile.
Each setting only reaches the class that tests it. An InfluxDB
container starts only when a DB instance is created, which the IMDS
test never does. The IMDS settings act only when a cluster's container
starts, and the test defaults keep EKS mocked, so only the IMDS test,
which configures the endpoint on its own container, reaches them.
The issue had the Timestream test joining RealElbV2DataPlaneProfile
instead. The ELBv2 classes stay where they are, because one of them,
ElbV2WebSocketIntegrationTest, injects a spy, and a class that does is
not merged into another group. The new profile's javadoc lists each
override, the class that relies on it, why it is inert for the other,
and why the ELBv2 classes stay apart. The two moved classes gain a
class javadoc naming what they get from it.
CopyObject ignored its Object Lock headers, and CreateMultipartUpload
ignored those and its grant headers, so the copy or the completed upload
came out without the lock or the grants the request asked for. PutObject
read the lock headers without checking them: a malformed retain-until
date was a 500, and a mode without a date, a date without a mode or an
unknown mode was accepted.
PutObject, CopyObject and CreateMultipartUpload now read the lock headers
through one check that refuses them as S3 does, with InvalidArgument
naming the header: a mode and a date come together, checked first, and
the mode is GOVERNANCE or COMPLIANCE. A date that is not an ISO 8601
timestamp is refused the same way. CopyObject applies the settings to the
copy. CreateMultipartUpload keeps them and its grants, and applies them
when the upload completes. Its grants are checked when the upload is
created, under the bucket-owner-enforced rule PutObject uses, so a grant
S3 refuses fails the creation rather than the completion.
Refs #5716
IoT carried its own policy-variable pass. Before handing the attached documents
to the evaluator, IotService walked each statement's parsed tree, replaced the
connection's ${iot:...} values in every string it found, and dropped any
statement that still held a ${...}. That was IoT's copy of the mechanism the
evaluator gained for every other policy Floci reads, so the documents now go in
as written and PolicyVariableResolver does the substituting, from the same
condition context the connection already supplies.
The developer guide gives IoT no policy language of its own to justify a second
reader: AWS IoT Core policies "are JSON documents. They follow the same
conventions as IAM policies", they "follow the same policy evaluation logic as
IAM policies", and a policy variable is one "that can be used in AWS IoT Core
policies in the Resource or Condition block". The predefined ${*}, ${?} and
${$} are documented by pointing at IAM's own variables page.
Five corners move, each of them onto what those pages say:
- A ${...} outside Resource and Condition is text. The text pass substituted
into every string of the statement, Action and Sid included, where the guide
gives a variable meaning in those two elements only.
- ${*}, ${?} and ${$} resolve to the characters they stand for. Any statement
holding one used to be dropped, the unresolved-variable scan being a plain
\$\{[^}]*\} that matched them too.
- A variable resolves whatever case its key is written in, the variables page
being explicit that "Key names are case-insensitive. For example,
aws:CurrentTime is equivalent to AWS:currenttime". A thing attribute spelled
two ways in one registry now collides on that reading, which is the price of
the IAM rule and not a surprise unique to IoT.
- An unresolvable variable in a Condition value leaves the value null rather
than taking the whole statement away, so a positive operator does not match
and a negated one does. A Resource pattern holding one still matches no
resource, which is what dropping the statement amounted to.
- Variables need the version that introduced them. A document that does not
declare "Version": "2012-10-17" keeps ${iot:ClientId} as literal text, the
guide's answer being that "if you don't set the Version to 2012-10-17 or
later, variables like ${aws:username} are treated as literal strings in the
policy". Every policy example in the IoT guide declares it.
A connection no longer rewrites the document it evaluates, which the evaluator's
parse cache notices: it is keyed by document text, so it held one entry per
client id where it now holds one per policy.
Five tests in IotServiceDeviceAuthTest cover the five corners, and the
unresolved-variable, JSON-syntax and thing-attribute tests already there cover
what has to stay put. docs/services/iot.md says what resolves where.
* fix(logs): bind ARN tag operations to their owning group
* fix(logs): preserve literal names in tag requests
* test(logs): share authorization fixtures
* fix(iot): return ConflictException for shadow version mismatch
* fix(iot): match AWS shadow version conflict message
* test(iot): expect modeled shadow conflict in Python SDK
* fix(swf): wait for new events after empty decisions
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): wake senders after successful external outcomes
Signed-off-by: Andre Kurait <akurait@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cognito): run signup triggers outside user locks
* fix(cognito): preserve state across signup callbacks
Refresh the returned confirmation status without changing captured delivery attributes. Retain the loaded pool through confirmation dispatch so deletion cannot introduce a post-commit lookup failure.
* test(cognito): tighten confirmation mutation polling
* feat(redshift-serverless): add endpoint access actions
Add CreateEndpointAccess, GetEndpointAccess, ListEndpointAccess,
UpdateEndpointAccess and DeleteEndpointAccess. Floci creates no VPC endpoint, so
an endpoint is recorded and echoed with the workgroup's own address and port.
It is tied to the workgroup by the workgroup's generated id, so a workgroup
recreated under the same name does not inherit its predecessor's endpoints.
Required members and the ownerAccount pattern come from the AWS model through
RedshiftServerlessRequestShapes. The endpoint name rule is checked by hand
because the model documents it but does not encode it.
* fix(redshift-serverless): validate boundary inputs and scope endpoint pagination tokens
Validate policy is not null or blank in requireJsonObject before Jackson parsing to avoid unchecked IllegalArgumentException. Validate required endpointName, workgroupName, and subnetIds at create boundary. Validate non-null vpcSecurityGroupIds on endpoint updates. Add namespaced paginate overload with limit validation, scope ListEndpointAccess tokens to endpoint-access, and report pagination errors as ValidationException.
* fix(redshift-serverless): allow optional vpcSecurityGroupIds on update and reuse existing pagination overload
Allow omitting or passing null vpcSecurityGroupIds in UpdateEndpointAccess to leave existing security groups unchanged. Validate maxResults in the service and call the existing namespaced Pagination.paginate overload instead of adding core overloads. Omit the snapshot policy null check which belongs to #5730.
Quarkus resets RestAssured to the default port after each test, so the
static cleanup of these classes went to port 8080 and failed silently.
Their replication groups, clusters and users stayed until the
application stopped.
* feat(rds): add StartExportTask, DescribeExportTasks and CancelExportTask with the export task lifecycle
* docs(rds): document the snapshot export task API
* fix(rds): route the export task actions to RDS when a request has no signing scope
* fix(rds): refuse an export to a bucket outside the snapshot's region
* fix(rds): answer export task calls with a copy of the task taken under the lock
* fix(rds): refuse an unknown DescribeExportTasks filter name before matching any task
* fix(rds): fail an export to a bucket in another region as a task, as RDS does, rather than refuse it
* docs(rds): say that a bucket in another region fails an export in mock mode too
When Floci runs in Docker, a sidecar it creates that publishes ports (a
k3s node, the ECR registry, a Redshift engine, the Floci UI, the AppSync
JS runtime) starts on the default bridge and is then connected to its
service's network.
createAndStart resolves the endpoint on that network. Adopting a
surviving container after a restart took the first address in Docker's
inspect response instead, which in practice is usually the bridge, and
Floci is not on the bridge. Every probe of the adopted container failed;
an EKS cluster stayed CREATING.
ContainerLifecycleManager.adopt gains an overload that takes the network
to prefer and resolves each endpoint with resolveEndpoint(inspect, port,
network). Each caller passes the network it creates its container on,
through ContainerBuilder.resolveDockerNetwork with the argument it gives
withDockerNetwork. A survivor that is not on that network falls back to
the first address, as before; the two-argument adopt is unchanged.
Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
* fix(backup): return HTTP 400 for ResourceNotFoundException
AWS Backup documents ResourceNotFoundException as HTTP 400 across the
API. BackupService threw it with 404 for missing vaults, plans,
selections, jobs, recovery points and resource ARNs, while the
sub-resource throws already used 400. Use 400 everywhere.
* test(backup): expect 400 for a vault deleted with its CloudFormation stack
BackupVaultCfnIntegrationTest still asserted the old 404 after
ResourceNotFoundException moved to HTTP 400.
* test(backup): cover 400 for missing selection, recovery point and tagged resource
The ResourceNotFoundException status change reached selection, recovery
point and resource-ARN lookups that no test exercised. Assert 400 for
GetBackupSelection/DeleteBackupSelection (missing, and under the wrong
plan), DescribeRecoveryPoint/DeleteRecoveryPoint, and ListTags/
TagResource/UntagResource on a missing ARN. Align the CFN provisioner
fixture to 400.
* fix(sqs): compare CreateQueue attributes against effective values
CreateQueue on an existing name compared requested attributes against the
raw stored map. SqsManagedSseEnabled is derived on read and never stored, so
re-creating a default queue with SqsManagedSseEnabled=false returned the
existing queue instead of QueueAlreadyExists.
Extract the read-time derivation from GetQueueAttributes into one helper
and use it for both the read path and the conflict check.
* fix(sqs): treat a padded MaximumMessageSize as equal to its canonical form on re-create
* fix(sqs): treat an empty MaximumMessageSize as its default on re-create
CreateQueue accepts an empty MaximumMessageSize and the effective value it
reports is the configured default, but the conflict check skipped
canonicalising empty requests, so an identical retry raised
QueueAlreadyExists instead of returning the existing queue.
A native binary on the host shares the Docker daemon with any Floci image,
or a second binary, running beside it. With no resource namespace they
name child containers and volumes alike, so creating RDS instance mydb in
one removes the other's container before starting its own.
A native run outside a container now defaults floci.docker.resource-namespace
to host-<floci.port>, through the same ordinal-260 HostDefaultsConfigSource,
so an explicit namespace still wins and the image keeps an empty one.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Slice 8 of #4542.
Three CloudFormation classes each declared a profile for one setting,
and ApiGatewayV2DomainCfnIntegrationTest borrowed the strict one. All
four now use CloudFormationSettingsProfile, which carries the three
settings: an unsupported resource type fails instead of being stubbed,
Lambda code that cannot be read falls back to the stub handler, and a
deleted stack is retained for a day. Each only reaches the class that
tests it: the other templates declare only types Floci provisions and
no Lambda function, and only the race test lists stacks or looks one up
by its id after a delete.
The two IoT classes that changed a default, the DescribeEndpoint
address and strict rule SQL, share IotSettingsProfile. The address only
changes what DescribeEndpoint and the AWS-managed domain configurations
report, which the rule test never reads, and strict SQL only changes how
a topic rule is created, which the endpoint test never does.
Why the race test keeps a deleted stack for a day, the test clock
advancing on every read, moves from the retired profile's javadoc to the
class javadoc. IotTopicRuleSqlStrictIntegrationTest gains a class
javadoc saying what strict mode changes.
PutObjectTagging and DeleteObjectTagging ignored versionId and changed the
current version. GetObjectTagging dropped it in the controller, so it read
the current version too, and the service took versionId=null as the
current version even on a key that has no null version.
All three now act on the version named. "null" names only the null
version, the object stored without a version id; on a key that has none
the request answers NoSuchVersion. Each returns the version it acted on in
x-amz-version-id. A request on a delete marker, named or current, answers
405 MethodNotAllowed with Method and ResourceType, and with
x-amz-delete-marker: true, as S3 does. A put or delete runs under the
bucket monitor that writes, deletes and the lifecycle sweep hold, so a
version deleted between the lookup and the write is not written back.
Since they act on the version named, a request naming one is now checked
as s3:GetObjectVersionTagging, s3:PutObjectVersionTagging or
s3:DeleteObjectVersionTagging, carrying s3:versionid, in place of the base
tagging action. Part 1 kept these requests on the base actions because the
operations changed the current version. The s3:ExistingObjectTag lookup
already read the version named, so the tags a condition sees are now those
of the version the request changes.
The IAM condition context still reads s3:ExistingObjectTag for
versionId=null from the current version, which GetObject still serves for
it, so a deny on those tags keeps applying.
Refs #5716
A role's trust policy was the one context a request is evaluated against that
did not say who was calling. AssumeRolePolicyEvaluator assembled its own map
and put aws:PrincipalArn into it alone, so a trust policy keyed on aws:userid,
aws:PrincipalType or aws:username could not match, where every other context a
request is evaluated against carries all four through
CallerArns.putPrincipalKeys. The user guide puts aws:PrincipalType and
aws:userid in "the request context for all requests, including anonymous
requests" and aws:username in it for every IAM user, and an sts:AssumeRole
request is no exception: the guide's own example of a resource-based policy
tells principals apart in a Condition on aws:userid. Raised by hectorvent on
the review of #5568 and left to its own PR.
The evaluator now takes the caller's CallerArns in place of its two ARN
strings and writes the keys through that single writer, so no second context
has to be kept in step. STS passes the caller it already resolves, and a
credential that resolves to no identity is the account root stand-in it
already names in its denial, now with the account's own keys: the guide gives
the root user the account id as its aws:userid, the type Account and no
aws:username, which is what S3 and the enforcement filter already build for
it. That construction had three copies and is now one factory on the record.
Step Functions passes the execution role as the session it is, carrying
AssumedRole as its aws:PrincipalType: it assumes that role on the state
machine's behalf, so a target role's trust policy may condition on the type.
It mints no session name there, and a session's aws:userid is
role-id:session-name, so that key and aws:username stay absent.
AssumeRolePolicyEvaluatorTest builds its callers through the record, with
three cases on the keys: a condition on aws:username matching the caller and
not matching the same caller carrying no keys, aws:PrincipalType and
aws:userid telling a user apart from a role session, and a value the caller
carries winning over the request's own copy.
AssumeRoleTrustConditionsIntegrationTest signs four more AssumeRole calls end
to end, over a condition on the calling user's name, on the principal type, on
the root stand-in's account id, and on a session's role-id:session-name.
Reverting the evaluator to aws:PrincipalArn alone fails all seven; writing the
keys with putIfAbsent instead fails the precedence case alone.
LambdaTaskAuthorizerTest covers the Step Functions caller from both sides, a
trust condition on the principal type matching it and one on the session's own
id not matching.
* fix(dms): list the default replication subnet group
DescribeReplicationSubnetGroups read stored groups only, so filtering on
"default" faulted with ResourceNotFoundFault and the unfiltered list
omitted the group that replication instances created without one report.
Resolve both paths through findReplicationSubnetGroup, which synthesises
"default" from the region's default-VPC subnets.
* fix(dms): list the default subnet group only once an instance uses it
AWS creates the default replication subnet group the first time an
instance needs it, so a region with default subnets but no such instance
has no default group. DescribeReplicationSubnetGroups now lists and
resolves default only while a replication instance in the region was
created without a subnet group, and checks that before calling EC2, so
an unused default never seeds the region's default VPC.
* fix(rds): serve a CA-signed proxy TLS leaf certificate
* fix(rds): renew proxy TLS leaves before expiry
* fix(rds): sign proxy leaves with the shared Floci CA
Reuse the canonical CA and preserve legacy SAN metadata without loading or modifying the old RDS-only certificate and key. Keep leaf renewal and expiry rejection unchanged.
* fix(rds): preserve legacy CA certificate paths
Refresh rds-ca.crt from the shared Floci root and remove the unused RDS-only key. Replace the certificate path atomically so legacy links cannot overwrite shared key material, and leave failed initialization retryable.
* feat(rds): DescribeDBLogFiles and DownloadDBLogFilePortion
Both answered UnsupportedOperation, so an instance's log could only be
read with docker logs, outside the AWS API.
An instance's log is now read from its database container and cut into
files the way RDS names them: hourly error/postgresql.log.* files for
PostgreSQL, error/mysql-error.log for MySQL and MariaDB, and log/ERROR
for SQL Server. DescribeDBLogFiles filters and pages them, and
DownloadDBLogFilePortion follows the API reference's marker rules with
a 1 MB block cap. Control characters XML cannot carry come back as
U+FFFD. In mock RDS mode an instance has no log files.
Closes#5733
* fix(rds): bound and validate log file reads
A log read now takes the most recent 100,000 lines instead of the whole
history, fails when Docker does not finish in time instead of returning
part of the log, and, when Docker no longer knows the container, finds
or starts the backend once before answering DBInstanceNotReady rather
than an empty log. A single line over 1 MB is cut at 1 MB like the rest
of the block. Negative FileSize, FileLastWritten and Marker values are
InvalidParameterValue; the shared offset paging refuses a negative
marker instead of starting over.
* fix(rds): close the Docker log stream when a log read times out
A timed-out read now closes its callback before failing, so the stream
stops and nothing writes into the buffer after the read gives up; the
buffer is also written and read under one lock.
* refactor(rds): keep portion's Javadoc on portion
truncateUtf8 had landed between portion's comment and portion itself. It now follows portion.
* test(rds): read log files on the first call, and import class names
CreateDBInstance returns once the database accepts connections, so the startup log is already in the container's output. The Docker and SDK log tests now assert on the first DescribeDBLogFiles and DownloadDBLogFilePortion call instead of polling. The timeout test and RdsLogFilesTest import the classes they had written out in full.
* fix(core): name the real pagination parameter in invalid-token errors
The maxResults/nextToken overload of Pagination.paginate hardcoded
"Invalid nextToken." for a token that does not decode. Redshift
DescribeSnapshotCopyGrants and the DMS Describe* operations take that
token as Marker, so a malformed marker produced an error naming a
parameter those operations do not have.
Add an overload taking the wire name of the token parameter and use it
in the message; the existing overloads delegate with "nextToken", so
every NextToken caller is unchanged. The Redshift and both DMS call
sites (DescribeReplicationSubnetGroups and the shared describe used by
DescribeEndpoints, DescribeReplicationInstances and
DescribeReplicationTasks) now pass "Marker".
* fix(redshift,ce): name Marker and NextPageToken in invalid-token errors
DescribeSnapshotSchedules (added in #5574) takes its page token as Marker
but went through the paginate overload that reports "Invalid nextToken.".
Cost Explorer GetAnomalyMonitors and GetAnomalySubscriptions take
NextPageToken and had the same message. Both now pass the wire name to
the tokenName overload. These were the remaining paginate callers whose
token parameter is not nextToken; callers that render their own token
error (Lambda durable executions, Auto Scaling, SES, Cognito) are
unaffected.
* feat(lambdaweb): scale environments per endpoint and apply maxEnvironments and rateLimit
Each endpoint keeps its own pool of environments, as on AWS. An
environment takes up to the revision's maxConcurrencyPerEnvironment
requests at once, the least busy one first so requests rotate, and a
request that finds every environment full starts another or waits for
one that is starting. At maxEnvironments the request gets the 429 page
with Platform.EndpointMaxEnvThrottle. A rateLimit admits a burst of up
to rateLimit requests refilled at rateLimit per second and refuses the
rest with Platform.EndpointRequestThrottle. Both pages were recorded
against AWS.
Part of #5699
* fix(lambdaweb): key environment pools by endpoint creation and let a new revision take an idle slot
A recreated endpoint gets a new domain, so it no longer reuses the
environments of the deleted one. At maxEnvironments an idle environment
of another revision is stopped to make room. Empty pools are dropped.
The burst in the Docker test now arrives at once, so a slow runner still
goes past the rate.
* fix(lambdaweb): keep the rate limiter clock monotonic and drop refilled buckets
A bucket untouched for a second is full, so it is dropped. A clock read
that lands behind the bucket no longer takes tokens back.
* fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias
Point the alias AutoPublishAlias generates at the Version attribute of
the generated AWS::Lambda::Version, as SAM does, instead of $LATEST,
and name that version as SAM names it: <Function>Version plus the
first ten hex digits of the SHA-1 of the function's code, with
template parameters resolved as a Ref or as ${Name} in an Fn::Sub,
merged with its Environment and MemorySize, as sorted compact JSON
escaped the way Python's json.dumps escapes it. Under
AutoPublishAliasAllProperties the hash covers every property floci
gives the function. A string AutoPublishCodeSha256 takes the hash's
place with its first ten characters. As in SAM, the version is
retained (DeletionPolicy: Retain) unless the function says otherwise,
and version properties of the wrong type are refused.
With the alias on the published version, a template change to the
code names a new version resource, which publishes, and the alias
moves to it, while changes made to $LATEST outside the stack no longer
reach the alias. The $LATEST pin worked around #1987 and #1988: a cold
invoke of a published version timed out, and a warm $LATEST container
served version-qualified invokes. Both are fixed on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudformation): hash an applied SnapStart into the SAM version id
SAM adds a function's SnapStart to the hash behind the AutoPublishAlias
version's logical id when its ApplyOn is anything but None, so turning
SnapStart on names a new version, which publishes and gets its
snapshot. Without it a SnapStart function got a different id than SAM
gives it, and changing SnapStart published nothing. Under
AutoPublishAliasAllProperties SnapStart is hashed like the other
properties.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* refactor(cloudformation): resolve SAM destination types with parameterValue
destinationType repeated the parameter lookup parameterValue already
does for the version hash: the stack's value, else the Default. Use the
one helper. A non-string Default still names no destination type.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(cloudformation): describe the SAM version hash in SAM terms
Reword the comments and test names around the AutoPublishAlias version
id to state what SAM and CloudFormation do, rather than how another
project or language implements it.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudformation): hash a null SnapStart ApplyOn and state what it changes
SAM leaves SnapStart out of the version hash only when ApplyOn is
missing or "None"; a null ApplyOn is hashed. The check read a null as
"None".
floci does not pass SnapStart to the function, so turning it on
changes the version's logical id but publishes no new version, and
no snapshot is taken. 44eae301d said it publishes; the docs and the
comment now say what happens.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(cloudformation): say which characters the SAM version hash escapes
Characters outside printable ASCII are hex escapes except where JSON
has a short escape, such as a newline's, and SnapStart is hashed only
when it sets an ApplyOn other than None.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* refactor(cloudformation): leave the optional SAM version properties to their own change
Take AutoPublishCodeSha256, AutoPublishAliasAllProperties and
VersionDeletionPolicy, with their validation, docs and tests, out of
the AutoPublishAlias fix so they can follow as their own change. The
transform no longer reads them, as on main: each is ignored, never
refused, and none changes the version's logical id or its
DeletionPolicy. The CapacityProviderConfig default goes with
VersionDeletionPolicy.
The fix keeps the alias on Fn::GetAtt of the version's Version, the
hashed version id over the code, Environment, MemorySize and an
applied SnapStart, and the version's default DeletionPolicy: Retain.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* feat(core): relay container callbacks to a loopback Floci on a Linux host
Containers Floci starts call back through host.docker.internal, which native
Linux Docker maps to the bridge gateway (host-gateway, normally 172.17.0.1).
Docker Desktop forwards that address to the host's loopback, but Linux does
not, so a Floci binary run on a Linux host and bound to 127.0.0.1 (the default)
refused every SDK call from a Lambda function, ECS task or CodeBuild build.
The documented workaround was to listen on 0.0.0.0 with the exposure consent.
BridgeGatewayRelay now listens on the default bridge's gateway address, which
belongs to the host but is not routed from the LAN, and pipes each connection
to Floci's port on loopback. It runs only on a Linux host outside a container,
only while the public listener is on loopback, and only when Docker answers.
The quick start says so.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): relay every port containers call and close cleanly on shutdown
Review follow-ups for the bridge gateway relay:
- It relays the ports ContainerReachableEndpoint advertises: without TLS the
HTTP server's port, which can differ from floci.port; with TLS the
proxy's public port plus its AWS-HTTPS port (a failed bind on that
privileged port is logged at debug, as the proxy's own is warned once).
- It forwards to the loopback address Floci listens on (::1, localhost,
127.0.0.2, ...) instead of always 127.0.0.1.
- A shutdown racing the network lookup or a bind closes whatever the
startup opens afterwards.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): relay only connections that come from a Docker network
Linux accepts packets for any of its own addresses on any interface, so a
LAN neighbour that routes the bridge gateway address through this host could
reach the relay and, through it, a Floci bound to loopback.
The relay now reads every Docker network's subnets and relays a connection
only when its source lies in one of them; anything else is closed. A source
outside the known subnets refreshes the list once, at most every five
seconds, so a network created after startup is picked up.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(core): report at startup which services an unreachable Docker affects
Floci starts without Docker, but each container-backed service only reports
the missing daemon on first use, and differently. RDS, ElastiCache, EKS and
peers keep their control plane with no container behind it. Lambda, ECS,
CodeBuild and others cannot run the work that needs a container: an invoke
returns a Lambda.InitError, an ECS task stops, a build goes to FAULT. A
native binary run without Docker gave no hint of this up front.
DockerAvailabilityReport pings the daemon once after startup, off the startup
path, and when it does not answer logs a single warning naming the enabled
services in each group. Nothing is logged when Docker answers or when no
affected service is enabled.
A Lambda invoke that cannot start its container because Docker is
unreachable now says so in its Lambda.InitError payload instead of the raw
socket error.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): name every Docker-dependent service and the endpoint actually probed
Review follow-ups for the no-Docker report:
- redshift-serverless, rds-data and athena also need a container (the
serverless runtime, the RDS database, floci-duck), so they are listed as
failing on use.
- A service whose container work goes elsewhere is left out: Lambda on the
kubernetes executor, Athena with floci.services.duck.url, Verified
Permissions with a cedar-url. Pipes is named for its Kafka sources only.
- The warning names the endpoint the Docker client resolves (DOCKER_HOST,
the active context, the Windows pipe), not the configured default.
- The Lambda InitError names Docker only on the docker executor, and also
for an unresolvable Docker host.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
HostDefaultsConfigSource set floci.storage.host-persistent-path to the user
data directory as a fixed value. A persistent path set only in
config/application.yml then moved the state but not the directory child
containers bind. The host path now defaults to ${floci.storage.persistent-path},
so it follows whichever persistent path wins, and an explicit host path still
takes precedence.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(ses): check v2 send request bodies against the service model
SendEmail, SendBulkEmail and SendCustomVerificationEmail read their
members by hand, so a member of the wrong JSON type was coerced, read as
empty, or rejected with a Floci-specific BadRequestException, depending
on which member it was. AWS deserializes the whole body against the
model first and answers the first member of the wrong type, in body
order, with a SerializationException and its deserializer message.
tools/aws/regen_sesv2_shapes.py vendors the body shapes of botocore's
SES v2 model into src/main/resources/aws/sesv2-request-shapes.json, kept
in sync by make aws-data-check like the DynamoDB shapes.
SesV2RequestShapes checks a body against them, and the three send
endpoints call it before reading any member. The type checks it makes
redundant are removed from the send helpers. A null address list
element still passes and fails as "Invalid email address null.", as on
AWS.
Only the string, blob, list, structure and map messages have been
probed, so number, boolean and timestamp members are left to their
controllers.
* fix(ses): report a null v2 send address where SES does
A null element of a v2 send address list was rejected for the whole
request while the body was read. SES lets it through deserialization
and reports it later: SendEmail answers "Invalid email address null."
after its content and sender checks and before the tenant lookup, and
SendBulkEmail reports it as the INVALID_PARAMETER status of the entry it
belongs to, of every entry for a null Reply-To, or as "Destination
cannot be empty" when no entry of the request has a non-null recipient.
The address lists now keep the null, SendEmail checks for it ahead of
the tenant gate, and the bulk entry check reports it per entry. Two
ordered integration tests that shared an @Order value get their own.
* chore(core): share the vendored request-shape model
DynamoDbRequestShapes and SesV2RequestShapes each carried the same
Shape and Model records and the same parse() and load(), and load()
repeated VendoredResources.read. RequestShapeModel in core.common now
holds that half and both checks use it; each keeps its own walk and its
protocol's messages.
The bundled persistent path is ./data, relative to the working directory.
That suits the image (which sets /app/data) and a run from the checkout, but
a native binary on the PATH would write its state, and its TLS material,
into whatever directory it was started from.
A native run outside a container now defaults to the platform's per-user data
directory: $XDG_DATA_HOME/floci-aws (or ~/.local/share/floci-aws) on Linux,
~/Library/Application Support/floci-aws on macOS, %LOCALAPPDATA%\floci-aws on
Windows. HostDefaultsConfigSource sits at ordinal 260, between the bundled
application.yml (255) and config/application.yml (265), so any path the
user configures still wins. The JVM, dev mode and the image keep ./data.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>