mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
e2aefa654bbfb2b7b02ea0bcc53cc6e7c6b95f38
671
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e2aefa654b |
feat(sagemaker): add SageMaker emulation with Docker-backed training (#1949)
Implement the SageMaker control plane over the AWS JSON 1.1 protocol
(X-Amz-Target: SageMaker.*) plus the runtime invocation path:
- Models, endpoint configs, endpoints, training jobs, and tags with
AWS-shaped validation errors (ValidationException / ResourceInUse)
- CreateTrainingJob runs the training image as a real Docker container
using the /opt/ml contract: hyperparameters, resourceconfig and
inputdataconfig under /opt/ml/input/config, S3 channel data under
/opt/ml/input/data/<channel>, and /opt/ml/model uploaded back to S3
as model.tar.gz under the configured S3OutputPath
- CreateEndpoint hosts the model image as a long-lived container with
the serve command, /ping health checks, and ModelDataUrl artifacts
extracted into /opt/ml/model
- POST /endpoints/{name}/invocations proxies to the container and maps
model 5xx responses to ModelError (HTTP 424) like SageMaker Runtime
- Training container logs stream to CloudWatch Logs under
/aws/sagemaker/TrainingJobs
- Storage wired through StorageFactory with memory/persistent modes,
config in EmulatorConfig and both application.yml files
- Unit, integration, and Docker-gated integration tests plus a boto3
compatibility test; service and docs registered in the catalog
|
||
|
|
801edd863d |
feat(macie2): add member administration (#3488)
* feat(macie2): add member administration * fix(macie2): align member account fidelity * fix(macie2): align member pagination limit |
||
|
|
5db516d9d5 |
feat(sfn): Map ItemReader with s3:listObjectsV2 (#3460)
* feat(sfn): support the s3:listObjectsV2 Distributed Map ItemReader The Map state listed the resource as accepted at CreateStateMachine but failed every execution with States.ItemReaderFailed. It now calls the S3 service in process, reads every page under Prefix, and gives each child the AWS item shape: Etag, Key, LastModified, Size and StorageClass. Bucket and Prefix come from Parameters or JSONata Arguments. An empty prefix succeeds with zero iterations and ReaderConfig.MaxItems trims the list. LastModified is epoch seconds. Real AWS renders it as a double in JSONPath state machines and as an integer in JSONata ones, and the emulator does the same. Fixes #3409 * fix(sfn): evaluate ItemSelector in JSONata Map states A JSONata Map state passed ItemSelector through the JSONPath resolver, so every {% %} expression reached the child as a literal string. The Map state now resolves ItemSelector as a JSONata template with $states.input bound to the Map input and $states.context.Map.Item carrying Value and Index, as on AWS. Real AWS evaluates ItemSelector before it records MapIterationStarted. A failing expression therefore fails the Map state without any event for that iteration, in both query languages. The evaluation moved ahead of the iteration event to match. Verified against real Step Functions in us-east-1 on 2026-09-12. * chore(sfn): simplify the listObjectsV2 reader and the ItemSelector failure path The reader listed the bucket page by page although the S3 service returns the whole sorted listing in one call. The Map state kept two copies of the iteration failure handling. The tests reuse the shared mapper and one JSONata Map definition. * perf(sfn): cap the listObjectsV2 listing at MaxItems ReaderConfig.MaxItems keeps the first keys in key order on AWS, which is what the S3 service returns for maxKeys. The reader now passes MaxItems to the listing instead of building every item and trimming afterwards. * chore(sfn): declare local types in the listObjectsV2 reader Replace var with explicit types in the production code this branch added. * chore(sfn): declare local types in the listObjectsV2 reader tests Replace var with explicit types in the test code this branch added. * fix(sfn): list every object when MaxItems is absent S3Service now treats max keys 0 as a request for an empty page, as AWS does for max-keys=0. The listObjectsV2 reader passed 0 when ReaderConfig.MaxItems was not set, so the Map got no items. It now asks for Integer.MAX_VALUE in that case, like the DynamoDB import path. |
||
|
|
86072aaa84 |
fix(lambda): back off DynamoDB Streams retries and expire aged records (#3613)
* fix(lambda): back off DynamoDB Streams ESM retries and enforce MaximumRecordAgeInSeconds * fix(lambda): treat unset MaximumRecordAgeInSeconds as no age cutoff Keep expired records retrying when no finite Lambda age limit is configured. |
||
|
|
265344e304 |
feat(docs): add a service inventory reconciler and fix what it found (#3656)
* feat(docs): add a service inventory reconciler and fix what it found
"How many AWS services does Floci support?" had no answer anyone could defend.
Every source in the repo gave a different number, and two of them were written
down and contradicted each other: docker/localstack-parity.sh said Floci starts
"all 41 services" while migrate-from-localstack.md said "all 58". Neither is
close: the catalog registers 124 descriptors today.
tools/docs/service_inventory.py reconciles the five keyspaces that each answer a
slightly different question, and explains every delta rather than picking a
number: catalog descriptors, the config plane (EmulatorConfig accessors against
application.yml keys), Java packages under services/, the docs pages, and the
service matrix. It reports 119 documented services, 127 distinct API surfaces and
124 signing endpoints, and says which to quote for which question. 27 tests cover
the normalisation and the delta arithmetic.
It also enforces the rule that made this necessary: never write a count into
README.md or docs/, link to the Service Matrix instead. So the two stale counts
are removed rather than corrected, and the parity script and migration guide now
say "every service".
Three services the README's category table omitted are added: Lambda MicroVMs,
Cognito Identity and Bedrock AgentCore Control, each backed by a descriptor or a
docs page.
Two service-matrix corrections the reconciler surfaced:
- The sso alias pointed at iam, so the matrix resolved Identity Center's admin
API to the IAM page's facet. ResolvedServiceCatalog registers
descriptor("sso", "ssoadmin", ...) and docs/services/ssoadmin.md is its own
page, so the alias now points there.
- Both bedrock-agentcore deferrals are retired. bedrock-agentcore.md exists now,
so that entry has served its purpose; bedrock-agentcore-control has no page and
never needed one, because the control plane owns the shared page, so it becomes
an alias instead of a deferral that would expire and need renewing. The
deferred list is now empty.
check_service_matrix.py --strict passes before and after, so the matrix changes
are tidy-up rather than a fix for a failing gate.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* docs: add the STS README row the inventory tool still reported
The tool's own output at the previous head listed STS as the one service
with a Service Matrix row but no README category-table entry, the same
gap this branch closed for Lambda MicroVMs, Cognito Identity and Bedrock
AgentCore Control. Add it next to IAM, so section 5 of the report now
shows zero missing rows.
Also drop the unused pathlib import from the inventory test.
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
|
||
|
|
a1eb65debd |
docs(testcontainers): add the .NET module page (#3655)
* docs(testcontainers): add the .NET module page Testcontainers.Floci exists and is published, but nothing in the docs pointed at it: no page, no mkdocs nav entry, no line in the language guide, and no row in either module table. The module table listed Java, Node.js, Python and Go, so a reader had no way to discover the .NET one. Adds docs/testcontainers/dotnet.md in the shape of the Java and Node pages, and wires it into the nav, the language list, and the tables in docs/testcontainers/index.md and README.md. Two things the other pages never have to explain are called out. The package is served from GitHub Packages rather than nuget.org, so it needs a nuget.config and a token with the read:packages scope. And the container-backed services carry the macOS caveats: the default RDS ProxyBasePort of 7000 collides with AirPlay Receiver, clients should use 127.0.0.1 rather than localhost to avoid IPv6, and the RDS proxy does not negotiate TLS. A Colima note covers the Ryuk socket path. The table row reads "see releases" rather than a version number. .NET releases on every push to main, so a number written here is stale on arrival; the other rows carry a version because their registries publish discrete releases. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * docs(testcontainers): require package source mapping on the .NET page The nuget.config snippet added only the floci-io feed as a source, but Testcontainers.Floci is also published on nuget.org by the Testcontainers project, so a consumer with both sources configured could resolve that package instead of this module. Mirror the module README: keep both sources, add the credentials block, and route exactly Testcontainers.Floci to the floci-io feed through packageSourceMapping with everything else on nuget.org. Drop the dotnet nuget add source command, which registers the feed under a different name and cannot create the mapping, and link the feed to the package page. --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
1319ed19bc |
feat(sfn): honour ToleratedFailureCount and ToleratedFailurePercentage (#3605)
* feat(sfn): apply ItemBatcher to distributed Map children
ItemBatcher was parsed and then ignored: every child execution received one
item regardless of MaxItemsPerBatch, so a state machine that batches ran with a
different payload shape locally than on AWS, silently.
Items are now grouped into batches and each child execution receives
{"BatchInput": ..., "Items": [...]}. A batch closes on MaxItemsPerBatch or
MaxInputBytesPerBatch, in their literal, Path and JSONata expression forms, and
with neither set every item lands in one batch. ItemSelector still runs per item
before grouping, so the transform sees $$.Map.Item as it did before.
MaxConcurrency now bounds concurrent batches, and DescribeMapRun separates the
two counters it used to share: itemCounts counts items, executionCounts counts
child executions.
* fix(sfn): cap a batch at the 256 KiB child-input ceiling
MaxInputBytesPerBatch being optional let MaxItemsPerBatch alone build a child
input larger than Step Functions would ever start, and the byte count measured
the items alone, so a declared cap could still be exceeded by the envelope,
BatchInput and separators.
Batching now measures the serialized child payload and closes a batch at the
declared limit or at 256 KiB, whichever is smaller.
* fix(sfn): fail an item too large to start a child execution
An item whose serialized batch input already exceeded 256 KiB was added anyway,
because the split branch is skipped while the batch is empty, producing a child
input AWS would refuse to start.
Such an item now fails the state with States.DataLimitExceeded, naming its size
and pointing at ItemSelector as the way to reduce it.
* feat(sfn): honour ToleratedFailureCount and ToleratedFailurePercentage
Both fields were accepted and ignored: any failed item failed the Map run, and
DescribeMapRun reported a hardcoded zero for each, so a state machine that
relies on a failure budget behaved differently here than on AWS.
A declared tolerance now absorbs failed items while the run stays within it. An
absorbed failure contributes no result, so the Map output and any ResultWriter
export cover the successful children only. Exceeding the budget fails the state
with States.ExceedToleratedFailureThreshold. Both fields accept their literal,
Path and JSONata expression forms, the percentage is taken over the item count,
and declaring both applies the stricter of the two.
DescribeMapRun now reports the declared values. A Map that declares neither is
unchanged: the first failed item still fails the state with its own error.
* fix(sfn): export tolerated failures to FAILED_0.json
Filtering the ResultWriter input down to the successful children dropped every
absorbed failure from the export, which is exactly what the tolerance is meant
to keep observable.
Failed children now keep their input, timings and error, and are written to
FAILED_0.json with Status FAILED and the child's Error and Cause, listed under
ResultFiles.FAILED in the manifest.
* refactor(sfn): resolve every integer Map field through one helper
MaxConcurrency and the ItemBatcher limits read the same three forms, literal,
Path and JSONata expression, through two near-identical methods. The batcher one
already parameterized the field name, so the pair collapses into a single
resolver with a minimum: 0 for MaxConcurrency, where it means the service
ceiling, and 1 for a batch limit, where it is meaningless.
The shared resolver also clamps an oversized value to Integer.MAX_VALUE, which
only the MaxConcurrency copy did before.
|
||
|
|
97cbce205b |
feat(config): add aggregation authorization CRUD (#3627)
* feat(config): add aggregation authorization CRUD PutAggregationAuthorization, DescribeAggregationAuthorizations and DeleteAggregationAuthorization were unrouted, so the JSON handler answered InvalidAction and aws_config_aggregate_authorization could not be created. Authorizations are keyed by (AuthorizedAccountId, AuthorizedAwsRegion) within the request region, persisted through StorageFactory like the other durable Config resources. Put is an upsert that preserves the ARN and creation time of an existing authorization, and accepts Tags, which land in the same tag store that ListTagsForResource reads. Delete of an absent authorization succeeds: the Config model declares no not-found error for that operation. * fix(config): remove aggregation-authorization tags on every delete attempt Tag cleanup ran only when the delete found an entry to remove. A delete that removed the authorization but did not reach the tags left them behind, and the retry that should have cleaned them up skipped the cleanup because the entry was already gone. Put reuses a deterministic ARN, so those tags reappeared on the next authorization for the same account and region. The ARN is now derived from the key instead of read off the removed entry, and its tags are dropped on every attempt. The authorization map is still persisted only when an entry was actually removed. * fix(config): apply PutAggregationAuthorization tags at creation only PutAggregationAuthorization is idempotent, and AWS applies request tags at creation only: a later Put that finds the authorization already there ignores its Tags and leaves the existing ones alone. Tagging the existing ARN on every Put let a local test retag by re-putting, which production would silently refuse. Return the existing authorization untouched and tag only the one just created. Tags still change through TagResource/UntagResource, which is the only way AWS offers. * fix(config): make aggregation authorization put/delete atomic putAggregationAuthorization did a get-then-put on the region map with nothing holding the two together, and deleteAggregationAuthorization removed-then- persisted the same way. Two concurrent Puts for one (AuthorizedAccountId, AuthorizedAwsRegion) could both find nothing and both create: the second overwrote the first's CreationTime and re-applied creation tags over a set TagResource may already have changed, so the documented idempotency held only probabilistically. Both now take the same per-key lock putConfigRule/deleteConfigRule already use for rules. The lock keys are namespaced apart from the rule keys in the shared map rather than relying on rule names never containing '|'. The regression runs many short rounds rather than one wide one, because the unlocked window is a few instructions: repeated fresh starts land the race, more threads on one start do not. It asserts reference identity, which is what distinguishes the two cases -- the store is keyed on the pair so its size is 1 either way, the ARN is derived from the key so it is equal either way, and CreationTime is epoch seconds so a racing pair created inside one second is indistinguishable by timestamp. Verified to fail with the lock removed (17 mismatches) and pass with it, five runs. |
||
|
|
7813d14ee4 |
feat(network): add opt-in security group enforcement (#3681)
* feat(network): add opt-in security group enforcement * fix(ec2): make security group tests order independent * fix(network): emit valid ICMP nft rules and restart protected instances Three review findings on the opt-in security-group enforcement foundation: - SecurityGroupNftCompiler built "icmp type 8 code 0 accept" for an AWS ICMP rule carrying both FromPort (type) and ToPort (code). nftables header fields are separate expressions, so nft rejected the whole compiled policy and the manager then quarantined every endpoint. Each field now repeats the protocol keyword, and a protocol rule with no type or code becomes "meta l4proto icmp accept", which was equally invalid as a bare "icmp accept". - StartInstances followed the legacy restart path for a protected workload and waited for a Docker bridge IP on a container that shares the helper's network namespace and so has no attachment of its own. The helper survives the workload's stop, so start now reuses its transport address exactly as launch does, and skips the reachable private address rewrite the same way. - Replaced the newly introduced var declarations with explicit types and imported the inline java.util/model FQCNs, per AGENTS.md. * fix(network): scope the firewall helper to CAP_NET_ADMIN The helper only has to program nftables inside the namespace Docker already gave it, so full --privileged granted far more than the feature needs. ContainerLifecycleManager now adds CAP_NET_ADMIN for the container carrying the floci.security-group-helper label, mirroring the capability drop already applied to protected workloads at the same choke point, and the helper spec no longer asks for privileged mode. Also replaces the inline java.util FQCNs the previous commit missed in Ec2Service with imports, per AGENTS.md. --------- Co-authored-by: Alexy Grabov <Alexy.Grabov@cyberark.com> |
||
|
|
d3bfe2609c |
feat(redshift): implement zero-ETL integrations (#3559)
* feat(redshift): implement zero-ETL integrations
DescribeIntegrations had no implementation, so an application that
discovers its zero-ETL integration at runtime could not run against the
emulator.
Implementing that action alone would have been worse than leaving it out.
A caller matches its integration by SourceArn and treats "no match" as a
hard error, so an action that always answered with an empty list would turn
a clean "unsupported" into a confusing "no integration whose source is the
X table". CreateIntegration and DeleteIntegration come with it, so an
integration can exist and the empty list means what it says.
Shape captured from a live integration in us-west-2:
- Status is lower case ("active"), not ACTIVE
- Errors is present but empty on a healthy integration
- the record carries IntegrationArn, IntegrationName, SourceArn,
TargetArn, Status, CreateTime, KMSKeyId, Tags and
AdditionalEncryptionContext
- describing with an unknown IntegrationArn is IntegrationNotFoundFault,
"The requested integration doesn't exist."
- an account with no integrations answers with an empty list, not an
error
- no Marker element is emitted when there is no further page, which is
what stops a caller's pagination loop
This is metadata only: nothing replicates from the source, and the
integration settles as active immediately rather than passing through
creating, because there is no work for it to do.
* fix(redshift): correct the integration Query contract
Three gaps against the modelled Query API, each confirmed in the bundled
botocore service model rather than taken on trust.
Tags arrive under TagList, not Tags. The shape is a list whose member
carries locationName Tag, so a real client sends TagList.Tag.N.Key and
.Value. Reading Tags.Tag.N meant every tag an SDK sent was silently
dropped, which a hand written form-encoded test did not catch because it
used the wrong name too.
DescribeIntegrations is paginated and filterable. MaxRecords, Marker and
Filters.DescribeIntegrationsFilter.N were all ignored, so the operation
only worked while every record fitted in one response and a caller using
filters got unrelated integrations back. MaxRecords honours the documented
20 to 100 range, the marker is the last ARN already returned rather than an
offset, and no Marker is emitted on the terminal page. The four modelled
filter names are implemented: integration-arn, source-arn, source-types and
status. An unrecognised name is rejected rather than ignored.
CreateIntegration advertises Description and AdditionalEncryptionContext.
Both are now parsed, stored and rendered, with the documented rule that the
encryption context is only valid alongside a KMSKeyId, and Description
capped at the modelled 1000 characters.
* test(redshift): cross a real page boundary in the marker regression
The previous test created three integrations and asked for twenty, so it
only proved the terminal case: no Marker when everything fits. It never
forced a second page, never asserted a non-terminal page carries a Marker,
and never sent one back.
It now creates twenty-one records against the smallest legal page size and
walks every page, asserting that a full page carries exactly MaxRecords
records and a Marker, that no record appears on two pages, that the final
page omits the Marker, and that the traversal returns the same set as a
single large page. Other tests in this class share the store, so the
assertions are about the traversal rather than absolute counts.
* feat(redshift): validate IntegrationName against the modelled pattern
CreateIntegration only checked IntegrationName for non-blank, so a name
real AWS refuses was accepted: the member is modelled min 1, max 63,
pattern ^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9]+)*$. A leading digit or
hyphen, an underscore, a doubled hyphen and a trailing hyphen all got
through, as did a name over 63 characters.
Validate both constraints in createIntegration, alongside the existing
Description length and encryption-context rules.
Three regressions cover the rejected shapes, the over-length case and
acceptance at the 63 character boundary.
|
||
|
|
3c23784ca7 | feat(s3): evaluate bucket policies for authenticated callers (#3632) | ||
|
|
144b90e6fa |
fix(apigateway,appsync): sandbox VTL rendering with SecureUberspector and execution limits (#3542)
* fix(apigateway,appsync): sandbox VTL rendering with SecureUberspector and execution limits
VtlTemplateEngine and AppSyncVtlEngine rendered templates with Velocity's
default UberspectImpl introspector, which allows arbitrary reflection
through any context object (e.g. $util.getClass().forName('java.lang.Runtime')),
and had no cap on #foreach iterations, output size, or execution time,
making them vulnerable to both sandbox escapes and denial of service via
runaway loops or #set string doubling.
Add a shared VtlSandbox helper that both engines call to switch to
SecureUberspector and restrict introspection on java.lang.Class,
ClassLoader, Runtime, ProcessBuilder, System, Thread, java.io.File and
related reflection/scripting/process packages, plus three independent
limit layers: a native #foreach loop cap that truncates the loop without
failing the template, a cooperative execution deadline checked from a new
SandboxedForeach directive before each loop iteration, and a BoundedWriter
output-size cap. The latter two throw the new VtlLimitExceededException,
an unchecked RuntimeException that flows through each engine's existing
error handling exactly like any other Velocity evaluation failure, with
no new error shape. Limits are configurable via EmulatorConfig
(vtlMaxLoops, vtlMaxOutputChars, vtlTimeoutMillis; application.yml keys
vtl-max-loops, vtl-max-output-chars, vtl-timeout-millis), mirroring the
project's existing per-service numeric-tunable config pattern, and
documented in api-gateway.md and appsync.md.
The classpath-shadowed velocity.properties resource is kept for any
embedding that resolves it normally, but is not the actual enforcement
point: under this project's test/runtime classloader, Velocity's own
getResourceAsStream lookup for that exact resource path can resolve to
the copy bundled inside the velocity-engine-core jar instead of this
project's shadowed copy, silently leaving the insecure UberspectImpl
active even with a correct properties file on disk. VtlSandbox configures
SecureUberspector and swaps in SandboxedForeach directly via the
VelocityEngine Java API instead, which is unaffected by that ambiguity.
* docs(apigateway): correct foreach registration documentation
|
||
|
|
2ee3aa67c0 |
feat(apigateway): support Gateway Responses on REST APIs (#3326) (#3585)
Add the PutGatewayResponse / GetGatewayResponse / GetGatewayResponses /
UpdateGatewayResponse / DeleteGatewayResponse family, keyed per REST API by
responseType across the 21 AWS types. Uncustomised types are reported with
defaultResponse=true, their AWS default statusCode and the default
{"message":$context.error.messageString} template; UpdateGatewayResponse
patches /statusCode, /responseParameters/<name> and
/responseTemplates/<content-type>, and DeleteGatewayResponse restores the
default.
ImportRestApi and PutRestApi read the x-amazon-apigateway-gateway-responses
extension, and AWS::ApiGateway::GatewayResponse is provisioned by a new
CloudFormation provisioner whose Ref / Fn::GetAtt Id is
<restApiId>-<responseType>.
On the execute plane every gateway-generated answer (unmatched path or
method, AWS_IAM and Lambda authorizer rejections, missing API key, request
validation, unsupported media type, integration configuration errors and
Lambda proxy failures) resolves the customisation for its type, then
DEFAULT_4XX / DEFAULT_5XX, and applies the configured statusCode, the
gatewayresponse.header.* parameters (static, method.request.*, context.*,
stageVariables.*) and the response templates, with $context.error.* exposed
to VTL. An expired SigV4 signature selects EXPIRED_TOKEN and a malformed or
mismatching one INVALID_SIGNATURE, as AWS keeps those two contracts apart.
This is what puts Access-Control-Allow-Origin on a browser-visible
401/403/400 so the frontend can read the real status instead of a CORS
failure. Without a customisation every answer is unchanged.
Closes #3326
|
||
|
|
6f05442218 |
feat(bedrock-agentcore): implement InvokeHarness (#3557)
* feat(bedrock-agentcore): implement InvokeHarness InvokeHarness was the last gap keeping an application's agent chat on real AWS. #3556 added the Memory event data plane, so conversation history works locally, but the invoke call itself had nothing to answer it. There is no agent loop here and no model. What is emulated is the wire contract an application integrates against: POST /harnesses/invoke returns an application/vnd.amazon.eventstream response carrying messageStart, contentBlockStart, one contentBlockDelta per chunk, contentBlockStop, messageStop and metadata, in that order. The reply echoes the caller's last user message, which makes a chat client visibly work end to end and leaves a request that failed to parse obvious rather than hidden behind a fixed string. The wire bindings are the part worth knowing, and they are not what the request model suggests. harnessArn and qualifier are query parameters, runtimeSessionId and runtimeUserId are headers (X-Amzn-Bedrock-AgentCore-Runtime-Session-Id / -User-Id), and only messages, model and tools travel in the JSON body. Reading them from the body compiles, passes a hand-written test, and then fails against the real SDK with "harnessArn is required". A request carrying no user message is legitimate rather than an error: a caller whose memory already holds the current turn sends none, so that case answers with a canned line. harnessArn is not resolved, because the emulator models no harness resource; InvokeAgentRuntime is permissive for the same reason. BedrockStreamEncoder moves to core/common as AwsEventStreamWriter and becomes public, next to the AwsEventStreamEncoder it already delegates to. Both services now share one frame writer rather than duplicating the header-map wrapper. bedrock-runtime keeps its behaviour and its streaming tests are the regression guard. Tool execution, skills and multi-turn iteration are not emulated, so no tool-use block is produced even when a request supplies tools. * fix(bedrock-agentcore): validate the InvokeHarness request contract messages is a required member. Treating a missing or non-array field the same as an empty array made an omitted required member indistinguishable from a legitimate empty one, so the two are now separated: an empty array still gets the canned reply, an absent member is a ValidationException. harnessArn and runtimeSessionId were only checked for being non-blank. Both carry modelled constraints, taken from the bundled botocore service model rather than guessed: harnessArn arn:...:bedrock-agentcore:<region>:<account>:harness/ <name>-<10 alphanumerics> runtimeSessionId 33 to 100 characters, [a-zA-Z0-9][a-zA-Z0-9-_]* Real AgentCore enforces the ARN shape before anything else: an ARN of harness/h-1 comes back as "Invalid harness ARN format" even when the rest of the request is wrong too, which is why the test values in this branch had to change. The ARN's shape is checked but the harness is still not resolved, because the emulator models no harness resource. A well formed ARN naming nothing is accepted, and has a test saying so. * fix(bedrock-agentcore): report a malformed harness ARN before a missing session id The ARN shape was checked after both presence checks, so a request carrying a malformed ARN and no runtimeSessionId header came back as "runtimeSessionId is required" rather than the ARN error AWS returns. No test exercised two bad fields at once. The ARN is now validated whole, presence and shape together, before runtimeSessionId is read. |
||
|
|
917e94914f |
feat(sfn): apply ItemBatcher to distributed Map children (#3604)
* feat(sfn): apply ItemBatcher to distributed Map children
ItemBatcher was parsed and then ignored: every child execution received one
item regardless of MaxItemsPerBatch, so a state machine that batches ran with a
different payload shape locally than on AWS, silently.
Items are now grouped into batches and each child execution receives
{"BatchInput": ..., "Items": [...]}. A batch closes on MaxItemsPerBatch or
MaxInputBytesPerBatch, in their literal, Path and JSONata expression forms, and
with neither set every item lands in one batch. ItemSelector still runs per item
before grouping, so the transform sees $$.Map.Item as it did before.
MaxConcurrency now bounds concurrent batches, and DescribeMapRun separates the
two counters it used to share: itemCounts counts items, executionCounts counts
child executions.
* fix(sfn): cap a batch at the 256 KiB child-input ceiling
MaxInputBytesPerBatch being optional let MaxItemsPerBatch alone build a child
input larger than Step Functions would ever start, and the byte count measured
the items alone, so a declared cap could still be exceeded by the envelope,
BatchInput and separators.
Batching now measures the serialized child payload and closes a batch at the
declared limit or at 256 KiB, whichever is smaller.
* fix(sfn): fail an item too large to start a child execution
An item whose serialized batch input already exceeded 256 KiB was added anyway,
because the split branch is skipped while the batch is empty, producing a child
input AWS would refuse to start.
Such an item now fails the state with States.DataLimitExceeded, naming its size
and pointing at ItemSelector as the way to reduce it.
* refactor(sfn): resolve every integer Map field through one helper
MaxConcurrency and the ItemBatcher limits read the same three forms, literal,
Path and JSONata expression, through two near-identical methods. The batcher one
already parameterized the field name, so the pair collapses into a single
resolver with a minimum: 0 for MaxConcurrency, where it means the service
ceiling, and 1 for a batch limit, where it is meaningless.
The shared resolver also clamps an oversized value to Integer.MAX_VALUE, which
only the MaxConcurrency copy did before.
|
||
|
|
38d1d0a8e4 |
feat(glue): implement partition indexes (#3551)
* feat(glue): implement partition indexes
CreatePartitionIndex and DeletePartitionIndex were missing, and
GetPartitionIndexes was a stub that resolved the table and then always
returned an empty list. A client could create an index and read back
nothing, and Terraform's aws_glue_partition_index could not apply at all.
Behaviour captured against real Glue in us-west-2, on a table partitioned
by tenant/year/month/day:
- an index key must name a partition column, else InvalidInputException
"IndexKeys not a part of PartitionColumns. Verify the indexKeys : [x]"
- keys need not be a prefix of the partition keys, and need not be in
partition order: [year] and [month, tenant] are both accepted
- a repeated index name gives AlreadyExistsException "... already exists
with the same name."
- a repeated key list under a new name is refused too: "... already
exists with the same keys." The comparison is order sensitive, so
[year, month] and [month, year] are distinct indexes
- a fourth index gives ResourceNumberLimitExceededException "Partition
index limit exceeded. Maximum: 3", and the cap is evaluated before the
duplicate checks
- deleting an unknown index gives EntityNotFoundException "Index with the
given indexName : x does not exist."
- a read resolves each key to its name and type from the table's
partition keys, while a create carries names only
Indexes live in their own store keyed by the table key, so the existing
deleteTable cascade sweeps them and a recreated table starts clean.
One deliberate divergence: an index is stored ACTIVE immediately. Real
Glue creates asynchronously, reports CREATING while it backfills, and
refuses a concurrent create on the same table. Settling immediately keeps
tests free of polling, and a client that waits for ACTIVE (the Terraform
provider does) completes on its first read.
Verified end to end against a local floci: the SDK round-trips create,
read and delete, every error above matches the capture, and a real
aws_glue_partition_index applies and destroys cleanly.
* feat(glue): expose the partition index lifecycle
The first cut stored an index ACTIVE on create and removed it on delete,
treating the lifecycle as an internal detail. It is not: a caller reads
IndexStatus from GetPartitionIndexes and can branch on it, so collapsing
the states changed an AWS-visible contract.
Captured against real Glue in us-west-2:
- a new index reports CREATING for roughly 12 seconds, then ACTIVE
- a deleted index reports DELETING before it disappears
- while either is in progress, another create on the same table gives
ResourceNumberLimitExceededException "Index <name> is in <STATE>
state. Only 1 index can be created or deleted simultaneously per
table."
- an index that is still CREATING cannot be deleted: Glue reports
EntityNotFoundException "Index with the given indexName : <name> does
not exist." even while a read lists it as CREATING. Measured in
isolation, with nothing else in flight
The transitions are driven by reads rather than wall-clock time, so they
stay deterministic and tests need no sleeps: each GetPartitionIndexes
reports the current state and settles it, so the next read sees the
outcome. A client that polls converges on its second call.
FAILED is not emulated; it only arises from a backfill failure.
Verified with a real aws_glue_partition_index against a local floci:
apply polls CREATING to ACTIVE and completes, a refresh reports no drift,
and destroy passes through DELETING.
Also replaces var with explicit types and drops inline fully-qualified
names in the tests, per the AGENTS.md rule.
* docs(glue): correct two javadocs left behind by the index lifecycle
Both still said an index is stored ACTIVE immediately, which stopped being
true when createPartitionIndex started storing CREATING and letting
GetPartitionIndexes settle it.
* fix(glue): serialize partition index writes against their own reads
createPartitionIndex reads the stored indexes, checks the cap and the duplicate
rules, then writes, with nothing holding that together. Two concurrent creates
on a table at two indexes both saw room under the cap of three and both wrote,
leaving four. Nothing repairs that afterwards.
create, delete and the settling loop in getPartitionIndexes now carry the same
synchronized treatment updateTable already uses for its own check-then-write.
|
||
|
|
43a0d737e9 |
perf(iam): cache parsed policy and lowercase patterns once (#3635)
* perf(iam): cache parsed policy documents in IamPolicyEvaluator Every evaluate call parsed each policy document with Jackson again. A caller with a large managed policy such as ReadOnlyAccess (94 KB) paid that parse on every request under IAM enforcement. The evaluator now keeps the parsed statements per document text in a ConcurrentHashMap. Parsing is a pure function of the text, so entries never go stale. The map is bounded at 2048 entries and cleared when the bound is reached, which only matters for many distinct session policies. A document that fails to parse is cached as failed, so the warning is logged once instead of on every request. AWS managed policy catalog has 1566 documents. All 1566 parsed take about 9.5 MB of heap, and AWS caps a customer managed policy at 6144 characters and a session policy at 2048, so 2048 entries stay within tens of MBs in the worst case. * perf(iam): store policy patterns lowercased in the parsed statement cache Action and Resource matching is case-insensitive. globMatches lowercased both the pattern and the request value on every comparison, which for a policy like ReadOnlyAccess meant about 5800 new strings per request. The patterns are now lowercased once when the document is parsed and cached, and the request action and resource are lowercased once per evaluation. The public globMatches helper used by the trust policy and S3 public access evaluators is unchanged. * fix(iam): compare resource ARNs case-sensitively AWS documents the Action element as case-insensitive, but the Resource element is not: the IAM user name in a Resource ARN is case sensitive, and so are S3 object keys. The evaluator lowercased both sides of every Resource and NotResource comparison, so a grant on user/Bob also matched user/bob and a grant on bucket/Private/* also matched bucket/private/*. Resource and NotResource patterns are now kept as written in the parsed statement cache and the request resource is compared as is. Action and NotAction patterns stay lowercased once at parse time. |
||
|
|
c7b4a393d9 |
fix(rds): support IPV6 and DUAL network types on RDS Proxy (#3639)
CreateDBProxy/AWS::RDS::DBProxy rejected EndpointNetworkType/TargetConnectionNetworkType
outright for anything other than IPV4 ("Floci currently exposes IPv4 proxy networking only").
Both fields are now accepted and stored on the DbProxy record:
- EndpointNetworkType: IPV4, IPV6, or DUAL
- TargetConnectionNetworkType: IPV4 or IPV6 (no DUAL, matching AWS's own constraint)
They round-trip through DescribeDBProxies and CloudFormation the same way the proxy's other
control-plane settings (pool sizing, TLS, idle timeout) already did.
AWS's RDS Proxy network prerequisites require both the VPC and every selected subnet to carry
an associated IPv6 CIDR block for IPV6/DUAL. floci already modeled VPC-level IPv6 CIDR
associations; subnet-level association is now modeled too (Subnet.ipv6CidrBlockAssociationSet,
CreateSubnet's Ipv6CidrBlock parameter, and the DescribeSubnets/CreateSubnet response), and
createDbProxy validates both the VPC and every VpcSubnetIds entry before accepting a non-IPV4
network type, rejecting with InvalidParameterValue otherwise. Genuinely invalid enum values are
still rejected at both the RDS Query API and CloudFormation provisioner layers.
The CloudFormation update path now also refuses a changed EndpointNetworkType or
TargetConnectionNetworkType the same way it already refused a changed DBProxyName, EngineFamily,
or VpcSubnetIds: both are createOnlyProperties in the AWS::RDS::DBProxy registry schema, and
ModifyDBProxy has no such parameters, so silently accepting a changed value on UpdateStack would
report UPDATE_COMPLETE while the proxy's actual network type stayed put.
Added a Terraform compatibility scenario (rds-proxy-network-type-tf) with a genuinely
dual-stack VPC and subnets, plus negative cases for an IPv4-only VPC and for a dual-stack VPC
whose subnets lack an IPv6 CIDR block.
|
||
|
|
315dfe69f0 |
fix(rds): support tagging DB snapshots (#3649)
TagResource/UntagResource/ListTagsForResource rejected a snapshot ARN
outright ("not yet implemented by Floci"), and CreateDBSnapshot
silently dropped its Tags parameter even though DbSnapshot already had
a tags field. Both are now wired up: CreateDBSnapshot stores Tags, the
generic tag-resource dispatch resolves a "snapshot" ARN type against
the snapshot store, and DescribeDBSnapshots echoes DBSnapshotArn and
TagList like the other tagged resource types already do.
Snapshots are now region-scoped the same way DB instances and clusters
already are: CreateDBSnapshot/DescribeDBSnapshots/DescribeDBSnapshot-
Attributes/ModifyDBSnapshotAttribute/RestoreDBInstanceFromDBSnapshot
all thread the request's signed region through to snapshot storage and
lookup (via the same dbResourceKey/hasRdsResourceIdentity scoping the
instance/cluster stores use), so DBSnapshotArn reflects the request's
actual region and a snapshot created in one region is not visible to
Describe/Tag calls signed for another.
Verifying this live against a real floci instance via Terraform
surfaced two more gaps blocking any use of aws_db_snapshot at all,
regardless of tagging: DescribeDBSnapshotAttributes (called on every
read of the resource) and ModifyDBSnapshotAttribute were both
completely unimplemented. Added minimal support for both (the
"restore" attribute, i.e. cross-account copy/restore authorization,
modeled as plain in-memory state, no real cross-account sharing).
DeleteDBSnapshot is also unimplemented and was not added here — a
snapshot can be created and tagged but not destroyed via Terraform.
Noted in docs/services/rds.md as a follow-up, along with the other
resource types the original gap report mentioned (Aurora cluster
snapshots, reserved instances) that aren't modeled in Floci at all, so
tagging doesn't apply to them either.
Added a Terraform compatibility scenario (aws_db_snapshot with tags,
verifying create, tag read-back, a clean second plan, and an in-place
tag update) and ran it against a live floci instance before
committing, including a re-run after the region-scoping fix.
|
||
|
|
74d4782b51 |
feat(batch): support array and multi-node parallel jobs (#3595)
SubmitJob previously rejected arrayProperties/nodeProperties/nodeOverrides outright. Array jobs now fan out real child jobs (<parentId>:<index>) that run through the existing single-job pipeline; the parent's status and arrayProperties.statusSummary are computed live from its children on every DescribeJobs/ListJobs call instead of being stored and incrementally updated, which avoids a race between concurrently finishing children. Multi-node parallel jobs are supported via a new "multinode" job definition type (numNodes/mainNode/nodeRangeProperties, validated for full node coverage). SubmitJob runs one Docker container per node concurrently; per AWS's documented MNP semantics, the job's status, retry decision, and started/stoppedAt/statusReason are all determined solely by the main node, not by any node that happens to fail. nodeOverrides.numNodes is supported with AWS's real validation (requires an open-ended node range). ListJobs gains arrayJobId and multiNodeJobId support. dependsOn (job dependencies), CancelJob/TerminateJob (not implemented at all, pre-existing), EventBridge forwarding of these new fields, and CloudFormation-provisioned multinode job definitions remain out of scope and are noted in docs/services/batch.md. |
||
|
|
a5ebda01fb |
feat(ui): publish a console contract so any web console can be the sidecar (#3641)
Floci could run exactly one web console, the image it ships. This publishes the contract between Floci and a console so any image can take that slot, and an operator gets there by setting one image name rather than by configuring seven fields. Three things make a console a Floci console: it listens on the port in PORT, it serves GET /api/health, and it talks to Floci at AWS_ENDPOINT_URL. Everything else is detail the contract spells out, including the AWS baseline every launched container already receives, so a console built on any AWS SDK is configured by that SDK's ordinary endpoint and credential discovery. Floci learns a console's shape from three sources, in order. The image's own io.floci.console.* labels come first, so a console describes itself and needs no operator input at all. A built-in profile covers the consoles Floci already knows. The contract defaults (/api/health, port 4500, status: ok) cover the rest. Configuration overrides all three, for a console that describes itself neither way. That ladder is why the new config keys ship commented out in application.yml. They exist for the console that fits none of the three sources, and setting one silently disables the discovery that would otherwise just work. Every accessor is Optional or OptionalInt, so nothing is required and the test configuration needs no entry. A malformed label is ignored rather than fatal: a console that declares port="banana" starts on the default instead of failing the emulator, and the reason is logged. Docs: docs/ui/console-contract.md is the contract itself, written for console authors, and docs/ui/index.md is the operator's page. Both are in the mkdocs nav. Tests: 608 lines. ConsoleProfileResolverTest covers the resolution ladder including the precedence between its three sources; ContainerLifecycleManagerImageLabelsTest covers reading labels off an image; FlociUiManagerTest grows to cover the manager against the contract. Neutralising the label arm fails 5 of the 13 resolver tests, so the ladder is genuinely exercised rather than the tests only asserting defaults. |
||
|
|
6ce3fbbd2e |
fix(cloudwatchlogs): bound stored events and enforce retention (#3611)
* fix(cloudwatchlogs): cap stored log events and enforce retention on ingest * docs(cloudwatchlogs): document max-stored-events and the slower log flush interval * fix(cloudwatchlogs): scope eviction to the ingesting account Use explicit account storage operations for retention and capacity eviction. * docs(cloudwatchlogs): note the stored-event ceiling applies per account * docs(cloudwatchlogs): document that the stored-event ceiling is best-effort under concurrent ingest |
||
|
|
1482d45b6e |
fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range (#3626)
* fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range A new queue reported MaximumMessageSize 1048576, four times the AWS default and above the AWS maximum, and nothing rejected an out-of-range value on CreateQueue or SetQueueAttributes. GetQueueAttributes with All also omitted SqsManagedSseEnabled, which AWS returns for every standard queue. Default max-message-size is now 262144, values outside 1024 to 262144 are rejected with InvalidAttributeValue, and All returns the AWS attribute set including SqsManagedSseEnabled (true unless KmsMasterKeyId is set). Raising FLOCI_SERVICES_SQS_MAX_MESSAGE_SIZE above the AWS maximum widens the accepted range with it, so the configured default stays settable explicitly. * fix(sqs): address review findings Cover the shipped default itself: ApplicationDefaultsTest now reads src/main/resources/application.yml and the EmulatorConfig @WithDefault, so reverting either one fails a test rather than passing on the explicit value in src/test/resources/application.yml. Report the MaximumMessageSize that SendMessage enforces. A queue persisted by a build that allowed 1 MB advertised a payload the send path would then reject; GetQueueAttributes and the size check now share parseMaxMessageSize, which also trims like the validation path does. Pin the SNS fan-out size boundary. SNS accepts a publish up to 262144 bytes and SQS accepts a message up to the same 262144, so a non-raw sqs subscriber whose notification envelope pushes the body past the limit is dropped with a warn. That mirrors AWS, and SnsSqsFanoutMessageSizeTest now holds it in place from both sides. Trim the InvalidAttributeValue message to the bare AWS form used elsewhere in the file. * fix(sqs): keep SqsManagedSseEnabled consistent when KmsMasterKeyId changes Creating a queue with a KmsMasterKeyId stored SqsManagedSseEnabled=false. That value outlived the key: clearing KmsMasterKeyId left the stored false behind, and the read path, which only fills the attribute in when absent, kept reporting managed SSE as disabled for a queue that no longer had a KMS key. Stop storing the derived value at all. CreateQueue no longer writes SqsManagedSseEnabled, so anything stored under that name is a value the user set, and it survives. GetQueueAttributes derives the answer on every read: a KMS key wins, an explicit setting stands, and a queue with neither reports the AWS default of true. There is no derived state left to go stale. AWS does not document crisply what happens to SSE-SQS when a KMS key is cleared, so returning to the default is a deliberate choice; the code and docs both say so rather than implying it is copied behaviour. * fix(sqs): raise MaximumMessageSize bounds to the AWS value of 1 MiB The previous commits on this branch set MaximumMessageSize to a default and maximum of 262144 bytes. That was wrong: it is SNS's Publish limit, not SQS's. AWS raised both the SQS maximum and the SQS default from 262144 to 1048576 bytes in August 2025, so the valid range is 1024 to 1048576 with a default of 1048576. Corrected AWS_MAXIMUM_MESSAGE_SIZE, the EmulatorConfig fallback, both application.yml files and the docs. The reject-out-of-range path in validateMaximumMessageSize is unchanged apart from its bounds, as are the SqsManagedSseEnabled derive-on-read behaviour and the DelaySeconds, ReceiveMessageWaitTimeSeconds, MessageRetentionPeriod and VisibilityTimeout backfills. Several tests had been shrunk to fit the wrong ceiling and are restored to the payload sizes they had before this branch. getQueueAttributes now stores an above-ceiling 2097152 so the clamp path stays covered, and a new test pins the ceiling itself: with a lowered configured maximum, a queue may still be set to 1048576, which the old constant rejected. Deleted SnsSqsFanoutMessageSizeTest. Its premise was that an SNS notification envelope reliably pushes a body past the queue's MaximumMessageSize, which no longer holds for the ordinary text it published: SNS caps a publish at 262144 bytes and SQS now accepts 1048576, so the envelope overhead alone does not cross the limit. The boundary has not disappeared, it has moved somewhere the test did not look. Because the envelope is serialized as JSON, escaping expands every control character below 0x20 to six bytes, and publish validates size without inspecting character classes, so a publish made largely of control characters can still overflow a 1 MiB queue. That case is untested; covering it needs a test built around the expansion rather than around envelope overhead. The SNS comment that asserted SQS shared the 262144 ceiling is corrected, and states the escaping caveat rather than claiming the envelope can never cross the queue limit. |
||
|
|
494bab4b30 |
fix(kms): protect ciphertext blobs with an AES-GCM envelope (#3544)
* fix(kms): protect ciphertext blobs with an AES-GCM envelope Symmetric CMK ciphertext was base64(plaintext) dressed up with a cosmetic nonce and context fingerprint: anyone holding a CiphertextBlob could read the plaintext, and any bit flip still "decrypted" to the same value. Encrypt now builds a versioned AES-256-GCM envelope backed by real per-CMK key material, binding the key id, backing key id and canonicalized EncryptionContext as GCM additional authenticated data. Decrypting with the wrong key, the wrong context, or any tampered byte in the header, IV, ciphertext or tag now fails as InvalidCiphertextException instead of leaking or silently accepting corrupted ciphertext. RotateKeyOnDemand mints a new backing key rather than replacing the old one, so ciphertext encrypted before a rotation keeps decrypting after it, matching AWS KMS's own retention of prior backing keys. Legacy v1/v2 blobs already persisted keep decrypting read-only for back-compat; Encrypt never produces them again. Keys persisted before this change generate their backing key material lazily on first use and persist it from then on. Only SYMMETRIC_DEFAULT keys reach this path: SM2 Encrypt/Decrypt is already unreachable via the existing key-usage/algorithm validation, and RSA keeps its existing, already-real RSAES-OAEP handling untouched. * fix(kms): serialize legacy backing key generation under a lock Two concurrent first uses of a key persisted before the AES-GCM envelope existed could each generate a different backing key and both call keyStore.put; the loser's backing key, and any ciphertext already encrypted under it, would become unreachable. Guard the generate-and-persist step with a dedicated lock that re-reads and re-checks the key before minting one, so only one backing key is ever created for a given legacy key, and return the resolved instance so callers use the persisted object. The unsynchronized fast path for already-healed keys is unchanged. Add a test that resolves a legacy key concurrently from a dozen threads and asserts they converge on one backing key whose ciphertexts all still decrypt. * fix(kms): back EXTERNAL symmetric keys with their imported material The envelope resolved every SYMMETRIC_DEFAULT key through the lazy backing key generator, including Origin=EXTERNAL keys. A PendingImport key was given random material before ImportKeyMaterial ran, Encrypt then used that material instead of the imported one, and deleting or expiring the import left the generated key able to open ciphertext. EXTERNAL keys now skip generation, ImportKeyMaterial installs the imported material as the backing key under its KeyMaterialId, and delete or expiry removes it. Decrypt of such ciphertext answers with the key's PendingImport state, and re-importing the same material reinstates the backing key id that earlier ciphertext names. * fix(kms): synchronize backing material access |
||
|
|
e82836348b |
fix(stepfunctions): resolve state machine alias ARNs (#3607)
* fix(stepfunctions): resolve state machine alias arns * docs(stepfunctions): list alias actions * fix(stepfunctions): paginate state machine aliases * ci: rerun compatibility checks |
||
|
|
95079965a8 |
fix(ecr): enforce immutable image tags (#3009)
Route Docker Distribution traffic through Floci so repository mutability applies to manifest writes. Keep legacy registry storage reachable while moving public ECR endpoints to the guarded listener. |
||
|
|
a03c4d6160 |
feat(cognito): support pending user attribute verification (#2531)
* feat(cognito): support pending attribute verification
* fix(cognito): omit UserAttributeUpdateSettings when a pool never configured it
DescribeUserPool/CreateUserPool/UpdateUserPool always serialized
UserAttributeUpdateSettings as an empty object for pools that never set it,
where AWS omits absent optional members entirely. UserPoolAddOns right above
it already handles this correctly (an unconfigured pool omits the key rather
than returning {} or null, confirmed by Terraform re-planning the block into
and out of existence); UserAttributeUpdateSettings now follows the same
pattern.
* test(cognito): replace var with explicit AWS SDK response types
AGENTS.md's Types and names rule bans var in local declarations; the compat
test used it for four locals whose concrete AWS SDK type is the thing under
review here (CodeDeliveryDetailsType, UpdateUserAttributesResponse).
---------
Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
|
||
|
|
36c3ee4e22 |
feat(cognito): implement VerifyUserAttribute (#2018)
* feat(cognito): implement VerifyUserAttribute * fix(cognito): align attribute verification with AWS * fix(cognito): require access-token scope on VerifyUserAttribute verifyUserAttribute() extracted username/pool/jti from the caller's token but never checked token_use or scope, so a valid ID token could reach the same code-consuming, attribute-mutating path as an access token. AWS requires an access token carrying the aws.cognito.signin.user.admin scope for this operation (API_VerifyUserAttribute.html). Adds a token_use check (unconditional) and a scope check that only rejects a token when it explicitly carries a scope list missing the required scope. Most access tokens this simulator issues carry no scope claim at all (scopes are only modeled through the V2 Pre-Token-Generation Lambda override), so treating an absent claim as unrestricted keeps every normal login flow working, while an access token with an explicit, non-conforming scope list is now rejected. Adds unit coverage for all three cases (ID token rejected, access token missing the scope rejected, access token with the scope accepted) plus a wire-level regression for the ID-token case. * fix(cognito): scope consumed-code tombstone to attribute verification VerificationCodeService.consume() retained a consumed-code tombstone for every purpose, so a reused code answers ExpiredCodeException instead of the original CodeMismatchException. That behavior was validated against a real Cognito pool for VerifyUserAttribute, but the service is shared with ConfirmSignUp (SIGNUP_CONFIRMATION) and ConfirmForgotPassword (PASSWORD_RESET), so the same change silently altered their reused-code error too, without the same validation. Scopes the tombstone to EMAIL_ATTRIBUTE_VERIFICATION and PHONE_ATTRIBUTE_VERIFICATION only. SIGNUP_CONFIRMATION and PASSWORD_RESET go back to deleting on consume, restoring their original, previously validated NOT_FOUND/CodeMismatchException behavior on reuse. --------- Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> |
||
|
|
1987bf0c96 |
fix(rds): bound RDS/Redshift auth proxy connections and handshakes (#3545)
Cap concurrent proxy connections with a per-proxy semaphore, apply configurable handshake and backend-connect timeouts to both the client and backend sockets, and defer backend PostgreSQL connects until after client auth completes. Close leaked backend sockets defensively on every exit path, including a RuntimeException thrown between authenticate() returning a session and the bridge finishing its own cleanup, and bound backend-side reads during the handshake so a silent backend that accepts TCP but never answers cannot pin a handler thread and its connection permit forever. New EmulatorConfig keys under services.rds and services.redshift: proxy-handshake-timeout-millis (default 10000), proxy-backend-connect-timeout-millis (default 5000), proxy-max-connections (default 100). |
||
|
|
ffd2488f02 |
fix(codepipeline): poll S3 source changes (#3525)
* fix(codepipeline): poll S3 source changes * fix(codepipeline): serialize source polling baselines |
||
|
|
3003f05953 |
feat(bedrock-agentcore): implement AgentCore Memory events (#3556)
* feat(bedrock-agentcore): implement AgentCore Memory events
The Memory control plane was emulated but the event data plane was not:
CreateEvent, ListEvents, GetEvent and DeleteEvent were all absent, so an
application that reads a conversation's history had nothing to call.
Rather than answer ListEvents with a fixed empty list, the events are
stored, so a read returns what was written. An empty session is then empty
because nothing wrote to it, not because the answer is hardcoded.
Behaviour captured against real AgentCore in us-west-2:
- events are returned newest first, and the event id is a zero-padded
epoch-millisecond prefix plus a random suffix, so ids sort
chronologically as plain strings
- includePayloads=false omits the payload key rather than emptying it
- maxResults accepts 1 to 100; 101 is a ValidationException quoting the
constraint
- a malformed memory id is a ValidationException ("Invalid memoryId: not
a valid memory ID or ARN") while a well-formed but unknown one is a
ResourceNotFoundException ("Memory not found: <id>"). A memory id is a
name followed by exactly ten alphanumerics: a nine or eleven character
suffix is rejected as malformed before any lookup
- an unknown actor or session is an empty list, not an error
- sessionId is optional on create, and AgentCore assigns a UUID when it
is omitted
- an empty payload is accepted, and a new event lands on the main branch
- DeleteEvent echoes the deleted id rather than returning an empty body
The endpoints live on the memory controller rather than the data-plane one
because a JAX-RS request is matched against a single root resource class:
the class rooted at "/memories" owns that subtree, and a class rooted at
"/" never gets a look in. The behaviour stays in the data-plane service.
Verified with the same AWS SDK an application would use, pointed at a local
floci: create, list, get and delete round-trip, eventTimestamp parses back
to the exact Date, and each error above arrives as its typed exception.
Memory records (extraction and retrieval) remain unimplemented; they need
an extraction engine rather than stored events.
* fix(bedrock-agentcore): satisfy the docs and native-image CI gates
Three CI failures on this branch, all mine.
The action tables under docs/services are generated, not hand written. I
edited bedrock-agentcore.md directly and put the new event rows in the
wrong position, so `make docs-check` reported the table stale. Regenerated
with `make docs-sync`, which orders actions by registration and therefore
keeps ListMemories ahead of the event family.
BedrockAgentCoreEventService holds a static SecureRandom for event ids.
GraalVM captures such an instance in the image heap unless the class is
initialized at run time, so NativeImageRuntimeInitializationTest failed and
took both native image builds with it. Registered the class under
--initialize-at-run-time alongside the other services that hold one.
* fix(bedrock-agentcore): correct the event wire contract
Three gaps against the modelled contract, all confirmed in the bundled
botocore service model rather than taken on trust.
CreateEvent answers 201, not 200. The operation's HTTP trait says so, and
the test was pinning the wrong status.
payload is a required member of CreateEvent whose valid values include the
empty list. Turning a null into an empty list made an omitted member
indistinguishable from a valid empty array, so presence now travels
separately from the value and an omitted payload is a ValidationException.
The model also caps the list at 100 items, which is now enforced.
ListEvents is paginated. The default page size is 20 rather than the 100
this used, and the request and response carry a nextToken. The token is the
last event id of the previous page rather than an offset: ids sort with
time and the order is stable, so resuming cannot be shifted by a concurrent
write. No token is emitted on the final page, which is what ends a caller's
loop.
Verified with the real SDK against a local floci: five events traverse in
three pages of two, two and one with the token absent on the last, and an
omitted payload comes back as ValidationException.
* fix(bedrock-agentcore): match AWS wording for the maxResults range error
AWS quotes the submitted value and cites only the bound that was breached.
The message always cited the upper bound and dropped the value, so
maxResults=0 reported "less than or equal to 100". Add a test for the
lower bound, which had none.
|
||
|
|
d8e7382d5b | fix(docker): allow explicit root for restricted sockets (#3558) | ||
|
|
569f9f55e4 |
perf(build): replace quarkus-jdbc extensions with plain JDBC drivers (#3465)
* perf(build): replace quarkus-jdbc extensions with plain JDBC drivers The RDS Data API and Redshift Data API open connections with DriverManager. They never used Agroal, Narayana or the datasource layer that quarkus-jdbc-mysql and quarkus-jdbc-postgresql pull in. Depend on mysql-connector-j and postgresql directly and hand-supply the native image config the extensions provided. * perf(build): cut unused JDBC driver paths from the native image Substitute driver code that cannot be reached against the databases Floci provisions, mirroring what quarkus-jdbc-mysql did for JMX and going a step further for authentication and multi-host URLs. * perf(build): keep the MySQL cleanup thread disabled in JVM mode quarkus-jdbc-mysql set com.mysql.cj.disableAbandonedConnectionCleanup at startup in JVM mode as well as at native build time. The first commit carried only the native build argument and a surefire copy, so quarkus:dev and the JVM Docker image started Connector/J's abandoned connection cleanup thread on the first MySQL Data API call. In dev mode that thread is recreated with every restart and pins the old classloader. * fix(rdsdata): reject PostgreSQL result types the Data API does not support Aurora PostgreSQL answers a result set that holds a point, interval, money, box, circle, line, lseg, path or polygon column with UnsupportedResultException and the message "The result contains the unsupported data type POINT." Floci returned the driver's toString of the value instead. Check the column type names before reading the rows and raise the same error. json and jsonb stay supported, and a column cast to text still reads as a string, which is the workaround AWS documents. * perf(build): drop the PGobject reflection entries pgjdbc builds point, interval, money and the geometric types through reflection only when a result set holds such a column. The Data API now rejects those columns before reading a row, and json and jsonb values are plain PGobject instances the driver creates directly, so none of the ten entries can be reached. * chore(rdsdata): name the tolerated ClassNotFoundException in OpenTelemetryUnavailable * perf(build): keep PGInterval registered for the Redshift Data API Redshift tables can hold INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND columns and the Redshift Data API returns them as strings. Floci serves that path from a PostgreSQL container through pgjdbc, which builds an interval value by reflection, so the entry stays. The Redshift Data compat test now reads two interval columns on the native image. * perf(build): keep the geometric reflection entries for the Redshift Data API Redshift refuses point, box, circle, lseg, path and polygon as column types but evaluates them in a select, and its Data API returns the values as strings, checked on a real ra3.large cluster. Floci serves that path through pgjdbc, which builds those values by reflection, so the six entries stay. line stays out because Redshift rejects it, and money never reaches PGmoney because pgjdbc reads it as a double. The Redshift Data compat test selects those expressions and expects the strings Redshift returned. JdbcDriverNativeSupportTest resolves every registered class name. * fix(redshiftdata): fail statements that produce line, json or jsonb like Redshift Redshift has none of these types. A select that names one fails with "ERROR: type "line" not yet implemented" or "ERROR: type "json" does not exist", checked on a real cluster. The PostgreSQL container behind Floci's Redshift evaluates them, so the Data API now checks the result column types and fails the statement with the same text. |
||
|
|
e5bd8be405 |
feat(redshift): provision AWS::Redshift::Cluster through CloudFormation (#3427)
* feat(cloudformation): provision AWS::Redshift::Cluster (create path) * feat(cloudformation): AWS::Redshift::Cluster update and replacement * feat(cloudformation): force replacement on Redshift cluster createOnly property change * feat(cloudformation): force replacement on Redshift cluster DBName change * feat(cloudformation): provision Redshift parameter, subnet and security groups * chore(cloudformation): register Redshift provisioner in inventory and docs * test(cloudformation): end-to-end AWS::Redshift::Cluster stack * docs(redshift): document CloudFormation cluster provisioning * test(cloudformation): assert ClusterSubnetGroupNotFound error code on subnet group deletion * fix(cloudformation): correct attribute handling for Redshift security group provisioning * fix(cloudformation): apply Redshift parameter group Parameters and fix docs ClusterParameterGroup silently dropped Properties.Parameters on both create and update instead of calling ModifyClusterParameterGroup, and did not replace the entity when Description or ParameterGroupFamily changed, even though AWS marks both as replacement properties. Also remove the Id GetAtt claim from the Cluster docs: neither the provisioner nor AWS's own schema expose it for AWS::Redshift::Cluster. |
||
|
|
55ada9b8a3 |
feat(cloudformation): provision the AppSync resource types (#3424)
Adds AppSyncCfnProvisioner, serving AWS::AppSync::GraphQLApi, GraphQLSchema, DataSource, FunctionConfiguration, Resolver and ApiKey. Without it a template's AppSync resources fall to the dispatcher's stub arm, which reports CREATE_COMPLETE while creating nothing and resolves Fn::GetAtt to the literal "LogicalId.Attr". Two things are not simple property mapping. The AppSync control plane is REST-JSON with camelCase members, so every property is lower-camelised on the way in, with DynamoDBConfig as the one member that does not follow the rule (it is dynamodbConfig). And schema creation is asynchronous: while it is PROCESSING every other call for that API is refused with a 409, so the GraphQLSchema resource waits for a terminal status before completing, as CloudFormation does. Also carries the service-layer changes the provisioner needs: a PIPELINE resolver reaches its data through pipelineConfig and names no data source, which createResolver refused outright; CreateFunction and UpdateFunction now keep the runtime a JS resolver declares; and UpdateFunction applies a new name, which a CloudFormation rename goes through. |
||
|
|
10becc593f |
feat(cloudformation): provision AWS::Lambda::Url (#3423)
A function URL in a template was falling to the stub arm, so a stack exported the literal string "LogicalId.FunctionUrl" in place of a URL and nothing was listening on it. The physical id is the FunctionArn the URL is attached to, the alias ARN when Qualifier names one, which is the registry schema's primary identifier and enough to address the config again since a qualified ARN parses back into function and qualifier. TargetFunctionArn and Qualifier are create-only, so an update that moves the URL creates against the new function and removes the one it displaced. |
||
|
|
126af73141 |
fix(ecs): enforce host-volume bind-mount safety fail-closed at register and run time (#3543)
* fix: enforce host-volume bind-mount safety fail-closed at register and run time Reject volumes[].host.sourcePath by default unless an operator opts in via floci.services.ecs.host-volume-roots or allow-unsafe-host-volumes. Block the Docker socket and any ancestor directory that contains it (/var/run, /run, /var) unconditionally, even with the unsafe flag set. Extract the check into HostVolumePolicy and enforce it again immediately before each bind mount in EcsContainerManager.startTask, not only once at RegisterTaskDefinition, to narrow the window for a swapped-in symlink and to cover task definitions persisted before this policy existed. * fix(ecs): protect the Docker socket Floci actually connects to The host-volume policy only blocked the literal /var/run/docker.sock and /run/docker.sock paths, so a task definition could bind-mount the daemon socket when Floci reached it through DOCKER_HOST or an active Docker context (Colima, OrbStack, Rancher Desktop, Podman). Resolve the daemon endpoint through the same DockerClientProducer path the Docker client uses and add its unix:// socket path to the protected candidates. The literal paths stay protected as defence in depth. |
||
|
|
96707f6d5a |
feat(apigateway): support HTTP and HTTP_PROXY integrations on REST APIs (#3433)
* feat(apigateway): support HTTP and HTTP_PROXY integrations on REST APIs
PutIntegration already accepted type HTTP_PROXY and HTTP, but dispatch handled
only AWS_PROXY, AWS and MOCK and fell through to a 500 "Unsupported integration
type". A REST API fronting an HTTP microservice - the shape CDK's HttpIntegration
and addProxy emit - could be created but never invoked.
HTTP_PROXY is a passthrough: the request goes to the integration URI with {param}
placeholders resolved from the matched resource's path parameters, and the
backend's status, headers and body are relayed unchanged. AWS applies neither
request templates nor integration-response selection to HTTP_PROXY, so a backend
4xx or 5xx reaches the caller verbatim rather than being remapped into a gateway
error. An unreachable backend yields 502.
HTTP is the non-proxy form and transforms in both directions. The request body is
the rendered requestTemplates entry chosen by the incoming Content-Type, and only
headers and query parameters named by integration.request.* mappings are
forwarded - unmapped inbound headers are deliberately not passed through, which
is what separates it from HTTP_PROXY. The backend's reply then runs through the
method's integration responses, where selectionPattern is matched against the
backend's HTTP status code rather than against an error message as it is for
AWS/Lambda integrations.
Both reuse the existing v2 HttpProxyInvoker for transport, so hop-by-hop header
stripping, chunked decoding and the 502-on-failure behaviour are shared. The
request-template negotiation and integration-response mapping that AWS
integrations already performed are extracted so both types use one implementation.
* fix(apigateway): preserve repeated headers and query parameters through HTTP_PROXY
A REST HTTP_PROXY integration passes the request through, and AWS supports
multi-valued headers and query strings on that path. The adapter collapsed both
into one comma-joined value before handing the request to the shared transport,
so "?tag=a&tag=b" reached the backend as "tag=a,b" and a header sent twice
arrived once. Those are not interchangeable: most servers parse the joined form
as a single value containing a comma.
The relayed response had the same defect. A backend returning two Set-Cookie
headers produced one joined header, which the client cannot split back apart,
since an Expires attribute contains a comma of its own.
The transport already stored headers and query parameters as multimaps
internally; only its boundary types flattened them. RequestContext now carries a
multi-valued view alongside the single-valued one that $request.* expressions
resolve against, ProxyResult returns multi-valued headers, and the REST proxy
path emits one header line per value. An explicit integration.request.* mapping
still overwrites, replacing repeated inbound values with the mapped one.
Non-proxy HTTP is unchanged: its integration responses resolve
integration.response.header.X to a single value, so it collapses the backend's
headers at that point instead.
* fix(apigateway): preserve repeated parameters through HTTP API HTTP_PROXY too
dispatchHttpProxyV2 is the second entry point into the HttpProxyInvoker /
RequestContext / ProxyResult transport, and it still built its request context
from comma-joined single-value maps. So after the REST path was fixed, an HTTP
API (v2) with an HTTP_PROXY integration still sent "?tag=a,b" for "?tag=a&tag=b",
and repeated request headers still arrived joined: the transport's multi-value
support was there but never populated from here.
It now builds the same two views the REST path does. The multi-value maps are
what reaches the backend, and the joined single-value maps stay the lookup
surface for $request.header.X / $request.querystring.X, which resolve to one
value in AWS. The response relay already iterated multi-valued headers, so
repeated Set-Cookie was already correct on this path; it is pinned by a test
now rather than left implicit.
Also drops ProxyResult.firstHeader(), which nothing called, puts braces on the
conditionals in RequestContext.expand(), and imports LinkedHashMap in
ApiGatewayExecuteController instead of spelling it out in full at each use.
|
||
|
|
f38a384e51 |
fix(appsync): verify JWT signatures and SigV4 requests for GraphQL auth (#3541)
* fix(appsync): verify JWT signatures and SigV4 requests for GraphQL auth
Cognito and OIDC auth modes decoded JWT claims without checking the
signature, and AWS_IAM auth accepted any well-formed Credential= value
without verifying a real SigV4 signature. An unregistered IAM access
key also fell back to an account-root identity instead of being
rejected. Any of these let an attacker forge claims or an identity
for AppSync's GraphQL data-plane endpoint.
Cognito now verifies the token against the issuing user pool's own
RS256 signing key (alg, kid, issuer, expiry) instead of trusting the
decoded payload. OIDC verifies against the configured issuer's
published JWKS via OIDC discovery, reusing JwtSignatureVerifier (the
same verifier the HTTP API JWT authorizer uses), and fails closed on
an unreachable issuer or unsupported algorithm. AWS_IAM verifies a
real header-signed SigV4 request (service "appsync", fixed
/v1/apis/{apiId}/graphql canonical path): the Credential= access key
must resolve to a secret via IamService and the signature must match
the actual request, including its body. An unknown or unsigned key is
always rejected and never resolves to root; the legacy test/test pair
is still emulator-allow but must be signed like any other key.
JwtClaimsDecoder gained decodeHeader()/rawToken() so callers can check
alg/kid and hand the raw token to a signature verifier.
AuthRequestInfo carries the raw request body so IAM signature
verification can hash the real payload rather than trusting an
unsigned one.
* fix(appsync): bind session tokens to temporary IAM credentials
IamAuthValidator.resolveSecretKey resolved a temporary (ASIA...)
access key's session secret and verified the SigV4 signature, but
never checked X-Amz-Security-Token. A caller holding just the secret
could authenticate without presenting the session token AWS requires
to prove the credential is live and genuinely STS-issued.
checkSessionToken now mirrors ExecuteApiSigV4Authorizer: a temporary
key with no X-Amz-Security-Token header is rejected, a present token
is compared against the value IamService recorded at mint time with
MessageDigest.isEqual, and a session recorded before Floci tracked
tokens (no issued value to compare against) is not locked out by a
check it cannot satisfy. The token does not need to ride in
SignedHeaders; comparing it against the issued value binds it
regardless of where it rode.
Also drops the dead Date-header fallback in headerSignedRequest
(AMZ_DATE can never parse RFC 1123 output, so that branch never ran)
and fixes an em-dash in the AWS_IAM docs row.
* test(appsync): sign IAM data-plane requests in the auth integration test
Two AppSyncAuthIntegrationTest cases sent the bare Credential= header
that is enough for the management plane to the GraphQL endpoint and
expected 200. Now that AWS_IAM requests are verified as real SigV4,
that header is an unsigned request and gets 401, which is the intended
behaviour. Sign those two requests with AppSyncRequestSigner using the
legacy test credential; the cases that expect 401 for a dummy
signature are unchanged.
|
||
|
|
a40409f591 |
fix(wafv2): reject non-CIDR IPSet addresses (#3511)
CreateIPSet/UpdateIPSet now validate that every Addresses entry is a CIDR block matching IPAddressVersion, rejecting bare addresses and out-of-range prefixes with WAFInvalidParameterException. The IPAddressVersion check now runs even when Addresses is empty or null, and validation errors carry Field/Parameter/Reason as structured extendedData instead of a free-text message, matching the real ParameterExceptionField enum (IP_ADDRESS, IP_ADDRESS_VERSION). * Fix #3328 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> |
||
|
|
e9454af855 |
feat(redshift): intercept Extended Query protocol (#3474)
* feat(redshift): decode Extended Query wire messages * feat(redshift): track Extended Query statements and portals * feat(redshift): coordinate Extended Query backend responses * refactor(redshift): share S3 COPY and UNLOAD transfers * feat(redshift): execute S3 transfers through Extended Query * fix(redshift): retain next-cycle pipelined portals * feat(redshift): intercept Extended Query statements * test(redshift): cover Extended Query JDBC compatibility * test(redshift): cover Extended Query SDK compatibility * docs(redshift): document Extended Query interception * feat(redshift): implement extended query execution handling in BackendResponseCoordinator and update related classes * feat(redshift): enhance ExtendedS3Exchange with client synchronization handling * fix(redshift): synchronize extended COPY failures * fix(redshift): tolerate backend ownership fragmentation * fix(redshift): forward extended query flush frames * fix(redshift): abort backend copy on unload failure * fix(redshift): preserve later extended query mutations * fix(redshift): return ready state after copy failure * test(redshift): cover later sync cycle rollback * fix(redshift): preserve independent mutations when rejecting a pipelined mutation ExtendedQuerySession.rejectFrom() restored the whole statements/portals map back to the rejected mutation's "before" snapshot and truncated the journal to the end, discarding any later, independent mutation that happened to run first. The coordinator already rejects one pipelined mutation at a time in journal order, so this only ever needs to undo that one mutation's own effect. Each journal entry now also records its own "after" snapshot at creation time, since reconstructing it later from the next entry's "before" or from the live maps goes stale once an earlier reject's cascading portal cleanup has already touched a key this mutation never itself changed. * fix(redshift): forward the real ReadyForQuery after a COPY/UNLOAD failure readClientSync(client) called the two-argument overload without its Flush-forwarding OutputStream, which did not compile. Every error branch in the Extended Query COPY/UNLOAD path sent CopyFail and Sync to the backend but never drained or forwarded the backend's resulting ReadyForQuery: the client waited on a frame nobody ever read off the wire. drainReadyForQuery already existed for exactly this but was never called. Wire it into every COPY and UNLOAD error branch. |
||
|
|
043167793b |
feat(ec2): carry the remaining launch template data fields (#3493)
* feat(ec2): carry the remaining launch template data fields InstanceMarketOptions, InstanceRequirements and a network interface's ConnectionTrackingSpecification were the last three RequestLaunchTemplateData groups Floci accepted and threw away. A Terraform aws_launch_template that declared any of them read back nothing, so it reported an inconsistent result after apply or diffed forever. Ec2QueryHandler now parses all three off the Query wire and renders them into ResponseLaunchTemplateData, and LaunchTemplateData stores them. All 26 members of InstanceRequirementsRequest are covered, including the nested BaselinePerformanceFactors. CreateLaunchTemplateVersion inherits the new members the same way it inherits the existing ones. * fix(ec2): validate launch template instance requirements and connection tracking InstanceRequirements and ConnectionTrackingSpecification became writable in the previous commit, but nothing checked them. A block carrying only BurstablePerformance was stored, and so was a network interface asking for a one second TCP established timeout. The EC2 service model declares VCpuCount and MemoryMiB required on InstanceRequirementsRequest, and Min required on each of their range shapes, so a request missing any of them now fails with MissingParameter. The connection tracking timeouts have no min or max keys in the model; the ranges live in each member's documentation string, which gives TcpEstablishedTimeout 60 to 432000 seconds, UdpTimeout 30 to 60 and UdpStreamTimeout 60 to 180. A value outside one of those fails with InvalidParameterValue, matching the existing hop limit check. CreateLaunchTemplate and CreateLaunchTemplateVersion both validate before anything is stored. * fix(ec2): reject the launch template combinations InstanceRequirements forbids InstanceRequirements became writable two commits ago, and validation covered the required members and the connection tracking ranges but not the combinations the EC2 API reference rules out. Three of them were storable. The service model documents each rule in a member documentation string rather than in its constraints. RequestLaunchTemplateData says "If you specify InstanceRequirements, you can't specify InstanceType". InstanceRequirementsRequest says "If you specify AllowedInstanceTypes, you can't specify ExcludedInstanceTypes" and "Only one of SpotMaxPricePercentageOverLowestPrice or MaxSpotPriceAsPercentageOfOptimalOnDemandPrice can be specified". All three now fail with InvalidParameterCombination from the shared validation path, so CreateLaunchTemplate and CreateLaunchTemplateVersion are covered alike. CreateLaunchTemplateVersion validates the merged version as well as the request it received. The merge inherits every member the request does not restate and has no way to express removal, so a version naming only InstanceType against a source carrying InstanceRequirements would otherwise store a version holding both. That merged version is what AutoScaling and the fleet APIs read, so it is rejected rather than stored. Omitting SourceVersion starts from empty data and remains the way to move a template between the two selection modes. The instanceRequirementsRoundTrips test set both halves of two of these pairs. Its assertions are unchanged; the members that cannot share a template moved to a second template of their own. |
||
|
|
505b5d286e |
feat(ses): preserve raw message fidelity and envelope sender in the SMTP relay (#3522)
* feat(ses): preserve raw messages, envelope sender, and X-SES headers in SMTP relay
The raw relay reparsed each MIME message and rebuilt it from the text and
HTML parts alone, dropping every attachment and custom header. It now walks
the Mime4j tree and maps it onto the outgoing message: the first text/plain
and text/html parts become the body, every other leaf becomes an attachment
(inline when it carries a Content-ID, so cid: references still resolve), an
embedded message/rfc822 part is relayed whole, and display names on addresses
survive. Top-level headers are copied through apart from the MIME structural
ones, which the encoder regenerates for the re-built message.
Wire the envelope sender through to MAIL FROM, resolved in AWS's order: the
Return-Path MIME header, then the ReturnPath request field (v1) or
FeedbackForwardingEmailAddress (v2), then the source. The resolved value is
recorded on SentEmail so the inspection endpoint shows it.
Stamp relayed messages with <{MessageId}@{region}.amazonses.com>, matching the
MessageId returned to the caller, leaving a caller-supplied Message-ID alone.
Honour the X-SES-CONFIGURATION-SET and X-SES-MESSAGE-TAGS control headers on
raw sends, which previously parsed to nothing and left event publishing
silently inert for callers using the header form. Both are stripped from the
relayed message, as AWS consumes rather than forwards them. The tenant send
gate sees the same resolved configuration set, so one named only by header
cannot slip past the association check.
Fix tryBase64Decode, which decoded every raw message with the MIME decoder and
only fell back to plain text when it threw. That decoder skips characters
outside the base64 alphabet rather than rejecting them, so a plain-text RFC
5322 message decoded into garbage whenever the surviving alphabet characters
happened to form a valid length, wiping its headers. The alphabet is now
checked before decoding.
Replace the nine-argument SmtpRelay.relay with a RelayMessage record, and add
a ServerSocket-based SMTP test that drives a real MailClient end to end and
asserts on the negotiated envelope and the bytes on the wire, covering the
authentication and STARTTLS-OPTIONAL configuration branches.
* fix(ses): align SMTP relay with documented AWS header and tag semantics
Verified the relay against the SES documentation and corrected four
deviations.
AWS overrides a caller-supplied Message-ID with the id it assigned, and
rejects Message-ID outright as a custom header on Simple and Templated
content (SES header fields reference). The relay preserved a caller's value
instead; it now always stamps the id returned by the API.
AWS likewise overrides a caller-supplied Date with the time it accepted the
message. The relay copied the caller's Date through, so a stale timestamp
reached the recipient. Date is now regenerated with the rest of the headers
SES sets.
AWS uses only the request field's message tags when tags are supplied both
as a request field and as an X-SES-MESSAGE-TAGS header, and explicitly does
not join the two sets. The relay merged them, letting a header-only tag
survive a request that supplied its own. Header tags now apply only when the
request passes none.
The stamped Message-ID domain was region-scoped, which no AWS documentation
or observed output supports. Use the observed email.amazonses.com instead,
and record in the docs that only the local part, which is the returned
MessageId, is documented behaviour.
Also document that AWS delivers a Return-Path differing from the one
supplied, because it routes bounces through its own address, whereas Floci
has no bounce pipeline and puts the resolved address directly in MAIL FROM.
* fix(ses): align mime4j artifacts to unbreak the native build
The raw relay's new DefaultMessageWriter path failed GraalVM analysis with
an unresolved reference to Field.getSafeRaw(). apache-mime4j-dom was pinned
to 0.8.14 while the Quarkus BOM manages apache-mime4j-core at 0.8.12, so the
writer was compiled against a Field API the resolved core does not declare.
Nothing reached the writer before this branch, which is why the skew only
surfaced now, and only in native builds.
Drop the hardcoded -dom version so both artifacts track the BOM together,
and cover the embedded message/rfc822 branch that exercises the writer.
|
||
|
|
325bdfb30e |
feat(ec2): report instance credit specifications (#3492)
* feat(ec2): report instance credit specifications DescribeInstanceCreditSpecifications was not implemented, so the action Terraform's aws_instance resource reads credit_specification from always came back empty and every plan after an apply showed a credit_specification diff for an instance nobody had touched. CreditSpecification is not a member of the Instance shape DescribeInstances returns, per botocore's ec2 2016-11-15 model, so this dedicated action is the only way that value can reach a client. The credit option is the launch's explicit CreditSpecification.CpuCredits when the request named one, and the instance type family's documented default otherwise: standard for t2, unlimited for t3, t3a and t4g. The model's own InstanceType enum lists t1, t2, t3, t3a and t4g as the only T families, and t1 predates the credit model, so that table is complete. The default is resolved on read rather than frozen at launch, so a resize moves the instance onto its new family's default. The two request shapes mean different things and both are implemented. Naming instance ids reports exactly those instances, and an id with no credit option is an error rather than an omission, which is what the model documents for "an instance that is not a burstable performance instance". Naming no ids reports only the instances running unlimited, paginated by MaxResults and NextToken; AWS rejects MaxResults together with instance ids and so does this. DescribeInstanceTypes now reports burstablePerformanceSupported. Terraform checks that flag before it reads a credit specification at all, so without it the new action would never be called. ModifyInstanceCreditSpecification is deliberately left out. Describe stands on its own here: it fixes the read that produced the perpetual diff, and a launch can already set the option through RunInstances or launch template data. The modify path is a separate change. Tests: Ec2InstanceCreditSpecificationsIntegrationTest covers each burstable family default, a non-burstable type, an explicit launch-time override, an unknown instance id, the unfiltered form and the MaxResults combination error on the real Query wire. Ec2InstanceTypeCatalogTest covers the family table. Ec2RunInstancesPublicIpParamTest's mocked signature gains the new parameter. * fix(ec2): persist the instance credit option and report standard for non-burstable ids The first cut of DescribeInstanceCreditSpecifications had the documented behaviour backwards on two points. Both come from the operation's own documentation string in botocore's ec2 2016-11-15 model, which the constraint keys alone do not carry. "If you specify an instance ID that is not a burstable performance instance, Amazon EC2 returns the standard credit option." A named m5 was answered with InvalidInstanceID.NotFound, because effectiveCpuCredits() returned null for a type with no credit model and the named-id path treated that as an unknown id. It now reports standard. An id that names no instance at all is still InvalidInstanceID.NotFound, which is the only error that path raises. The unfiltered form returns burstable instances on the unlimited option "as well as instances that were previously configured as T2, T3, and T3a with the unlimited credit option. For example, if you resize a T2 instance, while it is configured as unlimited, to an M4 instance, Amazon EC2 returns the M4 instance." A launch without an explicit CreditSpecification stored null and the credit option was recomputed from the instance's current type on every read, so a t3 that defaulted to unlimited lost that option the moment it was resized onto an m5. The option is now resolved once, at the point the instance acquires it, and stored on the instance: Instance.creditSpecificationCpuCredits, written in runInstances from the request or the family default, and written again in modifyInstanceAttribute when a resize moves an instance with no option yet onto a burstable type. Reads return the stored value. The family default stays on the read path only as a fallback for instance records written before the option was stored. Tests: aNonBurstableInstanceIdReportsStandard replaces the regression that locked in the error. theUnlimitedOptionSurvivesAResizeOntoANonBurstableType, aResizeOntoABurstableTypeAcquiresTheFamilyDefault and aStandardOptionSurvivesAResizeOntoAnotherBurstableFamily cover the resize paths, and the unfiltered-form test now also asserts a non-burstable instance is absent. * fix(ec2): honor DryRun, Filter.N and the MaxResults range on DescribeInstanceCreditSpecifications The EC2 model declares more request behavior for this action than the handler accepted. All three gaps come from local/model-preflight.py ec2 DescribeInstanceCreditSpecifications, which prints the constraint keys and the documentation prose together. DryRun is a modeled member and the handler never probed it, so DryRun=true returned a normal response instead of DryRunOperation. The pagination parameters are now validated before the probe, matching the order the snapshot block public access handlers use, since AWS reports an invalid parameter ahead of DryRunOperation and only returns DryRunOperation once the request could otherwise succeed. Filter.N is a modeled member and was parsed nowhere. The model declares one filter name here, instance-id, which Ec2Service.matchesFilter already resolves for an Instance, so both request shapes now run their candidates through matchesFilters. Named ids still decide the base set and are still validated for existence, then the filters narrow that set with an AND, which is what the Filters member documents. An unrecognised filter name matches everything, following the default arm every other filtered EC2 Describe action in this service already takes. DescribeInstanceCreditSpecificationsMaxResults carries a min of 5 and a max of 1000, and any positive integer was accepted, so 1 and 1001 were treated as page sizes. Out of range now raises InvalidMaxResults with the message describeNetworkInterfaces already uses for the same range. Tests: maxResultsHonorsItsModeledRange covers 5, 1000, 4 and 1001, dryRunReturnsDryRunOperation and anInvalidMaxResultsIsReportedAheadOfDryRun cover the probe and its ordering, and four filter tests cover the unfiltered form, named ids, an unknown named id under a filter and an unrecognised filter name. |
||
|
|
24a8c8440b |
fix(lambda): resolve layer version ARNs by account (#2948)
* fix(lambda): resolve layer version ARNs by account Layer resolution dropped the ARN's account segment, so an ARN naming another account resolved inside the caller's own partition. Two consequences, filed separately as #2813 and #2809. A foreign ARN whose layer name and version happened to match one of the caller's own resolved to that layer: the function recorded an ARN it was not using, and the launcher mounted different content at /opt than GetFunctionConfiguration reported. resolveLayerByArn now scopes the lookup to the caller's account and partition, so a foreign ARN is a miss. A foreign ARN that matched nothing was rejected outright, which no AWS-managed public layer can ever satisfy: Powertools, the AppConfig extension and Datadog-published layers all live in AWS-owned accounts, and every Terraform stack attaching one failed at CreateFunction. Validation now applies the eager existence check only to the caller's own account and records a foreign ARN unresolved, warning that its content is not mounted. Measured against the live service in ap-southeast-1: CreateFunction, foreign ARN matching an own layer name/version -> AccessDeniedException, not a substitution CreateFunction, AWS-managed Powertools layer -> 201, ARN echoed verbatim on GetFunctionConfiguration CreateFunction, missing layer in the caller's own account -> InvalidParameterValueException: Layer version ... does not exist. The own-account message and status are unchanged, matching that third case exactly. The AccessDenied case is a known divergence: Floci implements no layer permissions, so it cannot tell a public layer from one the caller has no policy for, and accepts both. Closes #2813 Closes #2809 * fix(lambda): reject foreign-partition layer ARNs when attaching them GetLayerVersionByArn already answers a non-aws partition with InvalidParameterValueException, but CreateFunction and UpdateFunctionConfiguration accepted the same ARN and persisted it, so a function could carry a layer Floci's own lookup path calls invalid. Partitions are isolated, so no resource policy can ever make a cn or gov layer readable from the aws partition. That is what separates it from a foreign account, where a policy can, and where AWS-managed public layers live. Foreign accounts stay accepted; foreign partitions now reject with the message GetLayerVersionByArn already uses. Measured on CreateFunction in ap-southeast-1: a cross-partition layer ARN and a foreign-account layer ARN both fail with AccessDeniedException, so the live service does not distinguish them at this call. The split here is Floci's, on reachability grounds, and is documented as such. * fix(lambda): gate foreign-account layer ARNs behind a config flag Review asked for the accept-foreign-ARN behaviour to be opt-in rather than the default, on both PRs' reasoning that it broadens what CreateFunction accepts beyond AWS. It is now floci.services.lambda.accept-external-layer-arns, default false, env FLOCI_SERVICES_LAMBDA_ACCEPT_EXTERNAL_LAYER_ARNS. Off, a layer ARN naming another account is refused. On, it is recorded on the function verbatim and its content is not mounted, which is what a stack attaching Powertools or the AppConfig extension needs. A same-account ARN is unaffected either way: a missing layer is still the eager InvalidParameterValueException. The refusal is AccessDeniedException, 403, not the InvalidParameterValueException this branch previously used for the partition case. That was the second review finding: the live probe in this PR measured CreateFunction returning AccessDeniedException for a cross-partition ARN and the identical AccessDeniedException for a same-partition foreign account, so reporting a different error class than what was measured was an observable divergence presented as parity. Both now report what AWS reported. Cross-partition stays refused with the flag on. Partitions are isolated, so no resource policy can make an aws-cn layer readable from aws, and GetLayerVersionByArn already calls such an ARN invalid. Negative control, with the default flipped to true and the tests kept: LambdaLayerArnAccountIntegrationTest foreignAccountArnIsDeniedByDefaultAndTheFunctionIsNotCreated updateFunctionConfigurationIsDeniedAndLeavesTheExistingLayerInPlace Tests run: 7, Failures: 2 Also moves the two generic ARN ownership checks this branch was adding into AwsArnUtils as isForeignPartition and isForeignAccount, so the layer code keeps only the layer-shaped part. Review noted RdsService.targetGroupBelongsTo already carries its own copy and asked not to land a further one. The existing RDS, EKS and EC2 copies are deliberately left alone; this only avoids adding another. |
||
|
|
27def6079d | docs(marketplace): add known deviations and behavior notes for change sets (#3523) | ||
|
|
6790024abc |
feat(firehose): convert array, struct and map columns to Parquet (#3521)
* feat(firehose): convert array, struct and map columns to Parquet
Data format conversion rejected every complex Hive type up front, so a
stream whose Glue table carried an array<string> or a struct<..> routed
its whole batch to the error output as UnsupportedSchema. That covers the
ordinary Firehose-to-Athena schema, where a JSON event nests.
A column's type is now a recursive tree feeding DuckDB's read_json, and
values coerce the way real AWS's OpenX deserializer does (probed against
us-west-2 with a table of exactly these types):
- a value that is not an array is wrapped into a one-element array
- a struct takes its members from an object by name, dropping an
undeclared one and leaving a missing one null, and an array fills them
by position instead; a scalar fails the record
- a map accepts only an object, and its keys are lowercased
- member names match case-insensitively at every depth, and the scalar
coercions apply inside containers as they do at the top level
- a mismatch at any depth fails that record alone, with the message AWS
reports there
binary and uniontype stay unsupported, as does a type string the parser
cannot read; each still routes the batch to the error output.
* fix(firehose): refuse under HiveJsonSerDe what AWS refuses
The complex-type conversion applied OpenX's coercions whichever
deserializer was configured: a non-array wrapped into an array, an
array filling a struct by position, a string parsed into a numeric
column, a nested value serialized into a text column. AWS documents
the last two as things HiveJsonSerDe will not do, and a probe over a
Hive stream (us-west-2, twelve records over the same four complex
columns) confirmed it refuses all four and fails the record, with
messages now reproduced: "Start of Array expected", "Start of Object
expected", "Current token (VALUE_STRING) not numeric, can not use
numeric value accessors", and "One or more fields have incorrect
format. Exception when validating field (root)".
The two booleans threaded through the type tree became one SerDeRules
record built from the deserializer, with a third member for this. The
top-level scalar path shares ScalarType, so a string in a numeric
column now fails under Hive there too, which was a deviation before
this branch. Hive still coerces a number into a text column and treats
{}, missing and undeclared members as OpenX does, all probed. A map
column itself given a non-object, and a boolean column given a string,
were not probed; the docs say which way they fall.
|
||
|
|
2a4ca61baf |
fix(cognito): delete a user pool's records with the pool (#2949)
* fix(cognito): delete a user pool's app clients, revocations and codes #3419 took users and resource servers out with the pool, closing the half of #2864 that was reported. Three more record types are the same defect and were left behind: app clients, revoked token records and outstanding verification codes. On AWS a pool id is never reused, so nothing can inherit an orphan. Here floci:override-id makes ids caller-chosen and therefore reusable, and a pool recreated on a pinned id picks up whatever the deleted pool left. Reproduced by pinning us-east-1_orphanprobe1, populating it, deleting the pool and recreating it on the same id. The client leak is the serious one: the deleted pool's client id kept resolving against the new pool, carrying a secret the new pool's caller never saw. clients: ["c1"] describe-user-pool-client --client-id c1a93e3fc698451d96ed406adb -> c1 Clients are keyed by client id alone, so they are found by their userPoolId field rather than a key prefix. Revoked tokens and verification codes have their keys collected before deleting so the backing key set is not modified while it is being iterated. confirmSignUpNamesDeletedUserPoolInResourceNotFoundMessage, added by #2936, built its orphaned client by deleting the client's pool, which this cascade now prevents. It is renamed and reaches the same defensive path by dropping the pool record alone, and a second case pins the new behaviour: a client id from a deleted pool is gone with it. Refs #2864 * fix(cognito): bound the delete cascade by pool ownership, not key prefix floci:override-id makes pool ids caller-chosen, and validateOverrideId permits a colon. Two live pools can therefore be named so that one id plus the key separator is a prefix of the other, and the revoked-token and verification-code cascades deleted by the matched key, so deleting the shorter pool erased the longer one's records. For revoked tokens that reinstated tokens the surviving pool had revoked. Both records carry their own userPoolId, so ownership is now settled by that field rather than by the key prefix. The other cascades reconstruct the key from the pool id being deleted and so never reached across a boundary; they are left alone. A jti can itself contain a colon (global revocations use global:{username}), so bounding the prefix by the separator would not have been sufficient either. |
||
|
|
5d0b0b44b1 |
fix(ec2): store and validate CreateVpcEndpoint SubnetConfiguration (#3491)
* fix(ec2): store and validate CreateVpcEndpoint SubnetConfiguration CreateVpcEndpoint accepted SubnetConfiguration.N and dropped it, so an interface endpoint took floci's own synthesized address in each subnet rather than the one the caller pinned. Terraform's aws_vpc_endpoint sends the subnet_configuration block on create and reads it back by following the endpoint to its network interfaces, so every plan after the apply saw an address it never asked for and proposed replacing the endpoint. SubnetConfiguration is request-only in ec2/2016-11-15. No output shape carries it, so the addresses are stored on the endpoint and consumed when its interfaces are built, and DescribeVpcEndpoints echoes nothing new. Ec2QueryHandler parses the flattened SubnetConfiguration.N list for CreateVpcEndpoint and for ModifyVpcEndpoint, which takes the same parameter. Ec2Service validates each entry against the named subnet, rejecting an IPv4 address outside its CIDR with InvalidParameterValue, and keeps the pinned address on the endpoint's interface in that subnet. A subnet named only through its configuration joins the endpoint's subnet set. Ipv6 is stored as given, since floci's subnets carry no IPv6 CIDR to validate against and its network interfaces have no IPv6 field yet. Adds Ec2VpcEndpointSubnetConfigurationIntegrationTest over the query wire and three Ec2ServiceTest cases for the create, modify and rejection paths. * fix(ec2): reject the subnet-reserved addresses in SubnetConfiguration validateSubnetConfigurations only checked that SubnetConfiguration.Ipv4 parsed and fell inside the named subnet's CIDR. For a 10.61.1.0/24 subnet that let 10.61.1.0, .1, .2, .3 and .255 through, and each became the private address of the endpoint's network interface. AWS keeps those five for itself, so none of them can be assigned to a resource and no real endpoint could ever report one. The rule is in ec2/2016-11-15 itself, in the CreateSubnet documentation: "Amazon Web Services reserves both the first four and the last IPv4 address in each subnet's CIDR block. They're not available for your use." CreateSecondarySubnet says the same for secondary subnets. No constraint key carries it, and no shape in the model states it for SubnetConfiguration. Ipv4Cidrs.isSubnetReserved is new; the EC2 service had no reserved-address helper to reuse. VpcNetworkManager.firstHostOffset looks close but is not the same rule: it reserves ten addresses of Docker-network headroom at the bottom of a block and nothing at the top, for allocation readability rather than AWS semantics. Small blocks need no special case. A /28, the smallest subnet AWS accepts, keeps 11 of its 16 addresses and a /29 keeps three. Both ends are clamped so they cannot cross in a block of four addresses or fewer, where every address is reserved. The check sits in the shared validator, so CreateVpcEndpoint and ModifyVpcEndpoint both refuse a reserved address with the InvalidParameterValue the containment check already raises. Tests cover all five reserved addresses and one ordinary host address on the create path, the modify path, a /28 subnet, and the query wire. --------- Co-authored-by: lex00 <artigues.dev@gmail.com> |
||
|
|
fe40e06938 |
feat(ec2): support snapshot block public access (#3490)
* feat(ec2): support snapshot block public access Adds EnableSnapshotBlockPublicAccess, DisableSnapshotBlockPublicAccess and GetSnapshotBlockPublicAccessState over the EC2 Query protocol. The setting is account-level state scoped to one region, so it lives in a small Ec2SnapshotBlockPublicAccessService keyed by region, mirroring Ec2EbsEncryptionService. The account-aware storage backend namespaces the keys by the calling credential's account. A region that was never configured reads back unblocked. Enable accepts only block-all-sharing and block-new-sharing, per the EC2 model, and rejects unblocked with InvalidParameterValue. Disable returns the resulting unblocked rather than the prior state. Only the Get response carries managedBy, always account, since Floci has no declarative-policy layer. * fix(ec2): honor DryRun on snapshot block public access EnableSnapshotBlockPublicAccess, DisableSnapshotBlockPublicAccess and GetSnapshotBlockPublicAccessState all model the standard DryRun parameter, but none of the three handlers checked it. Enable persisted the requested state, Disable persisted unblocked and Get answered 200, so DryRun=true had real side effects on both write paths. All three handlers now take the parameter map and call the existing checkDryRun(params). Enable validates State first, through a new validateEnableState on the service, because AWS reports an invalid parameter ahead of DryRunOperation and only returns DryRunOperation once the request would otherwise have succeeded. So State=unblocked with DryRun=true still fails with InvalidParameterValue, and a missing State still fails with MissingParameter. |