Commit Graph
1922 Commits
Author SHA1 Message Date
Hector Ventura 5621235ae0 fix(lambda): replace blocking /next handler with reactive pattern (#596)
GET /runtime/invocation/next returned 204 after a 30-second poll
  timeout, violating the AWS Lambda Runtime API spec. The spec defines
  only 200 as a valid success response for this endpoint. The .NET
  Lambda RIC reads Lambda-Runtime-Aws-Request-Id unconditionally after
  every /next call and crashes with KeyNotFoundException on 204.

  Replace blockingHandler + LinkedBlockingQueue.poll(30s) with a
  non-blocking handler that parks the RoutingContext in waitingContexts.
  enqueue() dispatches to a parked caller via vertx.runOnContext(),
  holding zero worker threads while idle. stop() drains waitingContexts
  with 204, which is valid only on shutdown when the container exits.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-04-25 19:37:25 -05:00
Ricardo Lima 1b119faf0d fix(lambda): parse empty payload in lambda (#600) 2026-04-25 11:44:18 -05:00
iam-ssrivastav 5f94b429c2 feat(cognito): add TagResource, UntagResource, ListTagsForResource for user pools (#579) (#591)
* feat(cognito): add TagResource, UntagResource, ListTagsForResource for user pools

Dispatch the three Cognito IDP tag operations through CognitoJsonHandler and
resolve user pools by parsing the resource ARN (O(1) pool-store lookup, not a
full scan). Malformed ARNs now surface as InvalidParameterException rather
than a swallowed ResourceNotFoundException.

Reject reserved floci:* keys on standalone TagResource via
ReservedTags.rejectReservedTagsOnUpdate, matching the existing strip-on-write
behavior on CreateUserPool / UpdateUserPool. Mutations are synchronized on
the pool instance to match the ensureJwtSigningKeys pattern.

Covered by new unit tests (CognitoServiceTest, CognitoJsonHandlerTest), AWS
CLI bats (cognito.bats), and Java SDK compat tests (CognitoFeaturesTest).

* chore: retrigger CI
2026-04-25 09:50:09 -05:00
Christine Nguyen 12c89ba751 fix(pipes): read EventBridgeEventBusParameters for Source and DetailType (#589) 2026-04-25 09:42:57 -05:00
Christine Nguyen e5b733a09d fix(pipes): return parameters and tags in mutation responses, warn on stream record loss (#588) 2026-04-25 09:36:11 -05:00
Hector Ventura e023936a81 feat(lambda): embedded DNS server for virtual-hosted S3 resolution (#585)
* feat(lambda): embedded DNS server for virtual-hosted S3 resolution

  Lambda containers cannot resolve virtual-hosted S3 URLs
  (my-bucket.floci:4566) because Docker DNS has no wildcard support —
  queries for *.floci fall through to public DNS and hit real AWS.

  Adds a Vert.x UDP/53 DNS server that binds automatically when Floci
  runs inside Docker. It resolves any *.{floci.hostname} query to
  Floci's container IP and forwards everything else upstream. Lambda
  containers receive Floci's IP as their DNS server via HostConfig.withDns().

  An optional floci.dns.extra-suffixes config allows LocalStack migrants
  to route *.localhost.localstack.cloud without changing Lambda code.

  Netty NioDatagramChannel was tried first but silently dropped IPv4
  UDP packets due to AF_INET6 socket defaults — Vert.x DatagramSocket
  with setIpV6(false) resolves this.

* fix: adding missing dns class
2026-04-25 09:33:00 -05:00
Hector Ventura 1ddbec0efb feat(athena): real SQL execution via floci-duck DuckDB sidecar (#584)
* feat(athena): real SQL execution via floci-duck DuckDB sidecar

  - Lazy-start floci/floci-duck:latest on first StartQueryExecution call;
    reuse the running container for all subsequent queries
  - Inject Glue tables as CREATE OR REPLACE VIEW statements via setup_sql
    before the user SQL so DDL runs outside the COPY(...) wrapper
  - SerDe-aware format inference: inferReadFunction now checks
    SerdeInfo.SerializationLibrary in addition to InputFormat, so standard
    AWS JSON tables (TextInputFormat + JsonSerDe) map to read_json_auto
  - ImageCacheService: skip Docker Hub pull when image is already present
    locally, preventing local builds from being overwritten
  - Add AthenaIntegrationTest (5 unit integration tests)
  - Add AthenaTest and DataLakeTest SDK compatibility tests
  - Update docs: athena.md (full rewrite), glue.md, README, CHANGELOG

* fix: docker image check fix
2026-04-25 08:28:20 -05:00
Raman Belakapytski 5ad4c06d74 feat(sqs): clear SNS FIFO dedup cache on PurgeQueue (#594)
Clear SNS FIFO topic deduplication for topics with SQS subscriptions targeting a purged queue when `clearFifoDeduplicationCacheOnPurge` is enabled.
2026-04-25 08:27:59 -05:00
Kenshin OkinakaandKenshin OKINAKA 763ea379d7 feat(ses): implement email template CRUD with stored, inline, and ARN variants (#573)
* feat(ses): implement email template CRUD with stored, inline, and ARN variants

Adds CreateTemplate / GetTemplate / UpdateTemplate /
DeleteTemplate / ListTemplates on both V2 REST JSON
(/v2/email/templates) and V1 Query.

SendEmail / SendTemplatedEmail resolve templates in three forms
with Mustache-style {{var}} substitution against TemplateData:
  - TemplateName references a stored template
  - TemplateArn extracts the name from the template/<name>
    segment of an SES template ARN (region and account segments
    are not validated, mirroring how KMS / Secrets Manager
    handle ARNs in Floci)
  - TemplateContent (V2 only) supplies inline subject / text /
    html without storing the template first

V2 Content.Template requires exactly one of TemplateName,
TemplateArn, or TemplateContent; violations return
BadRequestException (400). V1 SendTemplatedEmail accepts
TemplateArn either alone or alongside Template (name) — the
name is used for resolution when both are present, matching
AWS where boto3 and the Java SDK keep Template as a required
field and treat TemplateArn as supplementary for cross-account
addressing.

Templates persist region-scoped via StorageFactory in
ses-templates.json. Template names reject leading/trailing
whitespace (same rule as identities) and are validated through
a single validateTemplateName helper reachable from every
resolution path. listTemplates is sorted by CreatedTimestamp
with TemplateName as a tiebreaker for deterministic output.

Error codes: the service layer throws V1-style codes
(TemplateDoesNotExist / AlreadyExists / InvalidTemplate /
InvalidParameterValue); SesController remaps them to
NotFoundException (404) / AlreadyExistsException (400) /
BadRequestException (400) for V2 callers.

* test(ses): add Python and Java SDK compatibility tests for templates

Covers boto3 (ses / sesv2) and AWS Java SDK v2 (SesClient /
SesV2Client) against the SES email template CRUD, inline
TemplateContent, and TemplateArn paths. Happy path,
duplicate-create rejection, missing-template lookups,
Mustache-style variable substitution, and 3-way selector
conflicts on V2 Content.Template are exercised on both SDK
surfaces.

Adds:
- Python: ses_client / sesv2_client conftest fixtures and a
  tests/test_ses_templates.py suite covering V1 + V2
- Java: sesv2 Maven dependency, SesV2Client factory in
  TestFixtures, and a SesTemplateTest covering V1 + V2

* docs(ses): document email template CRUD and templated send

Adds the new V1 template actions (CreateTemplate / GetTemplate
/ UpdateTemplate / DeleteTemplate / ListTemplates /
SendTemplatedEmail) and the V2 /v2/email/templates endpoints
to the SES service reference, and extends the README service
matrix to mention template support on the SES / SES v2 rows.

* fix(ses): add template actions to SES_ACTIONS for unsigned request routing

Unsigned clients (curl, aws --no-sign-request) were falling through to
the SQS handler because the six template Query actions were not
registered in SES_ACTIONS.

* fix(ses): narrow exception catch to JsonProcessingException in template endpoints

Broad Exception catch was masking unexpected errors (e.g. NPE) as 400
responses. Narrowed to JsonProcessingException which is the only
checked exception from objectMapper.readTree().

* test(ses): add template variable substitution edge cases and cross-region isolation

Add SesServiceTemplateTest with 14 unit tests for applyTemplateData
covering undefined variables, spaced/hyphenated names, unclosed braces,
non-string JSON values, regex metacharacters, and case sensitivity.

Add cross-region isolation integration test verifying templates created
in one region are not visible in another.

* test(ses): add awscli compatibility tests for template CRUD and templated send

Cover create, get, update, list, delete template and send-templated-email
via the AWS CLI. Uses JSON parameter format to avoid awscli parser issues
with Mustache-style {{variable}} syntax.

---------

Co-authored-by: Kenshin OKINAKA <kenshin_okinaka@realcross.co.jp>
2026-04-24 20:59:49 -05:00
Stas Burnashev e0dc45e012 fix(dynamodb): serialise concurrent mutations and transactions (#572)
* test(dynamodb): failing concurrency tests reproducing #571

Exercises DynamoDbService directly with a starting-gate CountDownLatch and
@RepeatedTest(5) to catch read-check-mutate-put races that single-threaded
tests cannot see.

Scenarios cover: arithmetic if_not_exists counters, ADD updates, conditional
PutItem/DeleteItem with attribute_exists/attribute_not_exists, mixed put+update
on the same key, transactWriteItems (overlap and disjoint), batchWriteItem,
and stream event ordering. Each scenario has a baseline single-threaded sibling.

30 of 51 executions fail on main, matching the races described in the plan.

* fix(dynamodb): serialise single-item mutations with per-item locks

Adds a per-(storageKey, itemKey) ReentrantLock registry and wraps the full
read → check-condition → mutate → put → persist → stream-capture sequence
inside putItem, updateItem, and deleteItem. Locks are created lazily on first
access and never removed; ReentrantLock is used so the upcoming transaction
path can re-enter these methods after acquiring each participant's lock.

Unrelated items still run in parallel — only threads contending for the same
item serialise, matching real DynamoDB's per-item linearisability.

Fixes the updateItem, putItem, deleteItem, and stream-ordering scenarios in
DynamoDbConcurrencyIntegrationTest. The transactWriteItems scenario still
races and is addressed in the next commit.

Refs #571.

* fix(dynamodb): serialise transactWriteItems via total-ordered lock acquisition

Resolves every participant's (storageKey, itemKey) up front, acquires each
ReentrantLock in deterministic ascending order, then evaluates all conditions
against a snapshot nobody else can mutate. Writes apply under the same locks;
inner putItem/updateItem/deleteItem calls re-enter their lock for free.

Fixes the last remaining DynamoDbConcurrencyIntegrationTest scenarios — the
all-or-nothing transaction test now observes committed == versionA == versionB
across repeated runs, and the disjoint-commute scenario proves the sort order
prevents deadlock.

Closes #571.

* test(compat): end-to-end concurrency scenarios against running Floci

Adds the four mandatory compatibility tests that exercise the same locking
semantics through the AWS SDK over HTTP: concurrent UpdateItem arithmetic,
concurrent PutItem(attribute_not_exists), concurrent overlapping
TransactWriteItems, and mixed concurrent UpdateItem + PutItem.

N=20 per scenario to keep CI fast; each scenario uses a CountDownLatch starting
gate so client threads dispatch simultaneously and the server actually sees
overlapping work.

* docs(changelog): note the DynamoDB concurrency fix under [Unreleased]

Flags the behaviour change for callers whose previously-racing
UpdateItem/PutItem/TransactWriteItems calls will now see the
ConditionalCheckFailedException or TransactionCanceledException that real
DynamoDB would raise.

* fix(dynamodb): harden transaction ordering and drop dangling plan references

Addresses review feedback on #572:

* Replace the delimited-string ordering key for transactWriteItems with a
  Comparator over TransactParticipant tuples. User-supplied PK/SK bytes can
  contain any character, so "storageKey + \0 + itemKey" is not an injective
  ordering — tuple comparison avoids the collision risk entirely.
* Release a table's item locks alongside itemsByTable / itemStore in
  deleteTable so the registry tracks the table's lifetime instead of growing
  unboundedly across create/drop cycles.
* Remove Javadoc and inline comment references to PLAN-dynamodb-concurrency.md,
  which was a local working doc and was never committed. Issue #571 stays as
  the public reference.
2026-04-24 20:53:20 -05:00
Mateus Scheuer Macedo c687977585 fix(lambda): support nested python handler module paths (#570)
* fix(lambda): support nested python handler module paths

* fix(lambda): accept python package handlers in zip validation

- close Files.walk with try-with-resources during handler validation
- accept modulePath/__init__.py for python runtimes
- add regression coverage for nested python package handlers

Addresses Copilot feedback on PR #570
2026-04-24 20:42:13 -05:00
TiM 273434893f feat(cognito): add TagResource, UntagResource, ListTagsForResource for user pools (#579)
* feat(cognito): add TagResource, UntagResource, ListTagsForResource for user pools

Dispatch the three Cognito IDP tag operations through CognitoJsonHandler and
resolve user pools by parsing the resource ARN (O(1) pool-store lookup, not a
full scan). Malformed ARNs now surface as InvalidParameterException rather
than a swallowed ResourceNotFoundException.

Reject reserved floci:* keys on standalone TagResource via
ReservedTags.rejectReservedTagsOnUpdate, matching the existing strip-on-write
behavior on CreateUserPool / UpdateUserPool. Mutations are synchronized on
the pool instance to match the ensureJwtSigningKeys pattern.

Covered by new unit tests (CognitoServiceTest, CognitoJsonHandlerTest), AWS
CLI bats (cognito.bats), and Java SDK compat tests (CognitoFeaturesTest).

* chore: retrigger CI
2026-04-24 01:56:03 -05:00
Christine Nguyen 2d1fe19d88 fix(dynamodb): enforce DeletionProtectionEnabled on create, update, and delete (#583) 2026-04-24 01:22:26 -05:00
Christine Nguyen eed72e6222 feat(pipes): add filtering, input templates, batch sizes, and DLQ routing (#576) 2026-04-23 22:56:05 -05:00
TiM df58c71d8b fix(dynamodb): accept full ARN for TableName across operations (#575) (#580)
Real AWS DynamoDB accepts both short table names and full table ARNs for
TableName inputs. Floci only accepted short names, which broke OpenSearch
Data Prepper's dynamodb source plugin (requires table_arn) and any
Terraform flow that feeds aws_dynamodb_table.x.arn into the SDK.

- Add DynamoDbTableNames resolver: canonicalizes TableName input,
  rejects ARNs targeting index/stream resources, and rejects ARNs whose
  region does not match the request region (400 InvalidParameterValue,
  matching the #450 Lambda ARN precedent).
- Normalize at every DynamoDbService lookup boundary, including
  transaction condition paths and batch RequestItems map keys, so
  internal callers handling request-derived input cannot bypass the
  resolver.
- CreateTable explicitly rejects ARN-form TableName via requireShortName
  so ARN input cannot be persisted as the canonical table identity
  (which would produce nested ARN-on-ARN TableArn values).
- UpdateTable stream enable/disable now use the canonical
  table.getTableName() instead of the raw request TableName. Without
  this, calling UpdateTable via ARN keyed stream state under the ARN
  while reads canonicalize, stranding the stream.
- Covers DescribeTable, Scan, Query, GetItem, PutItem, UpdateItem,
  DeleteItem, BatchGetItem, BatchWriteItem, TransactGetItems,
  TransactWriteItems, UpdateTable, DeleteTable, DescribeTimeToLive,
  UpdateTimeToLive, DescribeContinuousBackups, UpdateContinuousBackups,
  Enable/DisableKinesisStreamingDestination.
- Tests: 32 resolver unit tests, 7 integration tests (item/batch/
  transact/TTL/backups/streaming/validation), 1 awscli bats case.
2026-04-23 22:32:40 -05:00
Christine Nguyen 51bf4f8480 feat(pipes): add source polling and target invocation for EventBridge Pipes (#555) 2026-04-22 23:36:48 -05:00
Rasheed 2fb5a1f8aa fix(s3): enforce conditional writes (#566) 2026-04-22 23:35:35 -05:00
Raman Belakapytski 102cb997f3 feat(sqs): add option to clear deduplication cache on PurgeQueue (#561) 2026-04-22 23:05:52 -05:00
TiM 2201c70ef1 feat(cognito,kms): allow caller-pinned resource IDs via reserved tag prefix (#568)
Allow KMS CreateKey and Cognito CreateUserPool to accept a reserved floci:override-id tag at creation time so tests can pin deterministic resource IDs without a lookup round trip.

Strip reserved floci:* tags from stored metadata and responses, reject reserved tags on KMS TagResource, wire KMS CloudFormation provisioning through tagged key creation, and add focused unit, handler, integration, and AWS CLI bats coverage for the new behavior.
2026-04-22 22:52:42 -05:00
Hector Ventura 86906ebd90 fix(native,acm): fix native image reflection for acm (#559) 2026-04-21 23:03:24 -05:00
Mateus Scheuer MacedoandMestreY0d4-Uninter bdc13f894e fix(s3): wrap S3 Control XML errors in ErrorResponse wrapper (#560)
* fix(s3): wrap S3 Control XML errors in ErrorResponse wrapper (#557)

* fix(s3): align S3 Control error request ids

- reuse the XML body request id in S3 Control error response headers
- strengthen regression tests to assert the top-level RequestId and header/body alignment

Addresses Copilot review feedback on PR #560.

---------

Co-authored-by: MestreY0d4-Uninter <241404605+MestreY0d4-Uninter@users.noreply.github.com>
2026-04-21 23:03:06 -05:00
Hector Ventura ce60457392 fix(lambda): add missing FunctionConfiguration fields and fix response shape (#546) 2026-04-21 19:44:34 -05:00
Daniel Abeledo 999ac85ffa feature(secretsmanager): add handling for UpdateSecretVersionStage (#545)
* feature(secretsmanager): add handling for UpdateSecretVersionStage
* feat: add comp-tests for awscli secretsmanager update-secret-version-stage
2026-04-21 19:43:48 -05:00
Victor Sanchez Velasco b9957dfdbe feat(scheduler): invoke targets when schedules fire (#551)
Adds a background dispatcher that reads persisted schedules and invokes their
targets on time, closing the CRUD-only gap called out in PR #260 and
documented under "Not Yet Supported".

- SchedulerExpressionParser parses at(), rate(), and 6-field cron() with
  optional ScheduleExpressionTimezone (default UTC).
- ScheduleInvoker delivers to SQS, Lambda, SNS, and EventBridge PutEvents,
  mirroring the EventBridgeInvoker pattern but adapted to Scheduler's Target
  model (raw Input string, no JSONPath/template).
- ScheduleDispatcher is a single-threaded ticker that scans every schedule,
  gates on State/StartDate/EndDate, fires due schedules, and honours
  ActionAfterCompletion=DELETE for one-time at() schedules.
- FlexibleTimeWindow, RetryPolicy and DeadLetterConfig are stored but not
  yet honoured; those can be layered on incrementally.

Config (floci.services.scheduler):
  - invocation-enabled (default true)
  - tick-interval-seconds (default 10)

Unit tests cover the parser (at/rate/cron, timezone, validation) and the
dispatcher (firing, once-semantics, delete-after-completion, state gating,
start/end windows, unsupported expression handling).

Closes #550
2026-04-21 19:42:01 -05:00
TiM 9ea28ee629 fix(kms): support HMAC_* key specs in CreateKey (#544)
CreateKey with `--key-spec HMAC_{224,256,384,512} --key-usage
GENERATE_VERIFY_MAC` now succeeds instead of throwing
InvalidCustomerMasterKeySpecException. DescribeKey returns the matching
MacAlgorithms array (HMAC_SHA_*), and GetPublicKey correctly rejects
HMAC keys with UnsupportedOperationException.

Validation also rejects the two incompatible pairings:
- HMAC_* without GENERATE_VERIFY_MAC usage
- GENERATE_VERIFY_MAC usage with any non-HMAC spec

HMAC material is generated with SecureRandom and base64-stored on the
existing privateKeyEncoded field (same pattern as RSA/ECC private key
bytes). Generation sits outside the try block that wraps asymmetric
keypair creation, so ValidationExceptions aren't rewrapped as 500s.

Closes #497.

Out of scope (follow-up PRs):
- GenerateMac / VerifyMac operations
- HMAC key rotation support
- Catch-rewrap bug in generateKeyMaterial for asymmetric keys
2026-04-21 19:38:54 -05:00
Daniel Abeledo d27fcd9410 bug(secretsmanager): incorrect update of AWSPENDING on secret value update (#542) 2026-04-21 19:31:18 -05:00
Hector Ventura 4f0150870a feat(docker): centralize Docker config and add private registry authentication (#549) 2026-04-21 08:45:37 -05:00
Hector Ventura c8057785eb fix(lambda): initialize ESM pollers at startup and fix worker-pool exhaustion in RuntimeApiServer (#543) 2026-04-21 07:24:27 -05:00
Christine Nguyen 9f231afc3b feat(pipes): add EventBridge Pipes service skeleton with CRUD API (#539) 2026-04-21 07:23:49 -05:00
Stas Burnashev 59c1d727fc fix(dynamodb): return attributes for UPDATED_NEW/UPDATED_OLD on new items (#538)
* fix(dynamodb): return attributes for UPDATED_NEW/UPDATED_OLD on new items

When UpdateItem creates a new item, oldItem is null. The UPDATED_NEW
branch required oldItem != null, so no attributes were returned.

Handle null oldItem by returning all newItem attributes (everything
is new). Same fix for UPDATED_OLD with null newItem.

Closes #537

* fix: exclude key attributes from UPDATED_NEW, remove dead UPDATED_OLD branch

- Diff newItem against the request key when oldItem is null, so key
  attributes are excluded from UPDATED_NEW (matches AWS behavior)
- Remove unreachable UPDATED_OLD else branch (newItem is never null)
- Assert key attributes are absent in the new-item test
2026-04-21 07:20:57 -05:00
iam-ssrivastav 4605d7d38f feat(firehose): implement DeleteDeliveryStream API and add integratio… (#535)
* feat(firehose): implement DeleteDeliveryStream API and add integration tests

* fix(firehose): use delete() instead of remove() on StorageBackend
2026-04-21 07:18:44 -05:00
edwintian 7d79bedbd9 feat(appconfig): implement resource tagging and predefined deployment strategies (#533)
* feat(appconfig): implement resource tagging and predefined deployment strategies

Add AppConfigTagHandler to handle ListTagsForResource/TagResource/UntagResource
for AppConfig ARNs, and seed built-in strategies (AppConfig.AllAtOnce etc) so
Terraform's aws_appconfig_* resources provision without errors.

* feat(appconfig): match AWS AppConfig built-in strategy values:
Set correct FinalBakeTimeInMinutes (AllAtOnce: 10, Linear50: 1) and
descriptions for predefined deployment strategies. Fix test @Order gap.
2026-04-21 07:16:26 -05:00
Kenshin Okinaka c69580764e feat(ses): SMTP relay for SendEmail and SendRawEmail (#534)
* feat(ses): add SMTP relay configuration to EmulatorConfig

Add smtp-host, smtp-port, smtp-user, smtp-pass, and smtp-starttls
settings to SesServiceConfig. smtp-host is Optional — when absent or
empty, relay is disabled and emails are stored only (existing behavior).

* feat(ses): implement SMTP relay with Vert.x MailClient and Mime4j

Add SmtpRelay that forwards SES emails to a configured SMTP server
using a dedicated Vert.x MailClient built from EmulatorConfig settings.

Simple emails are sent as MailMessage with From/To/Cc/Bcc/ReplyTo/
Subject/Text/Html. Raw MIME emails are parsed with Apache Mime4j to
extract headers and body, then sent via the same MailClient. When SES
Destinations is provided, it is used as the authoritative envelope
recipient list (MIME Cc headers do not add extra SMTP recipients).

Relay is dispatched asynchronously on a dedicated daemon thread with
a 30-second send timeout. Failures are logged with stack traces but
never affect the API response. The executor and MailClient are only
created when smtp-host is configured and ses.enabled is true, and
shut down in @PreDestroy.

SesService calls SmtpRelay.relay/relayRaw after storing emails so
the inspection endpoint always has the data regardless of relay.

Tests: SmtpRelayTest (12 cases) covers simple/raw relay, disabled
path, error swallowing, base64 decoding, HTML content type, envelope
fallback. SesServiceSmtpTest (5 cases) verifies relay integration
and store persistence.

* docs(ses): document SMTP relay configuration

Add SMTP Relay section to docs/services/ses.md with configuration
example, docker-compose snippet with Mailpit, and behavioral notes.
Add SMTP settings to the YAML sample and environment variable table
in docs/configuration/application-yml.md.

* fix(ses): preserve body against attachment overwrite and extract Bcc from raw MIME

- extractBodyFromEntity now only sets text/html when not already set, so a
  text-typed attachment in multipart/mixed cannot clobber the body picked up
  from multipart/alternative.
- doRelayRaw now reads Bcc from MIME headers alongside To/Cc when the caller
  did not supply Destinations.

* fix(ses): initialize Vert.x NTLMEngineImpl at run time for native image

The vertx-mail-client dependency brings in io.vertx.ext.mail.impl.sasl.NTLMEngineImpl,
whose static state embeds a SecureRandom instance. GraalVM native-image rejects
build-time Random/SecureRandom objects because the cached seed makes runtime
behavior unpredictable. Mark the class for run-time initialization, matching the
existing entry for the Apache HttpClient NTLM engine.
2026-04-20 22:47:06 -05:00
Hector Ventura b7774d17b2 fix: release 1.5.5 2026-04-19 23:45:27 -05:00
TiM 79a7a04287 fix(lambda): wake blocked /next poller and drain queue on RuntimeApiServer.stop() (#531)
* fix(lambda): wake blocked /next poller and drain queue on RuntimeApiServer.stop()

RuntimeApiServer.stop() had two independent shutdown bugs:

1. Blocked /next handler not woken. The long-poll loop
   `while (invocation == null && !stopped)` only checks `stopped` after
   `pendingQueue.poll(30s)` returns. stop() sets stopped=true but never
   nudges the queue, so a blocked worker holds a Vert.x thread for up
   to 30s per container tear-down.

2. Queued invocations dropped without completing futures. stop() ended
   with `pendingQueue.clear()`, silently discarding any invocation that
   was enqueued but not yet consumed by /next. LambdaExecutorService
   was already awaiting that resultFuture; the caller hung until its
   own timeout fired.

Fix:
- Add SHUTDOWN_SENTINEL, offered AFTER the drain so it cannot be
  discarded by clear(). /next recognises it by identity, exits the
  loop, returns 204.
- Replace `pendingQueue.clear()` with a drain loop that completes each
  queued invocation's future with ContainerStopped.
- Harden enqueue() to short-circuit when stopped, with a post-offer
  recheck closing the check-then-offer race.
- Add a post-loop `stopped` check in the /next handler so an invocation
  polled just before stop() gets completed locally rather than parked
  in inFlight after cleanup.

Keeps `poll(30s)` rather than `take()` as a belt-and-braces timeout if
the sentinel is ever missed.

Tests: three new RuntimeApiServerTest cases cover sentinel wake,
queue-drain completion, and enqueue-after-stop short-circuit.

Related: #485 (worker-pool RCA), #504 (original, closed), #529 (rebase),
#530 (interrupt follow-up).

* ci: retrigger (SecretsManagerServiceTest flake on main, not related to this PR)
2026-04-19 23:44:24 -05:00
sf-jin-ku 2efb483390 feat(s3): preserve explicit object SSE headers (#515)
* feat(s3): preserve explicit object SSE headers
* refactor(s3): validate and encapsulate SSE write options
* fix(s3): make notification filter parsing deterministic
* fix(ses): harden identity deletion lookups
* fix(ses): reject padded identities literally
* fix(secretsmanager): keep a single previous stage
2026-04-19 23:36:36 -05:00
TiM 1b53e53dba fix(lambda): destroy container handle on interrupt and generic exception (#530)
Closes #525.

Extends #529's timeout-path fix to the two remaining paths in
LambdaExecutorService.executeSync that were still returning a
potentially-dirty container to the warm pool.

- InterruptedException: the container may still be processing the
  previous request, so the response from the old invocation could be
  returned to a new one. Destroy the handle instead of releasing it.
- Exception (e.g. runtime API communication failure): container state
  is unknown. Destroy rather than trust it for reuse.

Matches AWS Lambda behavior where a container is discarded after any
internal error, not reused.

Tests mirror the existing timeoutInvocation_destroysHandle_doesNotRelease
pattern, one for each path.
2026-04-19 19:33:09 -05:00
Daniel Abeledo 571d6d7a0d feat: add version stages handling in ASM put-secret-value (#527) 2026-04-19 19:23:05 -05:00
Hector Ventura ee08d3ad44 feat(opensearch): add real os with docker image (#528)
* feat(opensearch): add real os with docker image
* fix: fix opensearch network issue
2026-04-19 19:04:31 -05:00
TiMandRicardo Lima f837be0051 fix(lambda): fix container lifecycle on timeout (rebase of #504) (#529)
* fix(lambda): release container handle on timeout instead of draining warm pool

* fix: fix container lifecycle on timeout

* fix(lambda): correct /next poll loop condition and restore response handling

Flip while loop to `invocation == null && !stopped` so the poll actually
runs (previous condition was unreachable because invocation starts null).
Restore the 204 response on null return and the 500 response on
InterruptedException so the handler never leaves the response open.

Without this fix, every RIC call to /next hangs, which also broke the
existing LambdaReactiveSyncIntegrationTest with SocketTimeout.

---------

Co-authored-by: Ricardo Lima <ricardo.hrlima@gmail.com>
2026-04-19 18:34:48 -05:00
iam-ssrivastav 4955537de2 feat(cognito): implement AdminResetUserPassword action (#516)
- Add adminResetUserPassword method to CognitoService
- Add handler routing in CognitoJsonHandler
- Set user status to RESET_REQUIRED and clear credentials on reset
- Enforce PasswordResetRequiredException across all auth flows
- Add integration tests for reset password lifecycle
2026-04-19 17:40:19 -05:00
TiM 0642a28e78 feat(kinesis): support AT_TIMESTAMP shard iterator type (#520)
Implement ShardIteratorType=AT_TIMESTAMP so consumers can resume a shard
from a specific arrival time. Previously AT_TIMESTAMP fell through the
type switch and silently behaved like TRIM_HORIZON.

- Bump iterator encoding to 6 parts (adds timestampMillis slot).
  5-part legacy iterators still decode via split(-1) compat.
- handleGetShardIterator parses and validates Timestamp (numeric,
  epoch seconds with fractional ms, converted via Math.round to long
  millis to avoid 1ms drift).
- AT_TIMESTAMP scan in getRecords uses inclusive >= match against each
  record's ApproximateArrivalTimestamp.
- Continuation iterator remains type=TRIM_HORIZON + resume-at-nextIndex
  to preserve the existing "resume by index" convention; inline comment
  documents the apparent contradiction.
- Reject AT_TIMESTAMP without Timestamp (or with non-numeric Timestamp)
  as InvalidArgumentException at the handler boundary.
2026-04-19 17:31:04 -05:00
Kenshin Okinaka bc951bf4bf fix(lambda): restore create-copy-start ordering for provided runtimes (#524)
* fix(lambda): restore create-copy-start ordering for provided runtimes

The refactor in #466 changed ContainerLauncher from create → copy →
start to createAndStart → copy, breaking provided.* runtimes whose
entrypoint execs /var/runtime/bootstrap immediately on start — before
the file has been copied in.

Split ContainerLifecycleManager into create(spec) and
startCreated(containerId, spec) so ContainerLauncher can copy code and
the bootstrap file into the container filesystem before starting it.
Other services (ECS, ECR, EKS, MSK, ElastiCache, RDS) continue using
createAndStart since they have no pre-start file copy requirement.

Fixes #494

* test(lambda): verify create-copy-start ordering for provided runtimes

Update ContainerLauncherTest to use the new create/startCreated API
and add two ordering tests:

- launchFunction_createsBeforeCopyAndStartsAfter: verifies the
  create → copy → startCreated sequence for any runtime using
  Mockito InOrder.
- launchProvidedRuntime_copiesBootstrapBeforeStart: verifies the same
  ordering specifically for provided.al2023 with a bootstrap file,
  and asserts createAndStart is never called. This is the exact
  regression from #466 that caused exit 127.

* refactor: delegate createAndStart to create + startCreated

Eliminate duplicated container-creation logic by making createAndStart
a thin delegate to create(spec) + startCreated(containerId, spec).
Future fixes to either step now apply to both call paths automatically.

* test(lambda): add SDK compatibility test for provided runtime invoke

Create and invoke a provided.al2023 function using the shell-based
bootstrap from LambdaUtils.providedRuntimeZip(). Asserts the response
contains the expected payload without timeout or FunctionError.

This test fails on 1.5.4 (Read timed out after 120s due to the
create-start ordering regression in #466) and passes on the fix.

* docs: add @param to create() and rename misleading test

- Add missing @param spec tag to ContainerLifecycleManager.create()
  for consistency with surrounding methods.
- Rename launchFunctionCopiesCode to launchFunction_createsWithoutBindMounts
  to reflect what the test actually asserts. Remove the getDockerClient
  verify that didn't prove code copying.

* test(lambda): stub Docker copy chain and add cleanup for provided runtime test

- Stub dockerClient.copyArchiveToContainerCmd → withRemotePath →
  withTarInputStream so copy operations execute against the mock
  instead of throwing silently. Ordering tests now verify actual
  Docker copy invocations between create and startCreated.
- Provided runtime test asserts both /var/task and /var/runtime
  remote paths were targeted.
- Add sdk-test-provided-fn to @AfterAll cleanup in LambdaTest so
  assertion failures don't leak the function across test runs.

* test(lambda): drain tar InputStream in copy mock to prevent thread leaks

Each copy mock now returns a fresh CopyArchiveToContainerCmd that
drains the PipedInputStream on exec(), so the background tar writer
thread can complete instead of blocking when the pipe buffer fills.
Remote paths are captured via the mock's withRemotePath answer and
asserted from the shared list.

Also adds sdk-test-provided-fn to @AfterAll cleanup in the compat
test to prevent function leaks on assertion failure.

* refactor(lambda): drop unused ContainerInfo variable from launch

The return value of startCreated() was assigned but never read.
Remove the variable and its now-unused import.

* test(lambda): include getDockerClient in InOrder verification

Add the getDockerClient() call between create() and
copyArchiveToContainerCmd() in both ordering tests so the verified
sequence matches the actual call flow in ContainerLauncher.launch().

* style: remove redundant doAnswer import

The wildcard import already covers it.
2026-04-19 09:33:54 -05:00
TiM b37f4c71e0 fix(kinesis): return real ShardId in PutRecord and PutRecords responses (#518)
PutRecord and PutRecords were hardcoding "shardId-000000000000" in responses
regardless of which shard the record was routed to. Storage-side routing
(selectShard) was already picking the correct shard; only the handler response
was wrong.

Add PutRecordResult record and putRecordWithShardId method that exposes the
resolved shard to handlers. Keep the existing putRecord(...) String overload
for internal callers (KinesisStreamingForwarder, tests) to avoid churn.

Fixes cross-shard distribution assertions in downstream SDK tests.
2026-04-19 08:07:54 -05:00
iam-ssrivastav 6e8127c0e8 feat(cognito): implement AdminEnableUser and AdminDisableUser (#514)
- Add adminEnableUser/adminDisableUser methods to CognitoService
- Add handler routing in CognitoJsonHandler
- Enforce isEnabled check across all auth flows (Password, SRP, Refresh)
- Add comprehensive unit tests for enable/disable lifecycle
2026-04-19 08:01:48 -05:00
TiM 6f12f78201 fix(lifecycle): run shutdown hooks before HTTP server stops (#431) (#519)
Shutdown hooks could not reach Floci's HTTP endpoint (e.g.
`aws --endpoint-url http://localhost:4566 ...`) because they ran in
the ShutdownEvent observer, which Quarkus fires only AFTER the HTTP
server has already stopped.

Split the lifecycle:
- onPreShutdown(@Observes ShutdownDelayInitiatedEvent) runs stop hooks
  while the HTTP server is still accepting connections.
- onStop(@Observes ShutdownEvent) handles resource cleanup only.

Enable the pre-shutdown phase via `quarkus.shutdown.delay-enabled:
true`. No `delay` value is set, so observers run synchronously with
no artificial sleep introduced.

Swallow all hook failures (including InterruptedException) without
restoring the interrupt flag, so the subsequent ShutdownEvent cleanup
phase always runs with a clean thread state and resource shutdown is
guaranteed even when hooks fail.

Fixes floci-io/floci#431
2026-04-19 07:49:00 -05:00
Kenshin Okinaka 4719269df4 fix(ses): align /_aws/ses inspection endpoint with LocalStack behavior (#512)
* fix(ses): store text and html body separately and return raw as RawData

The inspection endpoint (/_aws/ses) previously collapsed bodyHtml and
bodyText into a single field, making both text_part and html_part
identical. Split SentEmail.body into bodyText and bodyHtml so the
inspection response correctly distinguishes the two, with null for the
absent part — matching LocalStack 4.14.0 behavior.

Raw emails now use a dedicated rawData field and constructor. The
inspection endpoint returns RawData (the full MIME message) without
Destination, Subject, or Body fields, matching LocalStack's shape.

Tests: 4 new integration tests covering text+html separation, text-only
(html_part=null), html-only (text_part=null), and raw email (RawData
without Body/Subject/Destination).

* fix(ses): parse and store ReplyToAddresses

ReplyToAddresses was silently dropped on both SES v1 (Query) and v2
(REST JSON) send paths. Parse it from the request, store it on
SentEmail, and return it in the inspection endpoint (/_aws/ses) for
non-raw emails. The field is omitted when empty, matching LocalStack
behavior.

* fix(ses): return all regions in inspection endpoint

LocalStack's /_aws/ses returns emails from all regions regardless of
request headers, with each message carrying its own Region field.
Floci previously filtered by the default region, hiding emails sent
to other regions.

- Add region field to SentEmail, set on send.
- SesInspectionController GET now calls getAllEmails() (no region
  filter) and reads region from each email.
- DELETE clears all regions.

* refactor(ses): remove unused RegionResolver and use putNull for region

SesInspectionController no longer filters by region, so the injected
RegionResolver is dead code. Remove it and align the null-region
handling with other optional fields (putNull instead of empty string).

* fix(ses): use bulk clear and add v1 ReplyToAddresses test

- clearAllEmails() now calls emailStore.clear() instead of deleting
  entries one-by-one, avoiding N disk writes on persistent backends.
- New SesIntegrationTest covering the SES v1 Query path for
  ReplyToAddresses: sends via SendEmail with ReplyToAddresses.member.1
  and verifies round-trip through the /_aws/ses inspection endpoint.

* refactor(ses): simplify getEmails/clearEmails to region-agnostic

The inspection endpoint now returns all regions unconditionally, so
the region-scoped getEmails(region) and clearEmails(region) are dead
code. Replace them with parameter-less getEmails() and clearEmails(),
and drop the intermediate getAllEmails/clearAllEmails aliases.

* fix(ses): add backward-compat alias for legacy Body field and multi-region test

- @JsonAlias("Body") on bodyText so persisted SentEmail objects from
  before the text/html split still deserialize their body into bodyText
  rather than silently losing it.
- New test: send emails in two different regions (us-east-1 and
  ap-northeast-1) and verify /_aws/ses returns both with correct
  per-message Region values.

* refactor(ses): move region and replyToAddresses into SentEmail constructors

Both fields were set via setters immediately after construction, which
is inconsistent with the other fields that are constructor arguments.
Add them to the Simple and Raw constructors so all required state is
established at creation time.

* refactor(ses): align sendEmail parameter order with SentEmail constructor

Move region to the first parameter position so the argument order
matches the SentEmail constructor (messageId, region, source, to, cc,
bcc, replyTo, subject, bodyText, bodyHtml). No functional change.

* refactor(ses): remove unused RegionResolver and validate rawMessage

- SesService no longer uses RegionResolver (region is always passed as
  a parameter from controllers). Remove the field, constructor parameter,
  and import.
- sendRawEmail now rejects null/blank rawMessage with
  InvalidParameterValue, preventing a stored email that would appear
  as non-raw in the inspection endpoint.

* fix(ses): validate source in sendRawEmail

sendRawEmail lacked the null/blank check on source that sendEmail
already had, allowing stored messages with Source=null and a 200
response. Add the same guard for consistency.

* refactor(ses): remove unused EmulatorConfig from SesService constructor

The config parameter was injected but never referenced.

* revert: restore EmulatorConfig in SesService constructor

Removing the unused EmulatorConfig parameter caused an awscli compat
test failure (SES: verify identities deleted). The parameter likely
influences Quarkus CDI initialization ordering — StorageFactory may
depend on EmulatorConfig being resolved first. Restore with
@SuppressWarnings("unused") to document intent.

* fix(ses): omit empty CcAddresses and BccAddresses from inspection response

LocalStack omits these keys when the list is empty rather than returning
an empty array. Apply the same !isEmpty() guard already used for
ReplyToAddresses.

* fix(ses): omit empty ToAddresses and restore region parameter order

- Apply the same !isEmpty() guard to ToAddresses so it is omitted from
  the inspection response when empty, consistent with CcAddresses,
  BccAddresses, and ReplyToAddresses.
- Revert sendEmail parameter order: move region back to the last
  position to match the convention used by all other SesService methods
  (verifyEmailIdentity, deleteIdentity, listIdentities, etc.).

* refactor(ses): remove unused EmulatorConfig from SesService constructor

The config parameter was injected but never referenced. A previous
attempt to remove it (76d6c22) was reverted due to a CI failure, but
that failure may have been flaky (S3 Notifications queue filter
round-trip, a known pre-existing issue). Retrying after rebase onto
latest main.
2026-04-19 01:05:08 -05:00
TiM 677bad0e16 fix(storage): make scan() return mutable list for non-InMemory backends (#517)
PersistentStorage, HybridStorage, and WalStorage used Stream.toList(),
which returns an unmodifiable list in Java 16+. InMemoryStorage built an
ArrayList, so callers that mutate the scan result work in unit tests
(all using in-memory backend) but fail at runtime on persistent backends.

This was the root cause of #482: CloudWatchLogsService.describeLogGroups
calls result.sort(...) on the scan result, which throws
UnsupportedOperationException when running against any non-memory store.
Same latent bug at CloudWatchLogsService.getLogEvents and
CognitoService.listGroups (callers copy into ArrayList first, so they
happen to work).

Rather than patch the two call sites, align all StorageBackend
implementations on a documented "returns a new mutable list" contract.
Tests added to each backend to lock in the behavior.
2026-04-18 18:36:20 -05:00
iam-ssrivastav 65063144c9 security(s3): harden path traversal defenses in S3Service and S3Controller (#508)
- Add normalize() + startsWith(bucketDir) guards to resolveObjectPath
  and resolveVersionedPath in S3Service (primary defense)
- Add controller-level validateKeyNoTraversal mirroring the service
  pattern with try/catch for InvalidPathException (null bytes → 400)
- Add validateRawUri to catch percent-encoded traversal (%2e%2e)
  before Vert.x normalization strips it
- Strip leading slashes from keys before filesystem resolution to
  allow legitimate S3 keys like /file.txt without escaping the bucket
- Add integration tests for %2e%2e, %00, and %2E%2E vectors
  asserting 400 InvalidKey
- Add unit tests for service-layer traversal rejection
2026-04-18 11:24:35 -05:00
Christine Nguyen 247c62cd19 fix(dynamodb): validate sort key in buildItemKey to prevent item collisions (#506) 2026-04-18 11:14:10 -05:00