Commit Graph
108 Commits
Author SHA1 Message Date
opcode-secandHector Ventura 8fb07d2654 fix(s3): persist inline x-amz-tagging header on PutObject (#987)
* fix(s3): persist inline x-amz-tagging header on PutObject

PutObject silently dropped tags supplied via the x-amz-tagging request header — the controller did not read the header and tags never reached the object store. Adds a header parameter, parses the URL-encoded key=value tag set (with 10-tag and 8 KB limits), and persists via the existing putObjectTagging path so behavior matches real AWS S3.

* test(s3): add negative-path tests for inline x-amz-tagging header

Cover malformed pair, empty key, duplicate key, >10 tags, and oversized header. Note in S3Controller that the InvalidArgument and BadRequest codes match observed real-AWS behavior even though they are not in the S3 Smithy service model

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-05-24 14:30:50 -05:00
nblomquist 894b39f446 fix(s3): avoid misrouting presigned PUTs with tagging (#932) (#995) 2026-05-23 22:33:30 -05:00
Darrell Draney 70958b1091 fix(s3): omit body-description headers and user metadata from PutObject response (#948)
## Summary

S3 `PutObject` was echoing the object's `Content-Encoding` (and `Content-Disposition`, `Cache-Control`, `x-amz-meta-*`) onto a response whose body is always empty. Real AWS S3 omits all of those on PutObject — they only belong on `GetObject` / `HeadObject`, where there is a body to describe.

The user-visible symptom is `Content-Encoding: gzip` on the PutObject response: AWS SDK for Java v2's `Crc32Validation.decompressing` interceptor sees the header, wraps the empty stream in `GZIPInputStream`, and throws `EOFException` from `readHeader`. The object is stored correctly server-side, but every gzip-encoded `PutObject` through the SDK fails before returning — breaking, for example, Spring Cloud AWS's `S3Template.upload(...)` with gzip metadata.

`S3Controller#putObject` now calls a new `appendPutObjectResponseHeaders(resp, obj)` that emits only the headers AWS returns on PutObject (storage-class when set, SSE when set, checksum, object-lock) and intentionally omits `Content-Encoding`, `Content-Disposition`, `Cache-Control`, `Content-Language`, `Expires`, and `x-amz-meta-*`. The shared `appendObjectHeaders` is untouched, so GET / HEAD / CopyObject — including the persistence behavior added by #56 / PR #57 — are unchanged.

Closes #944

## Type of change

- [x] Bug fix (`fix:`)
- [ ] New feature (`feat:`)
- [ ] Breaking change (`feat!:` or `fix!:`)
- [ ] Docs / chore

## AWS Compatibility

Incorrect behavior: PutObject's response copied the object's persisted `Content-Encoding` / `Content-Disposition` / `Cache-Control` / `x-amz-meta-*` headers onto a response that has no body.

Verified against real AWS S3 (`us-west-2`) with AWS CLI v2 (`aws-cli/2.27.58`) and AWS SDK for Java v2 (`software.amazon.awssdk:s3:2.42.24`). Eight `PutObject` scenarios were captured from botocore's `--debug` response-headers log, each with one additional request header. For every header this PR changes Floci's behavior on, the post-PR response matches AWS:

| Request includes | Pre-PR Floci response | Real AWS response | Post-PR Floci response |
|---|---|---|---|
| `Content-Encoding: gzip` | emits `Content-Encoding: gzip` | omits | omits |
| `Cache-Control: max-age=…` | emits `Cache-Control` | omits | omits |
| `Content-Disposition: …` | emits `Content-Disposition` | omits | omits |
| `x-amz-meta-owner: team-a` | emits `x-amz-meta-owner` | omits | omits |

(`Content-Language` and `Expires` exist in the old `appendObjectHeaders` only via `ResponseHeaderOverrides`, and the PutObject path passes `ResponseHeaderOverrides.NONE`, so they were never actually emitted on PutObject responses.)

Regression coverage, both layers:

- New SDK-level test `compatibility-tests/sdk-test-java/S3Test#putObjectWithContentEncodingDoesNotBreakSdkDecompression` uses a real `S3Client` to `PutObject` a gzip-encoded object. Before the fix it throws the exact `EOFException → Crc32Validation.decompressing → DefaultS3Client.putObject` stack from #944; with the fix it passes.
- Existing in-process `S3IntegrationTest#putObjectWithContentEncoding` gains assertions that `Content-Encoding`, `Content-Disposition`, and `Cache-Control` are absent from the PutObject response. Adjacent tests (`getObjectReturnsContentEncoding`, `headObjectReturnsContentEncoding`, `copyObjectPreservesContentEncoding`, and the Cache-Control / Content-Disposition equivalents) continue to assert those headers ARE returned on GET / HEAD / CopyObject — protecting the behavior fixed by #56 / PR #57.

## Checklist

- [x] `./mvnw test` passes locally (4700 tests, 0 failures, 0 errors, 8 skipped)
- [x] New or updated integration test added (RestAssured regression assertions in `S3IntegrationTest#putObjectWithContentEncoding`, plus new SDK test `S3Test#putObjectWithContentEncodingDoesNotBreakSdkDecompression` in `compatibility-tests/sdk-test-java`)
- [x] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
2026-05-20 18:03:54 -05:00
Nitesh K JainandHector Ventura b71cf0f827 feat(neptune): Neptune control plane, Gremlin Docker backend, and SDK compatibility tests (#958)
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-05-20 18:02:00 -05:00
ram-sarf e54a8e502c fix(sns): preserve per-entry MessageAttributes in PublishBatch (#891)
The Query-protocol handler for sns:PublishBatch was extracting Id,
Message, Subject, MessageGroupId and MessageDeduplicationId per entry
but skipped the per-entry MessageAttributes parsing loop that the
single-entry sns:Publish handler already had. As a result every batched
message reached subscribers (SQS, HTTP, Lambda) with an empty attribute
map, even though the AWS API contract treats MessageAttributes as a
first-class field on PublishBatchRequestEntry.

This caused consumers that rely on attributes for metadata (e.g.
CloudEvents binary content-mode: ce-type, ce-id, ce-source, …) to
discard the messages because the routing headers were missing.

Mirror the loop from handlePublish, parsing
PublishBatchRequestEntries.member.N.MessageAttributes.entry.M.* per
entry, and only attach the attributes map when non-empty so the
SnsService receives the same shape as the single-Publish path.

Adds:
 - Handler unit regression test covering attribute forwarding and
   per-entry isolation (entry without attrs must not inherit from
   sibling entries).
 - AWS SDK v2 compatibility test asserting end-to-end fan-out.

Existing single Publish behaviour is unchanged.
2026-05-19 00:49:01 -05:00
Ricardo Medina c426289879 fix(cognito): correct USER_SRP_AUTH PASSWORD_VERIFIER signature (#912)
* fix(cognito): correct USER_SRP_AUTH PASSWORD_VERIFIER signature

Server-side SRP-6a produced HMAC signatures that never matched what
AWS Amplify / SDKs compute, so USER_SRP_AUTH always failed with
NotAuthorizedException. Five independent bugs in the byte layout and
key-derivation chain:

1. SRP multiplier k: hashed N and g left-padded to N_BYTES (384 bytes).
   Cognito/Amplify hash the minimal two's-complement representation
   (385 bytes for N — sign byte prepended because MSB is set — and
   1 byte for g = 2). k participates in both server B = k*v + g^b and
   client S = (B - k*g^x)^(a+ux), so a divergent k breaks the protocol.
   Use N.toByteArray() and G.toByteArray() directly.

2. Session key derivation: previously ran an undocumented "Caldera
   interleaved hash" over S, then fed that into HKDF with a zero salt.
   Cognito applies HKDF-Expand directly over S with the scrambling
   parameter U as salt:
     PRK  = HMAC-SHA256(U_bytes, S_bytes)
     T(1) = HMAC-SHA256(PRK, "Caldera Derived Key" || 0x01)
     key  = T(1)[0..16]
   Inline that HKDF in computeSessionKey; drop interleaved hash + the
   auxiliary hkdf() helper.

3. HKDF output length: helper returned 32 bytes; Amplify uses the first
   16. Return Arrays.copyOf(t1, 16).

4. computeSignature double-HKDF: when sessionKey was already the final
   HMAC key, computeSignature ran HKDF on it again. Use it as-is.

5. computeU / computeX byte layout: U was hashed with A and B
   left-padded to N_BYTES; salt was decoded as raw hex bytes. Amplify
   feeds the minimal two's-complement representation (with sign byte
   for positive MSB-set values). Use BigInteger.toByteArray() for A/B
   and round-trip the hex salt through BigInteger so a sign byte is
   prepended when needed.

Verified by reproducing floci's exact server-side computation in
JavaScript using Amplify's byte conventions: the JS replay reproduces
floci's expected HMAC byte-for-byte (proving the server is internally
consistent) and the divergence from the client's claimed HMAC traces
entirely to k differing. After the fix, USER_SRP_AUTH end-to-end signin
from Amplify v6 (React Native) against floci succeeds.

Compat note: users whose verifier was stored under the previous
computeX with a salt whose first byte has the MSB set (~50% of
generate-salt outputs) will produce a different x and must reset their
password. New signups against this fix are interoperable with Amplify.

Also drops the now-unused padTo() helper.

* test(compatibility): add USER_SRP_AUTH round-trip tests for Node + Java SDKs

The existing CognitoSrpTest only validated that PASSWORD_VERIFIER was
returned by InitiateAuth; nothing exercised the full handshake. With the
server-side SRP math now spec-compliant, add end-to-end tests that prove
real AWS SDK clients authenticate against floci.

Java (sdk-test-java/CognitoSrpTest):
 - Add step 4: compute PASSWORD_CLAIM_SIGNATURE from the challenge using
   the AWS "Caldera" SRP variant, send RespondToAuthChallenge, assert
   AuthenticationResult contains valid JWT id/access/refresh tokens.
 - Helper math (computeX / computeU / computeK / calderaHkdf /
   hmacSha256 / formatCognitoTimestamp) inlined since the AWS Java SDK
   v2 does not expose a public SRP client.

Node (sdk-test-node/tests/cognito-srp.test.ts):
 - New round-trip test using amazon-cognito-identity-js 6.3.16 — the
   canonical JS SRP impl that @aws-amplify/auth wraps internally.
 - Pool is provisioned via AdminCreateUser + AdminSetUserPassword so the
   test doesn't depend on an email-delivered verification code.
 - Validates tokens come back as well-formed JWTs.

Both tests pass against floci with the fix from the previous commit and
fail (CodeMismatchException / NotAuthorizedException) without it.
2026-05-18 23:02:49 -05:00
Hector Ventura fd660e03ed fix(ec2): add missing instance response fields to fix Terraform nil pointer dereference (#871) (#883)
* fix(ec2): add missing instance response fields to fix Terraform nil pointer dereference (#871)

The ENI <attachment> block was absent from Floci's RunInstances and
DescribeInstances XML responses. Terraform provider AWS v5.x iterates
network interfaces and reads iface.Attachment.DeviceIndex without nil-checking
Attachment, causing a panic in resourceInstanceRead.

Additional fields required by the provider were also missing: cpuOptions,
metadataOptions, maintenanceOptions, enclaveOptions, hibernationOptions,
privateDnsNameOptions, capacityReservationSpecification, stateReason,
and blockDeviceMapping.

- Add attachmentId and deviceIndex to InstanceNetworkInterface model
- Populate both fields at ENI creation time in Ec2Service.runInstances
- Emit <attachment> and <privateIpAddressesSet> inside each ENI item in instanceXml()
- Emit all missing instance-level fields in instanceXml()
- Add Ec2InstanceResponseShapeTest compatibility test (16 assertions)
* fix(ec2): fix ec2 unit tests
2026-05-18 22:55:22 -05:00
Prakhar Kapoor 15720e2ee6 feat(apigateway): implement account management endpoints and models (#867)
* feat(apigateway): implement account management endpoints and models
* feat(apigateway): enhance patch operation validation and update throttle settings defaults
* feat(api-gateway): add account management operations to API Gateway v1
* feat(api-gateway): add compatibility tests for account management and update logic
* feat(api-gateway): add missing import for assertions in account compatibility test
2026-05-17 23:42:09 -05:00
Hector Ventura 647b170494 fix(dynamodb): honor legacy Expected condition in UpdateItem (#888)
UpdateItem was silently ignoring the legacy `Expected` parameter sent
by AWS SDK v1 clients, causing conditional writes to always succeed
regardless of the condition.

Two bugs fixed:
- `handleUpdateItem` never read the `Expected` field from the request
- `evaluateLegacyExpected` passed conditions directly to
  `matchesKeyConditionPublic`, which reads `AttributeValueList`, but
  the legacy wire format uses the singular `Value` field instead

The fix reads `Expected` and `ConditionalOperator` in `handleUpdateItem`,
validates mutual exclusion with `ConditionExpression`, fetches the
existing item before the update, and normalizes `{"Value": x}` →
`{"AttributeValueList": [x]}` before delegating to the condition
evaluator.

Closes #848
2026-05-17 23:36:36 -05:00
Hector Ventura 2608b8d6d6 feat(dynamodb): implement ExecuteStatement, ExecuteTransaction, BatchExecuteStatement (#864)
Adds PartiQL support for DynamoDB via a hand-rolled tokenizer and
recursive-descent parser that translates SELECT, INSERT, UPDATE, and
DELETE statements into existing DynamoDbService calls.

  - DynamoDbPartiQLParser: tokenizer + AST (sealed interfaces) with
    positional ? placeholder resolution from Parameters array
  - DynamoDbPartiQLHandler: translates AST to GetItem/Query, PutItem,
    UpdateItem, DeleteItem; always uses ExpressionAttributeNames to avoid
    reserved-keyword conflicts; routes pk-only WHERE to Query (not GetItem)
    when the table has a composite key
  - DynamoDbJsonHandler: wires ExecuteStatement, ExecuteTransaction, and
    BatchExecuteStatement; BatchExecuteStatement captures per-statement
    errors without aborting the batch
  - DynamoDbPartiQLTest: 13 compatibility tests covering INSERT, SELECT
    (pk-only, range, projection, begins_with, ? placeholders), UPDATE
    SET/REMOVE, DELETE, ExecuteTransaction, and BatchExecuteStatement
2026-05-16 19:34:33 -05:00
Kenshin Okinaka 9a10f81fb7 feat(sns): support FilterPolicyScope=MessageBody (#863)
Parse the message body as JSON and evaluate the subscription filter
policy against the parsed tree, with nested-key descent and type-aware
rule matching (string/number/boolean/null values, array-value OR,
exists/prefix/anything-but/numeric). Previously the scope was accepted
but filtering was skipped, so all messages were delivered. Bodies that
are not valid JSON fail closed.

The body is parsed lazily once per publish, only when at least one
subscription uses MessageBody scope, to avoid O(N-subscriptions) parses.
The MessageAttributes scope evaluator is untouched.
2026-05-16 19:21:37 -05:00
Kenshin Okinaka 010bbd15cd feat(ses): add v2 PutAccountSuppressionAttributes (#853)
Implements PUT /v2/email/account/suppression so callers can change the
account-level suppression list reasons (BOUNCE / COMPLAINT). Entries
are persisted per region in ses-account-suppression.json via a new
AccountSuppressionAttributes model.

GetAccount's response is extended with a SuppressionAttributes object
that carries the stored SuppressedReasons. The setting itself is
metadata-only — floci does not synthesise bounce/complaint events so
no auto-suppression is triggered; the configuration round-trips for
SDK users and tooling that introspects account-level settings.

Behaviour aligned with real-AWS verification:

- SuppressedReasons accepts BOUNCE / COMPLAINT, validated against the
  AWS-canonical nested "Member must satisfy constraint:
  [Member must satisfy enum value set: [BOUNCE, COMPLAINT]]" wording
  (verbatim match against real AWS).
- SuppressedReasons may be omitted (treated as empty list) or supplied
  as an empty array (clears the reasons) — both return 200.
- Non-textual array members (JSON null, numeric, etc.) are rejected
  with BadRequestException.
- Fresh regions report the AWS-default [BOUNCE, COMPLAINT] via
  GetAccount; an explicit PUT (including an empty list) overrides it.
- The optional ValidationAttributes body field is accepted but not
  parsed (Tier S scope).

Tests:
- SesV2IntegrationTest gains nine cases covering store-and-list,
  clear-with-empty-array, missing field defaulting to empty, invalid
  Reason (with the AWS-canonical nested message asserted), non-array
  SuppressedReasons, JSON null array member, numeric array member,
  optional ValidationAttributes, and the default-on-fresh-region
  assertion in the existing getAccount case.
- SesAccountSuppressionTest exercises the Java SDK round trip and an
  explicit empty list through SesV2Client; @BeforeAll captures the
  caller's existing SuppressedReasons and @AfterAll restores it with
  failures surfaced so a real-AWS run cannot silently leave the
  account with auto-suppression disabled.
2026-05-15 22:59:14 -05:00
Hector Ventura b5b863c386 fix: broken compatibility-tests java (#857) 2026-05-15 08:32:22 -05:00
Hector Ventura 3be62bc1d8 chore: release 1.5.16 2026-05-15 03:02:17 -05:00
Hector Ventura b6619f8646 fix(floci-core): remove aws sdk from floci project (#846) 2026-05-14 23:39:23 -05:00
Hector Ventura e725f38ac7 feat(s3): full SelectObjectContent evaluator with floci-duck integration (#835)
- Add recursive WHERE evaluator: AND, OR, NOT, LIKE, BETWEEN, IN, IS NULL,
  >=, <=, <> — replaces single-regex implementation
- Add JSON Lines and JSON array input support
- Add cross-format output (CSV→JSON, JSON→CSV)
- Emit real BytesScanned / BytesReturned stats
- Route CSV (USE headers) and JSON through floci-duck when available;
  fall back to Java evaluator in standalone mode
- Route Parquet S3 Select through floci-duck (existing)
- Move FlociDuckManager to services/floci/ and introduce FlociDuckClient
  as a shared duck HTTP client for Athena and S3 Select
- Promote CsvParser to core/common and consolidate AthenaService.splitCsv()
- Add compatibility tests: S3SelectTest (19 tests via S3AsyncClient)

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-05-14 20:32:27 -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
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
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
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
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
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
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
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 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
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
Hector Ventura c2cc053853 feat(backup): AWS Backup management-plane API (#734) 2026-05-07 00:56:34 -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
Kenshin Okinaka bd3a33326c feat(ses): add MAIL FROM domain and identity attribute operations (#716)
* feat(ses): add MAIL FROM domain and identity attribute operations

v1 (Query):
- SetIdentityMailFromDomain / GetIdentityMailFromDomainAttributes
- SetIdentityFeedbackForwardingEnabled
- SetIdentityHeadersInNotificationsEnabled
- GetIdentityNotificationAttributes now reflects the stored
  feedbackForwardingEnabled and per-NotificationType
  headersInNotificationsEnabled flags instead of hard-coded defaults

v2 (REST JSON):
- PUT /v2/email/identities/{id}/mail-from -> PutEmailIdentityMailFromAttributes
- GetEmailIdentity response surfaces real MailFromAttributes
  (MailFromDomain / MailFromDomainStatus / BehaviorOnMxFailure) instead
  of the previously hard-coded "" / NOT_STARTED / USE_DEFAULT_VALUE
- v1 PascalCase <-> v2 SCREAMING_SNAKE BehaviorOnMxFailure values are
  translated at the controller boundary, with both ends rejecting
  unknown enum values

Identity gains mailFromDomain, behaviorOnMxFailure (v1 form),
mailFromDomainStatus, and headersInNotificationsEnabled fields. The
service layer normalizes BehaviorOnMxFailure to the canonical SESv1
enum values (UseDefaultValue / RejectMessage), so storage is
consistent regardless of which protocol wrote it.

Validation (verified against live aws-cli output):
- ForwardingEnabled / Enabled / MailFromDomain are required on the
  matching v1 setters; missing values produce InvalidParameterValue
  rather than silently being treated as false / null
- An empty-string MailFromDomain remains the documented "clear" path,
  distinct from a missing parameter; whitespace-only values are
  rejected (only "" or null clear the setting)
- BehaviorOnMxFailure / NotificationType enum violations return the
  AWS-canonical "1 validation error detected: Value at '<param>' failed
  to satisfy constraint: Member must satisfy enum value set: [...]"
  message: ValidationError on v1, BadRequestException on v2
- Unknown identity on v1 setters returns InvalidParameterValue with
  the AWS-canonical "Identity <X> does not exist." form (HTTP 400)
- v2 PutEmailIdentityMailFromAttributes follows the same wire mapping:
  unknown identity surfaces as BadRequestException (HTTP 400) via
  remapV1Exception, with the same "Identity <X> does not exist."
  message text. Schema / enum validation runs before the service call
  so an unknown enum on a missing identity still surfaces as an enum
  error rather than as the identity error
- v2 controller validates that MailFromDomain and BehaviorOnMxFailure
  are JSON strings; non-textual values produce BadRequestException
- AwsQueryController.SES_ACTIONS picks up the new v1 actions for the
  auth-less fallback dispatch

Tests: 21 v1 integration cases, 9 v2 integration cases, 4 SDK compat
cases (AWS Java SDK 2.42.24).

* fix(ses): align identity-setter missing-identity errors with live AWS

Previously setFeedbackForwardingEnabled threw NotFoundException/404 and
setHeadersInNotificationsEnabled threw a Floci-specific
"Identity <X> does not exist." message. Real AWS verified via
aws-cli returns InvalidParameterValue (HTTP 400) for both, but with
*different* operation-specific message texts:

- SetIdentityFeedbackForwardingEnabled (also v2 PUT /feedback after
  remapV1Exception):
    Identity X is invalid. Must be a verified email address or domain.
- SetIdentityHeadersInNotificationsEnabled:
    Identity X is invalid. It must be a verified email address or domain.
- SetIdentityMailFromDomain (unchanged in this commit):
    Identity <X> does not exist.

Update the service-level throws so each setter emits its operation's
exact wire shape. setFeedbackForwardingEnabled now also benefits the
pre-existing v2 PUT /feedback endpoint, which previously surfaced
NotFoundException/404 instead of BadRequestException/400.

Tests:
- v1 unknown-identity coverage for SetIdentityFeedbackForwardingEnabled
  (new) and updated message-text assertion for HeadersInNotificationsEnabled
- v2 unknown-identity coverage for PUT /feedback
- SDK compat additions: getIdentityNotificationAttributes round-trip
  exercising forwarding/header flags, and v2
  PutEmailIdentityMailFromAttributes unknown-identity throwing
  BadRequestException

* test(ses): update putFeedbackAttributes_notFound to expect BadRequest

The previous commit changed setFeedbackForwardingEnabled to throw
InvalidParameterValue (HTTP 400) for missing identities to match real
AWS, which propagates through remapV1Exception as BadRequestException
on the v2 PUT /feedback path. The pre-existing
SesV2IntegrationTest.putFeedbackAttributes_notFound still asserted the
old 404 / NotFoundException behavior, so it began failing in CI.

Update the test to expect 400 / BadRequestException, matching the
verified live AWS response.
2026-05-05 22:41:17 -05:00
Kenshin Okinaka 7fa2a28c62 fix(appconfig): use capital "Tags" body key matching AWS SDK wire format (#704)
AppConfigTagHandler inherited the default tagsBodyKey() = "tags"
(lowercase), so SharedTagsController parsed and serialised the tag
payload with the lowercase key. The AWS spec for AppConfig
TagResource and ListTagsForResource is capital "Tags" with a map
body, which is what AWS SDK clients send and expect — so SDK calls
to appConfig.tagResource(...) silently dropped tags and listing
came back empty.

Override tagsBodyKey() on AppConfigTagHandler to return "Tags".
The other axes (POST method, map body, lowercase tagKeys query)
already match the defaults so no further override is needed.

AppConfigIntegrationTest is updated to send capital "Tags" bodies
and assert capital "Tags" response keys, matching the AWS SDK
wire format. AppConfigTest (SDK compatibility) now exercises a
tagResource → listTagsForResource → untagResource round-trip via
AppConfigClient to lock in the wire format end-to-end.
2026-05-04 20:18:53 -05:00
Hector Ventura 4fe93aa379 feat(eventbridge): add Archive and Replay support (#702)
Implement EventBridge Archive and Replay APIs:
- Archive, ArchivedEvent, Replay, ArchiveState, ReplayState models
- ReplayDispatcher: async Vertx-based replay execution with cancel support
- EventBridgeService: createArchive, describeArchive, updateArchive,
  deleteArchive, listArchives, startReplay, describeReplay, cancelReplay,
  listReplays; event capture on putEvents via captureToArchives
- EventBridgeHandler: 9 new action cases wired to service methods
- Storage: 3 new StorageBackend fields (archives, archivedEvents, replays)
  wired through StorageFactory
2026-05-04 17:30:27 -05:00
Kenshin Okinaka 8e30c09d0a feat(scheduler): support TagResource, UntagResource, ListTagsForResource (#700)
* feat(scheduler): support TagResource, UntagResource, ListTagsForResource

Implements the three remaining EventBridge Scheduler tag APIs by
extending the shared /tags/{arn} dispatcher. Tags apply to schedule
groups only, matching AWS behavior; ARNs pointing at individual
schedules return ValidationException.

A survey of all ~75 AWS services that share the /tags/{arn} path
shows three independent shape axes — body key (`tags` lower vs
`Tags` capital), body structure (map vs list of {Key, Value}), and
untag query parameter name (`tagKeys` vs `TagKeys`) — and most
"capital Tags" services still use lowercase tagKeys query, so these
axes vary independently. TagHandler exposes them as five orthogonal
default methods rather than a coarse-grained enum:

- tagsBodyKey()           defaults to "tags"
- tagsBodyIsList()        defaults to false (map)
- tagKeysQueryName()      defaults to "tagKeys"
- tagResourceUsesPut()    defaults to false (POST)
- strictTagValidation()   defaults to false (lenient parsing)

The defaults match the most common AWS shape (~73 services use
lowercase tags map + POST + lowercase tagKeys) so handlers like
EKS, Pipes, and AppConfig need no overrides. The dispatcher
returns 405 MethodNotAllowedException for the unused HTTP method
per handler. Strict input validation (missing Tags, wrong-shaped
Tags, missing TagKeys, entries missing Key or Value) is enforced
when strictTagValidation() is true, mirroring the AWS Scheduler
error shape; lenient handlers retain the looser parsing they had
before.

SchedulerTagHandler overrides tagsBodyKey, tagsBodyIsList,
tagKeysQueryName, and strictTagValidation. ApiGatewayTagHandler
overrides tagResourceUsesPut to true. AppConfigIntegrationTest
switches its tagApplication call from PUT to POST to match the
AWS spec for AppConfig (was relying on the dispatcher's prior
leniency on HTTP method).

* fix(tags): normalize empty body and reject non-object payloads

Address Copilot review on floci-io/floci#700.

- doTagResource normalizes null/blank request bodies to "{}" before
  passing to ObjectMapper.readTree, mirroring SchedulerController's
  parseTags. Previously an empty body raised a Jackson parse error
  that strict handlers surfaced as a ValidationException with a raw
  Java/Jackson message instead of the structured AWS error shape.
- parseTags adds a strict-only check that the JSON root is an
  object. A request body like a JSON array or string used to fall
  through to "Value null at 'Tags' ..." which misleads about the
  actual problem; it now reports that the payload itself must be a
  JSON object.

SchedulerIntegrationTest covers both paths with a 400 assertion.
2026-05-04 17:22:12 -05:00
Tristan BurchandHector Ventura b84d205b89 feat: Glue Schema Registry support (#621)
* feat(glue): add Glue Schema Registry support
* Move Glue SDK coverage to compatibility tests
* Align protobuf compatibility expectations
* Resolve services index merge conflict
* Remove unused Lombok compatibility dependency
* Serialize Glue schema registry timestamps as strings
* Tighten Glue schema registry name validation
* Avoid duplicate schema registry index rebuild
* Limit schema registry in-memory constructor visibility
* Clone Glue tables before resolving schema references
* Align Glue schema registry response shapes
* Extract Glue schema version resolver helper

Both validateSchemaReference and withResolvedSchemaReference duplicated
the latest-version computation and the four-argument getSchemaVersion
call. Pull that into a private resolveSchemaVersion(SchemaReference)
helper so the call sites read at one level of abstraction and a future
change to the resolution rule lands in one place.
* Fix Glue schema version list projection

---------

Signed-off-by: Tristan Burch <tburch@users.noreply.github.com>
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-05-03 22:41:19 -05:00
Kenshin Okinaka ac891db5a7 feat(ses): add TestRenderTemplate (v1) and TestRenderEmailTemplate (v2) (#692)
* feat(ses): add TestRenderTemplate (v1) and TestRenderEmailTemplate (v2)

Render a stored SES template against caller-supplied data and return the
resulting MIME message. v1 is dispatched via the Query protocol; v2 is
exposed at POST /v2/email/templates/{name}/render.

Template variable substitution is now strict: a missing attribute in the
rendering data raises MissingRenderingAttribute (mapped to BadRequestException
on v2), matching AWS / moto / LocalStack semantics. Invalid TemplateData
JSON raises InvalidRenderingParameter; non-object TemplateData is rejected
with operation-appropriate errors on the send paths (InvalidParameterValue
on v1, BadRequestException on v2).

The rendered output is a hand-rolled multipart/alternative MIME with a
Date header (UTC), Subject header, and text/plain + text/html parts.
Transfer encoding is auto-selected (7bit for ASCII bodies, 8bit for UTF-8)
matching moto's encode_7or8bit. Body line endings are normalized to CRLF.
Subject control characters and XML 1.0 invalid characters in the rendered
output are stripped to keep the response parseable by SDK clients.

Bulk per-entry rendering errors (MissingRenderingAttribute /
InvalidRenderingParameter raised at apply time) surface as INVALID_PARAMETER
in BulkEmailEntryResults rather than generic FAILED.

No new dependencies are introduced.

* test(ses): consolidate new SesServiceTemplateTest cases via @ParameterizedTest

Group 23 of the new unit tests added in this PR into 6
@ParameterizedTest methods driven by MethodSource data sets:

- pickTransferEncoding (ascii vs non-ascii) -> 1 test, 4 cases
- parseRenderingData invalid inputs -> 1 test, 5 cases
- normalizeToCrlf line-ending variants -> 1 test, 4 cases
- mapErrorCodeToBulkStatus -> 1 test, 4 cases
- sanitizeSubject control / DEL / Unicode preservation -> 1 test,
  6 cases (null-input case kept separate)
- stripXml10InvalidChars C0 / noncharacters / surrogates -> 1 test,
  11 cases

Coverage is preserved (every input that was exercised before is still
exercised; surfacing each case as an individual test makes the run
report show 58 cases instead of 49 for this file). The remaining
tests -- buildTestRenderMime structure assertions and the original
applyTemplateData edge cases -- stay as individual @Test methods
because they have distinct multi-step assertions.

* test(ses): address upstream Copilot style nits

- Remove unused containsString static import in
  SesTestRenderV2IntegrationTest after the parameterized refactor
- Replace assertEquals(true/false, ...) with assertTrue/assertFalse in
  SesServiceTemplateTest for clearer intent and better failure output
2026-05-03 09:18:10 -05:00
Dixit R Jain 8fe2bf4c97 feat(apigatewayv2): add WebSocket API support, Update ops, Route/Integration Responses, Models, and Tagging (#682)
Closes #526

Add 27 new API Gateway v2 operations (21 → 48 total):

- WebSocket protocol: CreateApi with WEBSOCKET, wss:// endpoints,
  routeSelectionExpression validation, routeResponseSelectionExpression
- Update operations: UpdateApi, UpdateRoute, UpdateIntegration,
  UpdateAuthorizer, UpdateStage, UpdateDeployment
- Route Responses: full CRUD (5 ops)
- Integration Responses: full CRUD (5 ops)
- Models: full CRUD (5 ops)
- Tagging: TagResource, UntagResource, GetTags
2026-05-02 07:53:13 -05:00
Hector Ventura 91ed829ea0 feat(elbv2) alb proxy codedeploy ecs (#677)
* feat(elbv2,codedeploy): real ALB Vert.x proxy and ECS blue/green deployment

ELB v2 Phase 2: replace the mock ALB with a real Vert.x HTTP reverse proxy.
ElbV2DataPlane compiles listener rules into an atomic rule chain and proxies
requests to target group members. ElbV2HealthChecker runs periodic health
checks against registered targets. shiftListenerForward atomically rewrites
the default forward rule (simple or weighted) for CodeDeploy traffic shifts.

CodeDeploy Phase 3: implement full ECS blue/green deployment. CreateDeployment
drives the complete lifecycle — green task set creation, BeforeInstall /
AfterInstall / BeforeAllowTraffic hooks, ALB listener traffic shift (AllAtOnce,
Canary, or Linear), AfterAllowTraffic hook, green task set promoted to PRIMARY,
blue task set deleted. Compute platform is resolved from the Application when
the deployment group doesn't carry it, matching real AWS SDK behavior.

* fix: refactor to use arnUtils
2026-05-01 02:05:00 -05:00
jsoizo 13203954b3 feat(cognito): implement AdminRespondToAuthChallenge operation (#666)
Adds the admin variant of RespondToAuthChallenge, enabling server-side
challenge response handling with explicit UserPoolId validation.
Extracts shared challenge logic into processChallenge to avoid duplication.
2026-04-30 20:29:36 -05:00
Hector Ventura 832cdf94db feat(ec2): real Docker container execution with SSH, UserData, and IMDS (#658)
* feat(ec2): real Docker container execution with SSH, UserData, and IMDS
* fix: test for ec2
2026-04-30 18:28:17 -05:00
Christine Nguyen aeace3a778 fix(test): handle SDK retry race in OpenSearch createDomain test (#668) 2026-04-30 18:16:26 -05:00
Yorí 3f4865b949 Fix/lambda incorrect size limit (#674)
* fix(http): remove 8 KB per-attribute limit on form-encoded request bodies

Vert.x 4.x defaults HttpServerOptions.maxFormAttributeSize to a small
value (effectively 8 KB via the Netty AbstractHttpData limit). This
causes any request with Content-Type: application/x-www-form-urlencoded
that carries a single attribute larger than the limit to be rejected with
"Size exceed allowed maximum capacity".

Two places fixed:

- HttpOptionsCustomizer (new CDI bean): sets maxFormAttributeSize=-1 on
  the main Quarkus HTTP server so large form-encoded AWS Query Protocol
  requests (CloudFormation templates, EC2 UserData in base64, large IAM
  policies, etc.) are accepted. The overall body size is still bounded
  by quarkus.http.limits.max-body-size (512 MB).

- RuntimeApiServer: passes HttpServerOptions with maxFormAttributeSize=-1
  when creating the per-container Vert.x HTTP server. This fixes the case
  where the Lambda runtime posts a large synchronous response body (e.g.
  a 5 MB base64 payload) back to the Runtime API endpoint and the body
  is incorrectly decoded through the form attribute path.

* fix(lambda): enforce AWS invoke payload size limits (sync 6 MB, async 1 MB)

Rejects oversized invocation requests with HTTP 413 RequestTooLargeException
before dispatching to the container, matching the AWS Lambda API contract.
Also enforces the 6 MB sync response limit after the function returns.

* test(lambda): add tests for invoke payload size limits

Unit/integration tests (LambdaIntegrationTest) cover sync >6 MB and async >1 MB
request rejections plus boundary-at-limit acceptance. Compat test
(LambdaPayloadSizeLimitTest) uses the Java SDK to verify RequestTooLargeException
is surfaced correctly, including a Docker-gated test for the 6 MB response limit.

* test(lambda): add regression test for 5 MB response via RuntimeApiServer

Verifies that a sync invocation returning a 5 MB body (within the 6 MB AWS
limit) succeeds end-to-end. Without the maxFormAttributeSize fix on the
RuntimeApiServer, the Lambda runtime's POST of the large response body was
rejected by Netty's 8 KB form-attribute cap, crashing the request with
"Size exceed allowed maximum capacity".
2026-04-30 18:08:36 -05:00
Yorí 8eeb2244a7 Feat/lambda image config working directory (#673)
* feat(lambda): support ImageConfig.WorkingDirectory override

Propagate WorkingDirectory from the Lambda ImageConfig through the full
stack so container images that rely on a specific WORKDIR can be invoked
correctly, matching real AWS behavior.

- LambdaFunction: add imageConfigWorkingDirectory field + getter/setter
- LambdaService: parse WorkingDirectory on CreateFunction and
  UpdateFunctionConfiguration
- ContainerSpec: add workingDir record component
- ContainerBuilder: add withWorkingDir() fluent method
- ContainerLifecycleManager: pass workingDir to Docker via withWorkingDir()
- ContainerLauncher: apply workingDir when building the container spec
- LambdaController: serialize WorkingDirectory in ImageConfigResponse

* test(lambda): add tests for ImageConfig.WorkingDirectory

Unit tests (LambdaImageConfigTest):
- CreateFunction stores WorkingDirectory alongside Command/EntryPoint
- createFunction with all three fields together
- updateFunctionConfiguration updates and clears WorkingDirectory
- ContainerLauncher passes workingDir to ContainerSpec

Compat tests across all SDKs:
- awscli (lambda.bats): create/get/update WorkingDirectory round-trip
- Java SDK (LambdaFunctionConfigTest): ImageConfig.WorkingDirectory round-trip
- Python (test_lambda_function_config.py): TestImageConfigWorkingDirectory class
- Node (lambda.test.ts): create/update WorkingDirectory assertions
- Go (lambda_test.go): TestLambdaImageConfigWorkingDirectory subtests
- Rust (lambda_test.rs): full create/get/update round-trip
2026-04-30 17:25:03 -05:00
Hector Ventura 37c7969cb4 feat(cloudformation): support AWS::Lambda::EventSourceMapping resource type (#654) 2026-04-30 00:26:43 -05:00
Hector Ventura c91b74ae4e feat(dynamodb): implement ExportTableToPointInTime, DescribeExport, and ListExports (#653) 2026-04-29 23:16:50 -05:00
Hector Ventura 2832bc7714 feat(codebuild,codedeploy): Implementing real build in docker phase2 (#649)
* feat(codebuild,codedeploy): real build execution and Lambda deployment engine

CodeBuild Phase 2: runs buildspec phases inside real Docker containers.
Source injected via docker cp (copyArchiveToContainerCmd); artifacts
extracted via docker cp (copyArchiveFromContainerCmd). No bind mounts —
works transparently in Docker-in-Docker. CloudWatch log streaming, S3
artifact upload, StopBuild, RetryBuild, ListBuilds, ListBuildsForProject.

CodeDeploy Phase 2: real Lambda deployments with traffic shifting via
alias RoutingConfig, lifecycle hook invocation against live Lambda
functions, PutLifecycleEventHookExecutionStatus callback, and
auto-rollback on hook failure. CreateDeployment, GetDeployment,
deployment state polling, ListDeployments, BatchGetDeployments,
ListDeploymentTargets, BatchGetDeploymentTargets.

* docs: updating docs with new services details
2026-04-29 22:11:55 -05:00
Kenshin Okinaka 44eb8d2379 feat(ses): add SendBulkEmail (v2) and SendBulkTemplatedEmail (v1) (#645)
* feat(ses): add SendBulkEmail (v2) and SendBulkTemplatedEmail (v1)

Adds bulk templated email support for both the SES v1 Query API
(SendBulkTemplatedEmail) and the SES v2 REST JSON API
(POST /v2/email/outbound-bulk-emails). The two endpoints share a
single SesService.sendBulkTemplatedEmail method that resolves the
template upfront, merges DefaultTemplateData with each entry's
ReplacementTemplateData at the JSON-key level (replacement wins),
renders subject/text/html via the existing applyTemplateData helper,
and reuses sendEmail per destination so each successful entry appears
in the existing /_aws/ses inspection mailbox with a unique MessageId.

Per-entry results are returned in the BulkEmailEntryResult shape with
status mapped to the AWS wire format expected by each protocol
(CamelCase for v1, SCREAMING_SNAKE for v2). Per-entry AwsException
codes are mapped to the closest BulkEmailEntryResult.Status (e.g.
InvalidParameterValue -> INVALID_PARAMETER, which renders as
"InvalidParameterValue" on v1), falling back to FAILED for unexpected
exceptions.

Template lookup failures and account-sending-paused conditions are
top-level errors on both protocols, with v1 raising
AccountSendingPausedException to match AWS semantics.

* fix(ses): enforce account sending check in v1 SendEmail/SendRawEmail/SendTemplatedEmail

v1 Query SES handlers previously sent mail even when account-level
sending was disabled, while v2 REST JSON handlers and the new
SendBulkTemplatedEmail correctly return AccountSendingPausedException.
Add the same guard at the top of handleSendEmail, handleSendRawEmail,
and handleSendTemplatedEmail to align v1 with v2 and AWS semantics.
2026-04-29 17:28:09 -05:00
Yorí 1cccf43f7b feat(cognito): include all standard attributes in DescribeUserPool Schema (#642)
* feat(cognito): include all standard attributes in DescribeUserPool SchemaAttributes

AWS Cognito always returns all 20 standard OIDC attributes (sub, name,
email, phone_number, etc.) in SchemaAttributes when describing a user
pool, even if none were explicitly configured. Floci was returning only
what was passed in Schema during creation.

Adds CognitoStandardAttributes with the full default set and a merge()
helper that overlays explicit schema overrides and appends custom:
attributes after the standard ones.

* test(cognito): add compat tests for standard SchemaAttributes across all SDKs

Adds DescribeUserPool SchemaAttributes coverage to all compatibility test
suites (AWS CLI/bats, Go, Java, Node, Python, Rust), verifying that all
20 standard OIDC attributes are returned and that sub is required and
immutable.
2026-04-29 00:01:48 -05:00
Hector Ventura 87eda4bcfc fix(cloudformation): wrap ZipFile inline source in zip archive before passing to Lambda (#639)
CloudFormation's ZipFile property contains raw source code (JS, Python, etc.),
but LambdaService expects Code.ZipFile to be a base64-encoded zip archive per
the Lambda REST API contract. Passing raw source directly caused every inline
Lambda to land in CREATE_FAILED with "Illegal base64 character".

Fix: added sourceToZipBase64() that wraps the raw source in a ZipEntry (filename
derived from the Handler property and runtime extension — .js for Node, .py for
Python) and base64-encodes the archive before forwarding to LambdaService.

Closes #607
2026-04-28 22:36:30 -05:00
Kenshin Okinaka cd42caa254 feat(ses): add ConfigurationSet CRUD on v1 Query and v2 REST JSON (#631)
* feat(ses): add ConfigurationSet CRUD on v1 Query and v2 REST JSON

Adds Configuration Set name management on both protocols:

- v1 Query: CreateConfigurationSet, DescribeConfigurationSet,
  ListConfigurationSets, DeleteConfigurationSet
- v2 REST JSON: POST/GET (single)/GET (list)/DELETE under
  /v2/email/configuration-sets[/{name}]

Storage is region-scoped and shared across both protocols, with name as
the primary key. Tags are persisted on v2 create and returned on v2 get;
v1 only round-trips the name (real SES v1 has no tags on configuration
sets). Errors map ConfigurationSetAlreadyExists / ConfigurationSetDoesNotExist
(v1) onto AlreadyExistsException 400 and NotFoundException 404 (v2)
via the existing SesController remap helper.

Field validation (per AWS limits): ConfigurationSetName must match
^[A-Za-z0-9_-]{1,64}$; each Tag Key is 1-128 chars and each Tag Value is
0-256 chars; non-array Tags are rejected with BadRequestException.

Out of scope (future PRs): SendingOptions / EventDestinations /
TrackingOptions / DeliveryOptions / ReputationOptions / SuppressionOptions /
VdmOptions, and ConfigurationSetName validation in the Send* APIs.

* fix(ses): allow Tag without Value on ConfigurationSet create

AWS SDKs commonly omit Tag.Value when only the key matters
(Tag.builder().key("env").build()), serialising the request without a
Value field. Floci was rejecting these calls with "Tag Value is
required", diverging from typical SDK and LocalStack behaviour. Drop
the required-value check; the 0-256 length constraint still applies
when a value is present.
2026-04-28 20:21:07 -05:00
Hector Ventura d28b175cb0 fix(ec2): persist VPC DNS attributes and support DescribeVpcEndpointServices (#624) 2026-04-28 00:39:32 -05:00