Commit Graph
897 Commits
Author SHA1 Message Date
Prakhar Kapoor e4666dfa7a fix: support wildcard filtering in EC2 filters (#837)
* fix: support wildcard filtering in EC2 filters

Add wildcard pattern matching support to EC2 filter values to match AWS behavior.

Changes:
- Added wildcardToRegex() method to convert AWS wildcard patterns (* and ?) to Java regex
- Added matchesValue() method for pattern-based value matching
- Updated all filter matching logic to use wildcard patterns instead of exact string matching
- Supports wildcard filtering for all filter types: tag filters, tag-key, tag-value, and resource-specific filters
- Applies to all EC2 resources: VPCs, Subnets, Security Groups, Instances, Internet Gateways, Route Tables, Volumes

Added comprehensive integration tests:
- describeVpcsWithWildcardTagFilter: Tests asterisk wildcard patterns
- describeVpcsWithWildcardQuestionMark: Tests question mark wildcard patterns

All 69 EC2 integration tests pass. Backward compatible with exact string matching.

Fixes #830

* fix: reorganize imports in Ec2Service and Ec2IntegrationTest for clarity
* Potential fix for pull request finding
2026-05-14 07:45:00 -05:00
Ahmed Soliman 6a8c44fad5 fix(kms): non-deterministic Encrypt and EncryptionContext AAD validation (#825)
* fix(kms): non-deterministic Encrypt and EncryptionContext AAD validation

Two security-parity bugs in the KMS mock:

- Encrypt was deterministic: identical Plaintext + KeyId + EncryptionContext
  produced byte-identical CiphertextBlob, leaking plaintext equality. Real
  AWS derives a fresh AES-GCM key per call and is non-deterministic.

- Decrypt ignored EncryptionContext, so a ciphertext encrypted under
  {tenant: "1"} decrypted successfully under {tenant: "999"} (or no context
  at all). Real AWS binds EncryptionContext as AAD and fails with
  InvalidCiphertextException on any mismatch.

Switched the mock blob format to embed (a) a fresh 8-byte random nonce per
call and (b) a SHA-256 fingerprint of the canonicalized, sorted
EncryptionContext. Decrypt now rejects on fingerprint mismatch. Omitted
context and {} are interchangeable, matching AWS.

Threaded EncryptionContext through Encrypt / Decrypt / GenerateDataKey /
GenerateDataKeyWithoutPlaintext / ReEncrypt handlers (ReEncrypt honors
both SourceEncryptionContext and DestinationEncryptionContext).

Closes #816
Closes #817

* fix(kms): address review feedback on PR #825

- Accept legacy v1 blobs (kms:<keyId>:<base64>) in parseBlob, for
  back-compat with persistent stores that hold pre-v2 ciphertext.
- Cache SecureRandom as a static final field instead of allocating
  per Encrypt call.
- Replace the double-parseBlob pattern in handleDecrypt and
  handleReEncrypt with a new single-pass KmsService.decryptAndResolveKey
  method that returns plaintext + source key ARN in one record.
  decrypt() and decryptToKeyArn() remain independent primitives and
  do not delegate through the new composite.
- Add reEncryptHonorsSourceContext test asserting that wrong source
  context fails the decrypt half and that the destination blob is
  bound to destination context, not source.
- Add legacyV1BlobDecryptsForBackCompat test pinning the v1 fallback
  parser behavior (accepts empty/null context, rejects non-empty
  context, resolves source key ARN).
- Clean up inline fully-qualified class references in tests to use
  imports (Arrays, LinkedHashMap).

* test(kms): pin v1↔v2 prefix collision behavior

Locks in the documented limitation that a pre-PR v1 ciphertext encrypted
under an override-id of literally "v2" produces "kms:v2:<base64>", which
is indistinguishable by prefix from a malformed v2 blob and is rejected
by parseBlob with InvalidCiphertextException.

Trade-off, not a bug:
- Failure is loud (InvalidCiphertextException), not silent corruption.
- Conditions to hit are extremely narrow (persistent mode + override-id
  + key literally named "v2" + crossing the pre-PR upgrade boundary).
- Avoiding it would require either silently-lenient fallback parsing or
  a v2-prefix rename, both with their own trade-offs.

If a future refactor changes BLOB_PREFIX_V2 or adds fall-through parsing,
this test fails — prompting a deliberate decision rather than a silent
behavior change.
2026-05-14 07:12:29 -05:00
RyotaroKoshio 6f57af3edc fix(s3): strip charset parameter from XML response Content-Type (#809)
* fix(s3): strip charset parameter from XML response Content-Type

Real AWS S3 returns `Content-Type: application/xml` for every XML
response, but Quarkus REST automatically appends `;charset=UTF-8` to
text-like media types declared via `@Produces(APPLICATION_XML)`. Some
SDKs treat the extra parameter as a wire-format deviation.

A `ContainerRequestFilter` registers a Vert.x `addHeadersEndHandler`
that strips the charset just before HTTP headers hit the wire. The
hook is necessary because for `Response.ok(entity).build()` (the
common pattern in S3Controller), Quarkus REST's optimised write path
bypasses both `ContainerResponseFilter` and `WriterInterceptor` — they
see `getMediaType() == null`.

Test: S3ContentTypeCharsetFilterTest covers ListBuckets (200) and
NoSuchBucket (404).

* fix(s3): address review feedback on charset filter

- Trim class-level Javadoc to match sibling-filter convention.
- Add @ApplicationScoped so the filter is a single shared CDI bean,
  matching the S3VirtualHostFilter pattern.
- Tighten the semicolon-index guard from semi <= 0 to semi < 0 (a
  semicolon at index 0 is not a valid MediaType).
- Add jsonResponseContentTypeUntouched regression test against
  /_floci/health to guard against future widening of the XML guard.
2026-05-14 07:11:33 -05:00
Stuart Lang 3bf16e3fb9 fix(sqs): FIFO ReceiveMessage returns multiple messages per group per call (#785)
* fix(sqs): FIFO ReceiveMessage returns multiple messages per group per call

A FIFO ReceiveMessage call may legitimately return multiple messages
from the same MessageGroupId, in insertion order, up to
MaxNumberOfMessages. Floci was capping each call at one message per
group, which in practice limited tests to 1-2 messages regardless of
how many were queued and broke ordering tests for high-throughput
("fair") FIFO queues distributing across groups.

The cross-call group lock is unchanged: a group with an in-flight
message from a previous call is still blocked until that message is
deleted or its visibility expires. Only the within-call constraint
was wrong.

Existing tests that asserted the buggy "one per group per call"
contract have been updated to assert AWS-correct behavior.

Refs #768.

* test(sqs): address PR review feedback on FIFO multi-message tests

- Loosen cross-group ordering assertions in FIFO receive tests:
  FIFO only guarantees ordering within a MessageGroupId, not across
  groups, so assert group1 messages are in-order relative to each
  other and group2 message is present without fixing its position.
- Rename fifoQueue_groupLockBlocksAcrossCallsButNotWithin to
  fifoQueueGroupLockBlocksAcrossCallsButNotWithin to match the
  test class's lowerCamelCase convention.

* test(sqs): add FIFO partial-drain unlock and compat coverage

Address review feedback on PR #785:

- SqsServiceTest: add fifoQueueGroupUnlocksAfterAllInFlightMessagesDeleted
  covering the most common consumer pattern — drain less than a full
  group in one call, delete the in-flight messages, then receive the
  remainder. Verifies the group lock unlocks once all in-flight
  messages from that group are deleted.
- sdk-test-java SqsTest: add fifoReceiveReturnsMultipleMessagesFromSameGroupInOneCall
  as the first FIFO test in the compatibility suite. Sends 3 messages
  to a single MessageGroupId and asserts a single ReceiveMessage with
  MaxNumberOfMessages=10 returns all three — closes the gap noted in
  the review and provides a regression guard against real AWS.
2026-05-14 06:52:51 -05:00
Stuart Lang ffd7779c5c fix(sqs): honor AttributeNames/MessageSystemAttributeNames on ReceiveMessage (#784)
* fix(sqs): honor AttributeNames/MessageSystemAttributeNames on ReceiveMessage

ReceiveMessage previously emitted a fixed set of system attributes
(ApproximateReceiveCount, SentTimestamp, plus FIFO fields when
present) regardless of what the caller asked for. AWS instead returns
exactly the attributes the request selects:

- empty list -> no system attributes
- ["SenderId"] -> only SenderId
- ["All"] -> SenderId, SentTimestamp, ApproximateReceiveCount,
  ApproximateFirstReceiveTimestamp (and FIFO MessageGroupId,
  SequenceNumber, MessageDeduplicationId when applicable)

Both the legacy AttributeName.N / AttributeNames parameter and the
modern MessageSystemAttributeName.N / MessageSystemAttributeNames
parameter are honored.

SenderId derives from the account ID parsed from the queue URL
(falling back to the configured default account), matching the
multi-tenancy isolation introduced in #753. A new
firstReceiveTimestamp field on Message backs
ApproximateFirstReceiveTimestamp and is set on first claim.

Refs #768.

* test(sqs): cover legacy AttributeNames and Query-protocol filtering

Adds Query-protocol receive-with-filter coverage and a legacy
AttributeNames case to the JSON test, and clarifies the senderIdFor
Javadoc to reflect actual fallback order (queue URL → request context
→ default).
2026-05-14 06:42:39 -05:00
Federico Mariani e62fd09b6d feat(transcribe): add AWS Transcribe service support (#820) (#827) 2026-05-14 06:41:31 -05:00
Yassir Idhbi 4d2a99506a feat: add ListTagsForResource, TagResource, UntagResource for Step Functions (#767)
* feat: add ListTagsForResource, TagResource, UntagResource for Step Functions

Implements the SharedTagsController TagHandler pattern for SFN state
machines and activities. Adds tags field to StateMachine and Activity
models, tag CRUD methods to StepFunctionsService, and a new
StepFunctionsTagHandler that registers the 'states' service key.

Closes #766

* feat: cover JSON 1.0 SDK wire path for SFN tag operations

Add ListTagsForResource, TagResource, UntagResource cases to
StepFunctionsJsonHandler for AWS SDK (awsJson1.0) compatibility.
The REST /tags/{arn} path (SharedTagsController) already covers
Terraform; this commit covers the SDK path.

Expand integration test to verify both wire paths. Add SDK-based
compatibility test using SfnClient.

* chore: remove invented inline comment from tags integration test

* refactor: remove dead REST TagHandler and clean up integration tests

StepFunctionsTagHandler registered the 'states' service key with
SharedTagsController (REST /tags/{arn}), but SFN uses JSON 1.0 exclusively.
No real client calls GET/POST/DELETE /tags/arn:aws:states:... — the handler
was unreachable dead code.

Remove StepFunctionsTagHandler and strip the eight REST-path tests from
StepFunctionsTagsIntegrationTest. The remaining JSON 1.0 tests are now
self-contained (no longer depend on state set by the deleted REST tests).

* fix: correct SDK API usage in tag tests and persist creation-time tags

- Fix StepFunctionsTagsTest: tags() takes Tag... not Map, use tagsAsMap()
  helper to convert List<Tag> before asserting with MapAssert methods
- Fix StepFunctionsService: pass tags through createStateMachine/createActivity
  so tags set at creation time are persisted immediately
- Fix StepFunctionsJsonHandler: extract parseTagsArray() helper, add 400
  validation when tags/tagKeys are not arrays, wire tags into create calls
- Expand StepFunctionsTagsIntegrationTest: cover creation-time tag persistence
  for state machines and activities, and 400 on malformed tag input
2026-05-13 23:46:54 -05:00
Stuart Lang 39ef0694a4 fix(sqs): implement AddPermission and RemovePermission (#781)
* fix(sqs): implement AddPermission and RemovePermission

Both actions previously returned UnsupportedOperationException, which
also masked the queue-existence check. They now manage labelled
Statement entries in the queue's Policy attribute:

- AddPermission appends a statement (Sid=Label, Effect=Allow,
  Principal=arn:aws:iam::<accountId>:root list, Action=SQS:<name> list,
  Resource=<queue ARN>). Duplicate label returns InvalidParameterValue.
- RemovePermission drops the statement with the given Sid, removing the
  Policy attribute entirely when no statements remain. Unknown label
  returns InvalidParameterValue.
- Both surface QueueDoesNotExist when the queue is absent.

Refs #768.

* fix(sqs): address PR review comments on AddPermission

- Use AWS-spec parameter names (AWSAccountId, ActionName) in MissingParameter
  messages instead of plural variants.
- Reject unparseable existing Policy attribute with InvalidAttributeValue
  rather than silently overwriting it with a fresh document.
2026-05-13 23:42:08 -05:00
rishvv 3f8b6017a0 fix(stepfunctions): honour TimeoutSeconds on Parallel state (#771)
The Parallel state executor was using a hardcoded 60-second deadline
per branch future instead of reading the optional TimeoutSeconds field
from the state definition. When TimeoutSeconds is set, a single
deadline is computed before collecting results so the limit applies
across all branches rather than per-branch. When TimeoutSeconds is
absent the futures are awaited without a deadline, matching the AWS
behaviour of no timeout unless specified.
2026-05-13 18:16:02 -05:00
Hector Ventura 5ab178e10d fix(dynamodb): improve conformance across validation, expressions, and queries (#826)
* fix(dynamodb): improve conformance across validation, expressions, and queries

- Rename InvalidParameterValue → ValidationException for table-name errors
- Enforce min-length 3 on table names for all operations, not just CreateTable
- ListTables: alphabetical order, Limit validation (1–100), pagination
- Enum validation (ReturnValues, ReturnConsumedCapacity) fires before table lookup
- ProjectionExpression support on GetItem, Query, Scan, BatchGetItem
- Select=COUNT returns Count/ScannedCount and omits Items
- Parallel scan: Segment/TotalSegments validation and hash-based sharding
- Reserved words rejected in FilterExpression, ConditionExpression, UpdateExpression
- Legacy API: AttributesToGet, AttributeUpdates, QueryFilter, ScanFilter, KeyConditions
- TransactWriteItems idempotency token with payload-hash conflict detection
- ReturnValuesOnConditionCheckFailure on PutItem, UpdateItem, DeleteItem
- Item size limit (400 KB) and number normalization on write
- Tags API: TagResource, UntagResource, ListTagsOfResource with ARN validation
- New Java and Node SDK conformance tests covering all changes above

* fix(dynamodb): fix unit testing
2026-05-13 02:14:00 -05:00
Shubham Srivastava e0224e93e6 feat(pricing): add AWS Price List Service support (#821)
Implements the `AWSPriceListService.*` JSON 1.1 surface backed by a
bundled static snapshot on the classpath. Covers the five public
operations: `DescribeServices`, `GetAttributeValues`, `GetProducts`,
`ListPriceLists`, and `GetPriceListFileUrl`, with pagination (Base64
offset tokens) and the array-of-JSON-strings `PriceList` shape the
real AWS SDKs expect.

Rationale: Floci today cannot back FinOps tooling (cost detection,
budget guards, CUR parsers, etc.) because the billing APIs are
absent. Pricing is the stateless prerequisite for the Cost Explorer
and CUR services that follow — cost lines are synthesized as
`resource state x pricing snapshot`, so the snapshot data path is the
foundation.

Snapshot layout on the classpath (and mirrored on the filesystem
when `FLOCI_SERVICES_PRICING_SNAPSHOT_PATH` is set):

    pricing-snapshots/services.json
    pricing-snapshots/attribute-values/<ServiceCode>/<Attr>.json
    pricing-snapshots/products/<ServiceCode>/<Region>.json
    pricing-snapshots/price-lists/<ServiceCode>.json

The bundled snapshot is intentionally minimal — `AmazonEC2`,
`AmazonS3`, and `AWSLambda` in `us-east-1` — to exercise SDK parsing
and filter logic without bloating the image. Users needing broader
coverage point the override env var at a full snapshot generated
from the AWS Price List bulk API.

Wiring follows the existing JSON 1.1 stateless pattern (Textract,
Secrets Manager): descriptor in `ResolvedServiceCatalog`, handler
injected into `AwsJson11Controller`, service config on
`EmulatorConfig.ServicesConfig`. No new protocol, no changes to
existing services, no new runtime dependencies.

Tests: `PricingIntegrationTest` covers all five operations via
RestAssured JSON 1.1 wire-format assertions, including validation
errors, unknown-service errors, filter matching, and pagination
tokens (17 tests, all green).

Refs: https://github.com/orgs/floci-io/discussions/791
2026-05-13 01:34:19 -05:00
Stuart Lang 734e318278 fix(sqs): return MD5 of current request on FIFO dedup replay (#786)
* fix(sqs): return MD5 of current request on FIFO dedup replay

On a duplicate SendMessage within the 5-minute FIFO dedup window
Floci returned the original message verbatim, including its cached
MD5OfMessageBody and MD5OfMessageAttributes. AWS SDK clients validate
those MD5s against the body and attributes they sent, so any time the
second send differed from the first (or even when the first send had
different attribute keys than the second's body alone) the SDK threw
"MD5 returned by SQS does not match the calculation on the original
request" and never delivered the message.

AWS itself returns the original MessageId and SequenceNumber on
dedup, but recomputes MD5s from the current request so the validation
round-trips. Floci now does the same. A new SDK-driven integration
test (sqs Java SDK at test scope) covers the dedup-replay case plus
several standard/FIFO/binary/custom-type-name MD5 round-trips.

Refs #768.

* test(sqs): tighten dedup-replay MD5 test and drop redundant @Inject

Address review feedback on #786:
- Assert the second SendMessage returns the same MessageId and
  SequenceNumber as the first, so the test would catch a regression
  that silently disabled dedup (in which case the MD5 round-trip
  would also pass for the wrong reason).
- Drop the redundant @Inject on the @ConfigProperty-injected field,
  matching the convention used in other Floci integration tests.

* test(sqs): move FIFO MD5 SDK tests to compatibility-tests/sdk-test-java

Address maintainer review on #786:
- Drop the software.amazon.awssdk:sqs test-scope dependency from the
  main module's pom.xml.
- Move SqsSdkMd5IntegrationTest to the compatibility-tests/sdk-test-java
  module as SqsMd5Test, where the existing AWS SDK v2 compatibility
  suite already lives. The test now follows that module's conventions
  (TestFixtures.sqsClient, AssertJ, lowerCamelCase method names, queue
  cleanup) and exercises the same scenarios: standard / FIFO / fair MD5
  parity, binary and custom-type-name attributes, and the dedup-replay
  case that asserts the second SendMessage returns the original
  MessageId and SequenceNumber.
2026-05-13 01:17:17 -05:00
Benson 6b2c081f0b fix(dynamodb): correct UpdateExpression semantics and TransactWriteItems idempotency (#804)
Three related DynamoDB correctness fixes, all in the same DynamoDbService surface:

1. Cross-attribute SET reads pre-update values (#798)
   "SET a = :v, b = a" now writes the *original* value of `a` into `b`, matching
   real DynamoDB. Snapshot the item once at the start of applySetClause and
   resolve every RHS reference against the snapshot; defer writes to `item`.
   Previously, in-place mutation between comma-separated clauses caused later
   clauses to read post-update values, silently corrupting audit/history fields.

2. ClientRequestToken idempotency for TransactWriteItems (#799)
   Same token + same body → no-op success. Same token + different body →
   IdempotentParameterMismatchException. Implemented via a per-region in-memory
   cache with a 10-minute TTL (matching the AWS window) keyed by
   "region::token" with a SHA-256 of the raw request body for comparison.
   handleTransactWriteItems now extracts ClientRequestToken from the request
   and forwards it plus the raw body through a new 4-arg
   transactWriteItems(items, region, token, rawRequest) overload. The original
   2-arg signature is preserved as a no-token convenience that delegates.

3. Parenthesized arithmetic in SET silently dropped (#802)
   "SET c = (c - :v)" now applies identically to "SET c = c - :v". Added
   stripOuterParens() and call it on each SET-action RHS before
   findArithmeticOperator() — which still correctly only finds operators at
   depth 0, but now sees an unwrapped expression to scan. Combined forms like
   "SET c = (if_not_exists(c, :d) - :v), other = :s" now apply both clauses
   instead of dropping the parenthesized one while applying the other.

Tests
- DynamoDbServiceTest gains 8 regression tests:
  cross-attribute SET (plain + #name), parenthesized arithmetic (simple,
  with if_not_exists, doubled parens, alongside a plain assignment), and
  TransactWriteItems idempotency (no-op replay, parameter-mismatch error,
  null-token bypass).

Refs: #798, #799, #802
2026-05-13 00:38:56 -05:00
been-there-done-that 558983078c fix(cloudwatch-logs): implement PutSubscriptionFilter and DescribeSub… (#810)
* fix(cloudwatch-logs): implement PutSubscriptionFilter and DescribeSubscriptionFilters

Add subscription filter CRUD support (Put, Describe, Delete) to
CloudWatch Logs service. Previously these operations returned
UnsupportedOperation.

Closes #795

* fix(cloudwatch-logs): upsert subscription filters and default distribution to ByLogStream

- PutSubscriptionFilter now overwrites existing filters instead of
  throwing LimitExceededException (matches real AWS upsert behaviour)
- Default distribution to "ByLogStream" when not provided
- Update tests for new behaviour
2026-05-12 20:42:41 -05:00
been-there-done-that 4b6b99c1e5 fix(api-gateway): resolve sibling {proxy+} collision with longest-prefix matching (#811)
* fix(api-gateway): resolve sibling {proxy+} collision with longest-prefix matching

When multiple sibling {proxy+} resources exist (e.g. /auth/{proxy+}
and /products/{proxy+}), the first one registered always matched
every request regardless of the parent path. Now the proxy+ with
the longest parent prefix matching the request path is selected,
matching real AWS behaviour.

Closes #792

* test(api-gateway): add unit tests for proxy+ path matching

Add 7 focused tests for the matchResource method covering root proxy+,
sibling proxy+ routing, fallback behaviour, exact/template priority,
longest parent prefix, and no-match cases.

* fix(api-gateway): reject empty proxy+ segments and use cleaner path extraction

Adopt reviewer's suggestion: use substring before {proxy+} for parent
prefix extraction instead of lastIndexOf('/'), and require at least one
path segment after the prefix for non-root proxy+ resources. Root
/{proxy+} still matches / as a special case.

Adds tests for empty proxy segment edge case (/auth/ should not match
/auth/{proxy+}) and updates longestParentPrefixWins assertion for /api/
(should be null, not match).
2026-05-12 20:19:46 -05:00
Marvelous Ikponmwosa e89777b8a2 feat(eventbridge): add TestEventPattern action (#824)
* feat(eventbridge): add TestEventPattern action

Exposes the existing rule pattern matcher as a public API so callers can
test whether a sample event would match an event pattern without firing
any targets. Adapts the AWS event envelope (lowercase source / detail-type
/ detail / resources) to the internal entry shape and delegates to the
same matchesPattern() helper that powers PutEvents rule dispatch.

Returns {"Result": <bool>} on success, InvalidEventPatternException (400)
on malformed pattern or missing event.

* fix(eventbridge): reject empty EventPattern in TestEventPattern

AWS marks EventPattern as a required field for TestEventPattern. The
previous implementation accepted null/empty values and silently delegated
to matchesPattern(), which returns true for blank patterns — turning the
API into an unintended match-all. matchesPattern()'s blank-is-match-all
behavior is intentional for rule dispatch (rules with no EventPattern are
scheduled rules that fire on every match attempt), but exposing it here
violates the spec.

Now throws InvalidEventPatternException (400) when EventPattern is null
or blank. Verified end-to-end via boto3: the typed exception is raised
client-side. The integration test that asserted the wrong behavior is
flipped, and a new test covers the missing-field case.

* fix(eventbridge): honor account/region from event and reject non-object Events
2026-05-12 20:15:56 -05:00
Kenshin Okinaka 944f82a6a4 feat(ses): add v2 suppression list endpoints (#813)
* feat(ses): add v2 suppression list endpoints

Implements the v2 SES suppression list management plane at
/v2/email/suppression/addresses:

- PUT  /v2/email/suppression/addresses                 PutSuppressedDestination
- GET  /v2/email/suppression/addresses/{EmailAddress}  GetSuppressedDestination
- DELETE /v2/email/suppression/addresses/{EmailAddress} DeleteSuppressedDestination
- GET  /v2/email/suppression/addresses                 ListSuppressedDestinations
                                                       (repeated Reason filter)

Entries are persisted per region in ses-suppression.json. A repeat Put for
the same EmailAddress updates the existing entry's Reason and LastUpdateTime.
List responses are sorted by LastUpdateTime then EmailAddress for stable
output across runs.

Behaviour aligned with real AWS responses:

- EmailAddress is silently trimmed of leading/trailing whitespace on Put
  / Get / Delete; whitespace-only is rejected with BadRequestException.
- Reason validation errors use the AWS-canonical "1 validation error
  detected: Value at '<field>' failed to satisfy constraint: Member must
  satisfy enum value set: [BOUNCE, COMPLAINT]" wording, with the nested
  "Member must satisfy constraint: [...]" wrapping AWS emits for the
  list-typed reasons filter.
- ListSuppressedDestinations accepts a repeated Reason query param (the
  Java SDK's .reasons(...) varargs serialise this way) and applies
  OR-semantics across the supplied values.
- GetSuppressedDestination and DeleteSuppressedDestination return
  NotFoundException with "Email address <X> does not exist on your
  suppression list." for unknown addresses — Delete is not idempotent
  on AWS so floci matches.

SendEmail integration is intentionally out of scope: suppressed addresses
are still delivered locally so that existing send tests remain unaffected.
A follow-up PR can wire suppression checks into the send path along with
the PutAccount/ConfigurationSetSuppressionOptions configuration endpoints.

Tests:
- SesSuppressionV2IntegrationTest covers Put/Get/Delete lifecycle, List
  sort order, single- and multi-Reason filter (with OR semantics), Put
  updates, trim-on-Put, idempotent-Get-on-known, and validation errors.
- SesSuppressionListTest exercises the same surface through the Java SDK
  v2 SesV2Client.

* fix(ses): reject null and non-object bodies on PutSuppressedDestination

Jackson's NullNode.asText("default") returns the literal string "null"
rather than the default, so a body like
  {"EmailAddress": null, "Reason": "BOUNCE"}
silently stored an entry under the email address "null". Validate the
body is a JSON object via requireJsonObject and require both
EmailAddress and Reason to be present and textual via a new
readRequiredStringField helper.

SesSuppressionV2IntegrationTest gains three cases covering null
EmailAddress, null Reason, and a non-object root body.
2026-05-12 19:44:31 -05:00
Stuart Lang 7516acb5f9 fix(sqs): omit Messages field from empty ReceiveMessage JSON response (#780)
* fix(sqs): omit Messages field from empty ReceiveMessage JSON response

Real AWS SQS omits the Messages field entirely when a ReceiveMessage
call returns no messages. With AWSConfigs.InitializeCollections=false
(the modern AWS SDK default) the SDK leaves the response collection as
null in that case, which several parity tests assert.

Floci was emitting "Messages": [] instead, so the SDK deserialized it
to a non-null empty list. This broke the StartMessageMoveTask family
of tests (which drain a freshly-created queue and assert null) and
~12 other tests in the .NET conformance sweep.

Refs #768.

* test(pipes): handle empty AWS CLI output in stopped-pipe assertion

After the SQS ReceiveMessage fix, an empty queue response is `{}` instead
of `{"Messages": []}`. The AWS CLI may emit an empty string in that case,
which makes `jq` fail and leaves msgs as empty, breaking the assertion.

Default $out to `{}` so the .Messages // [] fallback applies cleanly.
2026-05-12 19:30:02 -05:00
Ben Younes 31f9ade3a6 fix(cloudformation): preserve Targets[].SqsParameters on AWS::Events::Rule (#793)
CloudFormationResourceProvisioner.provisionEventBridgeRule was reading
only Id/Arn/Input/InputPath from each target node and dropping
SqsParameters. EventBridge then delivered to FIFO SQS queues without a
MessageGroupId, which AWS rejects with:

  The request must contain the parameter MessageGroupId.

The same target works when registered via the direct events PutTargets
API path, which already parses SqsParameters.MessageGroupId in
EventBridgeHandler. The CFN provisioner now mirrors that logic so
CloudFormation-managed FIFO targets behave identically to direct ones.

Closes #787
2026-05-12 00:07:38 -05:00
Hector Ventura c8c77c9e6e feat(s3): virtual-hosted style addressing support (#805)
*.s3.localhost.floci.io, *.localhost.localstack.cloud, and
  *.s3.localhost.localstack.cloud as virtual-hosted style regardless of
  FLOCI_HOSTNAME — fixes 405 when SDK uses endpointOverride("http://localhost:4566")
  without forcePathStyle (closes #801)
- EmbeddedDnsServer ships localhost.localstack.cloud and localhost.floci.io
  as built-in suffixes so spawned containers resolve these domains to Floci's
  IP without extra config
- Compatibility test S3VirtualHostStyleTest covers the full virtual-host path
  end-to-end; TestFixtures.s3VirtualHostClient() prefers s3.localhost.floci.io,
  falls back to s3.localhost.localstack.cloud, or uses FLOCI_S3_VHOST_ENDPOINT
  in Docker
- run-docker-tests.sh and compatibility.yml inject --dns <floci-ip> and
  FLOCI_S3_VHOST_ENDPOINT=http://floci:4566 into test containers
- S3 and migrate-from-localstack docs updated with virtual-hosted style details
2026-05-11 23:53:28 -05:00
Stuart Lang ec9631e8c5 fix(sqs): honor MaximumMessageSize attribute on SendMessage (#782)
* fix(sqs): honor MaximumMessageSize attribute on SendMessage

SendMessage previously enforced a hard-coded 256 KiB limit regardless
of the queue's MaximumMessageSize attribute, and the error text always
referenced 262144 bytes. Two behavioral problems:

- Queues created with MaximumMessageSize=1048576 still rejected
  payloads over 256 KiB.
- The size check only inspected the message body (in chars), not body
  bytes plus message attribute name/type/value bytes, the formula AWS
  uses to compute total message size.

Both are now fixed: SendMessage reads the queue's MaximumMessageSize
attribute (clamped to AWS's 1024..1048576 range), computes total size
as UTF-8 body bytes + per-attribute (name + type + value) bytes, and
reports the queue's configured limit in the error message.

Refs #768.

* fix(sqs): clamp MaximumMessageSize to AWS range, rename test var

Address PR review feedback:
- parseMaxMessageSize now clamps out-of-range values to [1024, 1048576]
  instead of silently falling back to the service default, matching the
  PR description and avoiding surprising behavior for queues configured
  with values just outside the AWS range.
- Rename misleading test variable halfMeg (300 KiB body) to body.
2026-05-11 23:52:58 -05:00
Stuart Lang 6f9782d093 fix(sns): enforce message size limits on Publish and PublishBatch (#783)
* fix(sns): enforce message size limits on Publish and PublishBatch

Real AWS SNS rejects oversized publish payloads:
- Publish: message + Subject + message attributes must not exceed
  262144 bytes, otherwise InvalidParameterException with "Invalid
  parameter: Message too long".
- PublishBatch: total bytes across all entries (message + Subject +
  attributes per entry) must not exceed 262144, otherwise
  BatchRequestTooLong.

Floci was silently accepting both, which broke the .NET conformance
tests asserting these limits. Size accounting matches AWS: UTF-8 bytes
for message and subject, plus per-attribute (name + type + value)
bytes, with the binary-value byte length used directly for Binary
attributes.

Refs #768.

* fix(sns): address review — apply size limit to SMS, fix batch attr cast

Move the Publish size check before the SMS short-circuit so oversized
SMS payloads are also rejected.

Normalize PublishBatch MessageAttributes in SnsJsonHandler to
MessageAttributeValue objects so SnsService.publishBatch's cast no
longer risks a ClassCastException.
2026-05-11 23:50:26 -05:00
Ben Younes 02ab9dd1eb fix(cloudformation): provision AWS::ApiGateway::Authorizer and wire Method.AuthorizerId (#796)
CloudFormationResourceProvisioner had no case for AWS::ApiGateway::Authorizer
so the resource fell through to the default stub and never reached
ApiGatewayService. Stacks reported CREATE_COMPLETE while
`get-authorizers` returned an empty list.

provisionApiGatewayMethod additionally ignored AuthorizerId on the
template, so CUSTOM/COGNITO_USER_POOLS methods were registered with a
null authorizerId. The combined effect was a CloudFormation-managed
TOKEN authorizer flow that silently behaved as `AuthorizationType: NONE`.

This change adds a dedicated provisionApiGatewayAuthorizer that maps the
CFN PascalCase properties (Name, Type, AuthorizerUri, IdentitySource,
AuthorizerResultTtlInSeconds) onto the existing
ApiGatewayService.createAuthorizer request shape, and threads
AuthorizerId through provisionApiGatewayMethod so `!Ref MyAuthorizer`
resolves correctly.

Closes #788
2026-05-11 23:48:37 -05:00
codingkiddo c87abb082e refactor: use HexFormat for digest encoding (#772) 2026-05-11 19:52:29 -05:00
Kenshin Okinaka 15db990b39 fix(ses): allow SendRawEmail without Source when MIME From is present (#800)
* fix(ses): allow SendRawEmail without Source when MIME From is present

AWS SES SendRawEmail treats the Source parameter as optional — when
absent, the From: header in the raw MIME message acts as the source
identity. A previous validation pass added a null/blank check that
rejected such requests, breaking the AWS-spec fallback and surprising
applications migrating from real AWS or LocalStack.

The downstream SmtpRelay path already falls back to the MIME From
header when source is null, so removing the validation is sufficient.

* test(ses): use unique @Order value for new SendRawEmail regression test

The new sendRawEmail_withoutSource_acceptedWhenMimeFromPresent test was
inserted with @Order(20), which conflicted with an existing test later
in the same class. With OrderAnnotation, equal order values make
execution order ambiguous. Bump it past the current max (28) to keep
ordering deterministic.
2026-05-11 19:47:42 -05:00
Asha Somayajula 0d8c6f8bd7 fix(tests): Enhance ElastiCache test reliability and optimize thread … (#758)
* fix(tests): Enhance ElastiCache test reliability and optimize thread handling

Introduced configurable socket timeout and retry logic in integration tests to handle stalling under load. Updated relay threads in the proxy to use platform daemon threads, preventing scheduling issues and improving response delivery in high-load scenarios. These changes improve test robustness and backend-client communication stability.

* fix(tests): Add readiness probe for ElastiCache backend connections

Introduce a retry-based readiness probe to ensure that ElastiCache handles backend availability before connecting. This prevents issues with premature connections, such as blocking on PONG responses, and improves stability of the container lifecycle process.
2026-05-10 15:37:12 -05:00
Fred Peña ded329beac fix Lambda container networking when Floci runs in Docker (#765)
Automatically detect the Docker network of the running Floci container and use it for spawned containers when no explicit Docker network is configured. This lets Lambda containers reach Floci’s Runtime API in Docker Compose setups without requiring users to manually set FLOCI_SERVICES_LAMBDA_DOCKER_NETWORK.

Also update Lambda/Docker docs to clarify the automatic network inheritance behavior.

Tested with:

./mvnw -q -Dtest=ContainerBuilderTest,CurrentContainerNetworkResolverTest,DockerHostResolverTest,ContainerLauncherTest test
2026-05-10 13:54:23 -05:00
Sai Manohar Veerubhotla bb810a1c64 feat(cognito): support AdminCreateUser MessageAction=RESEND (#755)
- Parse MessageAction in CognitoJsonHandler#handleAdminCreateUser.
- Add a new 5-arg CognitoService#adminCreateUser overload that accepts MessageAction.
- Keep the existing 4-arg adminCreateUser signature and delegate it to the new overload to preserve existing callers.
- Handle RESEND for FORCE_CHANGE_PASSWORD users by refreshing lastModifiedDate and returning the existing user instead of throwing UsernameExistsException.
- Treat RESEND as a no-op invitation refresh because Floci does not have email transport.
- Keep RESEND behavior consistent with other notification-bearing APIs in the emulator.
- Throw UserNotFoundException when RESEND is requested for a missing user.
- Throw UnsupportedUserStateException when RESEND is requested for a CONFIRMED user.
- Align RESEND error behavior with real AWS Cognito.
- Add 3 unit tests in CognitoServiceTest.
- Add 1 wire-level test in CognitoIntegrationTest.
2026-05-10 10:21:40 -05:00
5befe8b619 feat: optional TLS/HTTPS support with self-signed certificate generation (#754)
* feat: optional TLS/HTTPS support with self-signed certificate generation

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

Closes #711

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

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

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

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

---------

Co-authored-by: Dixit R Jain <dixitrjain@Mac-379.lan>
Co-authored-by: Dixit R Jain <dixitrjain@Mac.lan>
2026-05-10 10:21:03 -05:00
iam-ssrivastav f62969a5b1 feat(cognito): add UpdateGroup and ListUsersInGroup actions (#761) 2026-05-10 10:16:52 -05:00
Kenshin Okinaka bcc36c08e0 feat(ses): extend tag endpoints to v2 EmailIdentity ARNs (#760)
* feat(ses): extend tag endpoints to v2 EmailIdentity ARNs

Adds support for arn:aws:ses:<region>:<account>:identity/<email-or-domain>
ARNs across TagResource / UntagResource / ListTagsForResource. Behaviour
was verified against real AWS via aws sesv2 commands and matches the
EmailTemplate routing exactly:

- Tag region mismatch -> BadRequestException "Failed to tag resource"
- Untag region mismatch -> BadRequestException "Failed to untag resource"
- List region mismatch -> Tags resolved against the signing region
- Missing identity -> NotFoundException with "No EmailIdentity present
  with name: <identity>"

Identity gains a tags field. CreateEmailIdentity accepts an optional
Tags array (validated via the existing validateTag()) and persists it
on the freshly verified Identity record. GetEmailIdentity surfaces
stored tags in the existing Tags response field.

Tests:
- SesTagsV2IntegrationTest gains identity lifecycle, identity-not-found,
  and identity-specific region-mismatch / signing-region-lookup cases.
- SesIdentityAttributesV2IntegrationTest covers create-with-tags ->
  Get/ListTagsForResource round-trip.
- SesTagResourceTest (Java SDK compat) exercises CreateEmailIdentity
  with Tags and the Tag/Untag lifecycle on the identity ARN.

* test(ses): move identity tags round-trip test next to other createEmailIdentity cases

The Tags-on-create round-trip case fits better next to the existing
createEmailIdentity_* cases at the top of SesV2IntegrationTest than
it does in the attributes-focused SesIdentityAttributesV2IntegrationTest,
where DKIM / MAIL FROM / Feedback validation lives.

* chore(ses): drop dead identity.setTags call after CreateEmailIdentity

setIdentityTags already persists the tag list on the stored Identity,
and CreateEmailIdentity does not surface Tags in its response per the
AWS spec, so the in-memory mutation that followed had no observable
effect.
2026-05-10 10:12:33 -05:00
Kenshin Okinaka 646b4199df feat(ses): extend tag endpoints to v2 EmailTemplate ARNs (#759)
Adds support for arn:aws:ses:<region>:<account>:template/<name> ARNs
across TagResource / UntagResource / ListTagsForResource. Behaviour
was verified against real AWS via aws sesv2 commands and aligned where
it diverged.

- EmailTemplate gains a tags field. CreateEmailTemplate accepts an
  optional Tags array; tag validation reuses validateTag().
- UpdateEmailTemplate intentionally preserves the existing tags so
  that AWS-style "tags only mutated via Tag/UntagResource" semantics
  hold.
- GetEmailTemplate response surfaces stored tags.
- Missing templates return NotFoundException with the AWS-canonical
  "No Template present with name: <name>" message — AWS uses the bare
  "Template" (not "EmailTemplate") for tag-endpoint lookups even
  though the SDK type is EmailTemplate.

Resource-type-specific routing in the tag endpoints:

- TagResource on a template ARN strictly validates ARN/signing region
  match (BadRequestException "Failed to tag resource" on mismatch),
  matching the existing ConfigurationSet behaviour.
- UntagResource on a template ARN strictly validates ARN/signing
  region match (BadRequestException "Failed to untag resource"),
  whereas ConfigurationSet's lenient ARN-region lookup is preserved.
  AWS treats the two resource types asymmetrically here.
- ListTagsForResource on a template ARN ignores the ARN region and
  resolves the template against the signing region. ConfigurationSet
  continues to route by ARN region.

Three small refactors that fall out naturally from adding a second
taggable resource:

- Tag is promoted from ConfigurationSet.Tag to a top-level
  services/ses/model/Tag so EmailTemplate and the shared helpers no
  longer reference a Configuration-scoped name. JSON serialization is
  unchanged.
- A private mergeTags(existing, incoming) helper centralizes the
  LinkedHashMap merge previously duplicated between
  tagConfigurationSet and tagEmailTemplate.
- A private parseTagsArray(JsonNode) helper centralizes the JSON Tags
  array parse previously duplicated across createConfigurationSet,
  createEmailTemplate, and tagResource. The helper returns null for
  missing/null nodes; the required caller (tagResource) treats null
  as BadRequestException.

Tests:

- SesTagsV2IntegrationTest gains a template lifecycle case, a
  template-not-found assertion, and the two template-specific
  region-mismatch / signing-region-lookup cases.
- SesTemplateV2IntegrationTest covers create-with-tags, list-via-tags
  endpoint, and update-preserves-tags round-trips.
- SesTagResourceTest (Java SDK compat) exercises CreateEmailTemplate
  with Tags and the Tag/Untag lifecycle on the template ARN.
2026-05-09 20:57:29 -05:00
Asha Somayajula ce2012de45 fix(s3): parse copy-source versionId for CopyObject and part copy iss… (#751)
* fix(s3): parse copy-source versionId for CopyObject and part copy issue-748
* fix(s3): support versionId in CopyObject and UploadPartCopy sources - issue-748
* fix(s3): added new line at the end of class S3Controller - issue-748
2026-05-09 08:25:50 -05:00
Hector Ventura 2bed9ec3ad feat(multitenancy): add per-account storage isolation across all services (#753)
Introduces multi-account isolation so that requests authenticated with
different AWS account IDs operate on completely separate resources,
with no cross-account data leakage.

- Add `RequestContext` (@RequestScoped CDI bean) to hold the current
  account ID for the duration of each HTTP request
- Add `AccountResolver` to extract a 12-digit numeric account ID from
  an AWS access key (AKID[4..15]), falling back to `defaultAccountId`
  for non-numeric or legacy keys
- Add `AccountContextFilter` (JAX-RS ContainerRequestFilter) to populate
  `RequestContext` on every incoming request
- Add `AccountAwareStorageBackend<V>` that transparently prefixes every
  storage key with the current account ID; provides explicit-account
  overloads (`getForAccount`, `putForAccount`, `scanAllAccounts`,
 `scanAllAccountsAsMap`, `keysForAccount`) for use by background
  workers that run outside request scope
- Update `StorageFactory` to always wrap created backends in
  `AccountAwareStorageBackend`, making isolation the default for all
  services with no per-service wiring required
- Update `RegionResolver.getAccountId()` to read from `RequestContext`,
  falling back to `defaultAccountId` outside request scope

Store `accountId` on model objects at creation time and use explicit-
account overloads in background pollers and schedulers to prevent
account overloads in background pollers and schedulers to prevent
cross-account data access:

- **SQS** — queue keys scoped per account; DLQ routing and ESM polling
  account-aware
- **SNS** — topic and subscription keys scoped per account
- **Lambda** — function store and ESM store account-aware; SQS, Kinesis,
  and DynamoDB Streams pollers use stored `accountId` for background reads
- **EventBridge** — rules, archives, and replays scoped per account;
  `RuleScheduler` uses rule's stored `accountId` for background dispatch
- **Kinesis** — stream keys and shard iterators scoped per account
- **Firehose** — delivery stream keys scoped per account
- **Pipes** — pipe keys scoped per account; poller uses stored `accountId`
- **Scheduler** — schedule and group keys scoped per account; dispatcher
  uses stored `accountId` for background execution
- **EKS** — cluster keys scoped per account; `accountId` stored on
 `Cluster` model (`@JsonIgnore`) for background use
- **MSK** — cluster keys scoped per account; readiness poller uses stored
  `accountId`; `accountId` stored on `MskCluster` model (`@JsonIgnore`)
- **ECR** — repository keys scoped per account via `effectiveAccount()`
  backed by `regionResolver`
- **OpenSearch** — domain keys scoped per account; readiness poller uses
  stored `accountId`; `accountId` stored on `Domain` model (`@JsonIgnore`)

Replace all occurrences of the hardcoded literal `"000000000000"` and
`config.defaultAccountId()` calls in ARN construction with
`regionResolver.getAccountId()` so that ARNs reflect the actual requesting
account:

- KMS — key ARNs and default key policy principal
- ELBv2 — load balancer, target group, listener, and rule ARNs
- AutoScaling — group, launch configuration, and policy ARNs
- API Gateway — VTL execution context `accountId`
- ElastiCache — user ARNs in DescribeUsers response
- CodeDeploy — application, deployment group, instance, and target ARNs
- CodeBuild — CloudWatch log group ARN
- Transfer — server and user ARNs
- S3 — ACL owner ID in GetBucketAcl / GetObjectAcl responses
- CloudFormation — stack ARN, changeset ARN, and `AWS::AccountId`
  pseudo-parameter; captures account at request time before handing
  off to executor thread
- DynamoDB TTL sweeper — use `scanAllAccountsAsMap()` so the background
  TTL sweep covers all accounts, not just the default

- Add `AccountIsolationIntegrationTest` verifying that SQS queues,
  DynamoDB tables, S3 buckets, Kinesis streams, EventBridge rules,
  Lambda functions, and Secrets Manager secrets created under one
  account are invisible when queried under a different account
- Update unit tests for EKS, MSK, ECR, Pipes, Scheduler, and Glue
  to pass `RegionResolver` through constructors (removes mock of
  `config.defaultAccountId()`)
2026-05-09 08:02:24 -05:00
Kenshin Okinaka 7a036fdf59 fix(sqs): drop uppercase "Tags" read from CreateQueue JSON handler (#752)
* fix(sqs): drop uppercase "Tags" read from CreateQueue JSON handler

AWS SQS JSON 1.0 schema uses lowercase "tags" for CreateQueue (uppercase
"Tags" is reserved for TagQueue). Real AWS treats unknown JSON fields as
ignored, so a hand-crafted client sending uppercase "Tags" would lose its
tags on AWS — but floci silently persisted them, diverging from AWS
behavior and masking client bugs at migration time.

Drop the defensive uppercase merge and add JSON-protocol integration
tests for both the canonical lowercase path (tags persist) and the
uppercase-as-unknown-field path (tags ignored).

* test(sqs): wrap CreateQueue-with-tags tests in try/finally for cleanup

Wrap CreateQueue + ListQueueTags + DeleteQueue test bodies so the
cleanup DeleteQueue runs in a finally block. A failed assertion
previously left an orphan queue, which could mask flake under re-runs
since CreateQueue is idempotent and won't re-apply tags to an existing
queue.
2026-05-09 00:32:49 -05:00
Hector Ventura 15c9f58aae fix(apigateway): treat ANY method as wildcard for concrete HTTP methods (#710) (#750) 2026-05-08 23:38:36 -05:00
Kenshin Okinaka 9b68bd0377 feat(ses): add v2 TagResource / UntagResource / ListTagsForResource (#749)
* feat(ses): add v2 TagResource / UntagResource / ListTagsForResource

Implements the v2 SES tag endpoints at /v2/email/tags. Initial scope
covers ConfigurationSet ARNs only
(arn:aws:ses:<region>:<account>:configuration-set/<name>); other
resource types return NotFoundException so follow-up PRs can extend
coverage to Identity, EmailTemplate, etc.

Behavior aligned with observed AWS responses:

- TagResource enforces ARN/signing region match strictly and rejects
  mismatches with BadRequestException ("Failed to tag resource").
- UntagResource and ListTagsForResource route lookups to the ARN's
  region instead, so a region mismatch surfaces as NotFoundException
  with the resource-specific message (e.g. "No ConfigurationSet
  present with name: <name>").
- TagResource merges by key (existing keys are replaced, others
  retained); UntagResource silently skips keys not present.
- Empty Tags / TagKeys lists are rejected with BadRequestException to
  match AWS validation.
- ARN parsing uses the shared AwsArnUtils helper; missing region or
  account in the ARN is rejected as BadRequest, matching AWS.

Tests:

- New SesTagsV2IntegrationTest for endpoint-focused coverage (lifecycle,
  region-mismatch asymmetry, validation errors).
- Cross-feature round-trip in SesConfigurationSetV2IntegrationTest
  verifying that tags supplied to CreateConfigurationSet are reachable
  via ListTagsForResource.
- New SesTagResourceTest in the Java SDK compatibility suite.

* refactor(ses): drop unused region parameter from list/untag tag service methods

listResourceTags and untagResource route lookups by the ARN's region, so
the request signing region they accepted was never read. Remove it and
stop resolving it in the controller. tagResource still takes region
because it strictly validates it against the ARN.
2026-05-08 19:42:54 -05:00
Dixit R Jain 1ffe905271 fix: SQS tags set at CreateQueue not returned by ListQueueTags (#747)
Tags passed to CreateQueue were silently dropped in both the Query
and JSON protocol handlers — neither extracted the Tags parameter
before calling sqsService.createQueue().

Changes:
- SqsQueryHandler: extract Tag.N.Key/Value params and pass to service
- SqsJsonHandler: read both 'Tags' and 'tags' fields (botocore sends
  lowercase 'tags' for CreateQueue but uppercase 'Tags' for TagQueue)
- SqsService: add createQueue overload accepting tags; existing 2-arg
  and 3-arg overloads delegate with null tags (no callers broken)

Closes #699
2026-05-08 17:17:36 -05:00
Dixit R Jain 3ae5c7b467 feat(apigatewayv2): Add WebSocket data-plane support (#712)
* feat: implement API Gateway v2 WebSocket data-plane support Implement full WebSocket data-plane for API Gateway v2, including: - Real WebSocket connection handling via Vert.x (ws://localhost:4566/ws/{apiId}/{stage}) - $connect/$disconnect/$default route lifecycle with Lambda integration - Custom route selection via routeSelectionExpression ($request.body.{field}) - @connections management API (POST/GET/DELETE) for server-to-client messaging - Lambda REQUEST authorizer support on $connect with identity source validation - Stage variable substitution in integration URIs - Multiple integration types: AWS_PROXY, AWS (VTL), HTTP_PROXY, HTTP (VTL), MOCK - Route response selection expression for bidirectional messaging - Binary frame support (isBase64Encoded: true) - 128 KB payload size limit enforcement (frames and @connections POST) - 10-minute idle timeout and 2-hour max connection duration - GoneException (410) for disconnected connections - $connect response headers propagation - Server-initiated close via @connections DELETE (skips $disconnect Lambda) Also includes: - Refactored LambdaArnUtils.extractFunctionNameFromUri as shared utility - Extended Authorizer/Integration/Stage models with new fields - Comprehensive Java integration tests (WebSocket lifecycle, routing, auth, etc.) - Node.js SDK compatibility tests using ws client and @aws-sdk/client-apigatewaymanagementapi - Updated documentation with full feature matrix

* test(apigatewayv2): support custom WebSocket endpoint via env var

- Update wsUrl helper to read FLOCI_ENDPOINT environment variable
- Convert http/https schemes to ws/wss for WebSocket compatibility
- Strip trailing slashes from endpoint URL for consistent formatting
- Enable testing against non-localhost endpoints for CI/CD flexibility

* fix: use AwsErrorResponse for @connections API error responses

Replace raw JSON string literals in handlePostToConnection,
handleGetConnectionInfo, and handleDeleteConnection with the
project-standard AwsErrorResponse record, which serialises to
the correct {"__type": ..., "message": ...} wire shape.

* fix: simplify extractFunctionNameFromUri using AwsArnUtils.parse

Adopt AwsArnUtils.parse() as the core of the implementation per
reviewer suggestion. One addition beyond the suggested snippet:
the API Gateway v1 integration URI format embeds a Lambda ARN
inside an apigateway ARN (resource starts with 'path/.../functions/'),
so we detect that pattern and recurse on the embedded ARN before
applying the standard function-name extraction. All 43
LambdaArnUtilsTest cases pass, including the API Gateway v1 style URI.
2026-05-08 17:15:35 -05:00
Hector Ventura 01dbc76fc8 feat(docker): named-volume storage for child containers (#743)
Replace the FLOCI_STORAGE_HOST_PERSISTENT_PATH footgun with automatic
named Docker volume management for RDS, OpenSearch, MSK, and ECR.

- Each resource gets a collision-free 6-char hex volumeId generated once
  at creation and stored in the model. Container and volume names both use
  it: floci-{service}-{volumeId}
- Volumes are labelled floci=true for easy pruning
- Memory mode always removes volumes on resource delete. Persistent modes
  retain by default; set prune-volumes-on-delete: true to remove on delete
- Mode detection: FLOCI_STORAGE_HOST_PERSISTENT_PATH set to an absolute
  path → host bind-mount mode (legacy); unset or non-absolute → named-
  volume mode. Volume names in host-persistent-path are not supported
- Removed the container-storage config key — no longer needed
- Updated docker-compose.yml, and all docs
2026-05-08 17:12:36 -05:00
Hector Ventura ccac5f63fd fix(eventbridge): persist and forward SqsParameters.MessageGroupId for FIFO SQS targets (#722) (#742)
EventBridgeHandler manually extracted only Id, Arn, Input, InputPath,
and InputTransformer from the request JSON node — SqsParameters was
never read. This meant the field was never stored, ListTargetsByRule
never returned it, and EventBridgeInvoker called sendMessage without
MessageGroupId, causing FIFO queue delivery to fail with:
"The request must contain the parameter MessageGroupId."

Fix:
- Add SqsParameters model (messageGroupId field)
- Add sqsParameters field to Target model
- EventBridgeHandler.handlePutTargets: read SqsParameters node and
  set it on the target before storing
- EventBridgeHandler.handleListTargetsByRule: write SqsParameters back
  into the response node when present
- EventBridgeInvoker: pass messageGroupId to sendMessage() for SQS
  targets, enabling FIFO queue delivery

Fixes #722
2026-05-07 23:23:29 -05:00
Roméo d7ec2b284f feat(textract): add Textract service support and integration tests (#719)
* feat(textract): add Textract service support and integration tests
* chore(textract): Implement PR suggestions
* fix(textract): remove completed async jobs to prevent memory growth
2026-05-07 21:08:39 -05:00
Kenshin Okinaka d971288d02 feat(ses): add UpdateAccountSendingEnabled (v1) (#737)
Implements the v1 Query action mirroring the existing v2
PUT /v2/email/account/sending endpoint. The Enabled parameter is
optional per AWS docs; missing or empty is treated as false.

Adds integration tests and a Java SDK compatibility test that
exercises both v1 UpdateAccountSendingEnabled and verifies state
is shared with the v2 GetAccount / PutAccountSendingAttributes path.
2026-05-07 21:03:05 -05:00
Chris Wright 271f27da62 fix(cfn): reconcile lambda functions on update (#736) 2026-05-07 20:49:45 -05:00
Hector Ventura 8e617c6add feat(transfer): add AWS Transfer Family management-plane API (#732)
Implements Phase 1 of the Transfer Family JSON 1.1 handler covering
17 operations across server lifecycle, user management, SSH key
management, and tagging.
2026-05-07 01:30:43 -05:00
Leonid Bogdanov 2cc3a1a3ba fix(s3): use queue ARN region when delivering notifications to SQS (#735) 2026-05-07 01:30:32 -05:00
Hector Ventura c2cc053853 feat(backup): AWS Backup management-plane API (#734) 2026-05-07 00:56:34 -05:00
Hector Ventura d51a0f9ce8 fix(ec2): prevent SSH port collision on concurrent RunInstances (#721) (#733)
immediately closing a ServerSocket. Between that check and Docker
binding the port, a second concurrent RunInstances call saw the same
port as free — both instances raced to bind 2200 and the second one
failed with "port is already allocated".

Fix: PortAllocator now maintains an in-memory ConcurrentSkipListSet of
reserved ports. allocate() is synchronized and adds the chosen port to
the set before returning, so concurrent callers skip it even before
Docker has bound it. release() removes the entry when the container is
terminated, making the port available for future instances.

Ec2ContainerManager.terminate() now calls portAllocator.release() after
the Docker container is removed.

Add PortAllocatorTest with 5 cases including a concurrency test that
races 20 threads simultaneously to confirm uniqueness.

Fixes #721
2026-05-07 00:37:31 -05:00
Hector Ventura 3b54255d7f feat(route53): add Route53 management-plane emulation (#715)
* feat(route53): add Route53 management-plane emulation

Implements Route53 Phase 1 with 17 operations: hosted zones (Create,
Get, Delete, List, ListByName, Count), resource record sets
(ChangeResourceRecordSets, List), change tracking (GetChange), health
checks (Create, Get, Delete, List, Update), tagging
(ListTagsForResource, ChangeTagsForResource), and GetAccountLimit.

Auto-creates SOA and NS apex records on zone creation. Rejects deletion
of non-empty zones. All changes return INSYNC immediately. IDs are
returned with path prefixes (/hostedzone/Z…, /change/C…) to satisfy
the SDK Route53IdInterceptor. Nameservers are configurable via
floci.services.route53.default-nameserver[1-4].

Adds OpenTofu and Terraform compatibility tests covering zone creation,
A record, auto-created SOA/NS records, health check, and tag persistence.

* feat(feat): adding missing endpoints

* feat(route53): fix timeout when creating route dns from terraform
2026-05-07 00:22:22 -05:00
Hector Ventura 86eac926f9 feat(elbv2): ALB Lambda target type (#730)
* feat(elbv2): add Lambda target type support for ALB forwarding
2026-05-06 23:51:38 -05:00