Commit Graph
3835 Commits
Author SHA1 Message Date
Aniket Shukla 894f20bb81 fix(lambda): reject invalid configuration numbers before mutation (#4726)
* fix(lambda): reject invalid configuration numbers before mutation

* fix(lambda): validate configuration ARN types and memory limit
2026-09-30 13:31:55 -04:00
Aniket Shukla 45b00779b7 fix(cognito): fail authentication when token triggers fail (#4727)
* fix(cognito): fail authentication when token triggers fail

* fix(cognito): reject empty Lambda trigger responses
2026-09-30 13:29:20 -04:00
Allen Sanborn c6b8a70ea8 fix(ecs): a service reaches steady state, and a finished deployment stays finished (#4694)
* fix(ecs): name a service revision by the deployment's task set id

A service created against Floci never reached STABLE for a client that asked
to wait for it. `aws_ecs_service` with `wait_for_steady_state` sat on tfPENDING
for its whole 20-minute timeout while the emulator reported the service ACTIVE,
at its desired count, with one PRIMARY deployment whose rolloutState was
COMPLETED and one RUNNING task. Six of the first sixteen terraform-aws-ecs
Terratest suites failed that way, three burning the full waiter.

Nothing in DescribeServices was stuck; every field that waiter used to read
settles in about ten seconds. Since provider 6.x a service under the ECS
deployment controller whose PRIMARY deployment started after the operation is
not judged from DescribeServices at all. The provider reads deployments[0].id,
which is "ecs-svc/<taskSetId>", then takes the ListServiceDeployments brief
whose targetServiceRevisionArn *contains that id*, and polls
DescribeServiceDeployments on it:

    if strings.Contains(aws.ToString(deployment.TargetServiceRevisionArn), taskSetID)

AWS makes that join work by naming the service revision with the very id the
deployment reports -- its own docs pair "ecs-svc/1485800978477494678" with
".../service-revision/<cluster>/<service>/1485800978477494678". Floci minted
the two from independent UUIDs, so the join matched nothing,
findPrimaryDeploymentARN returned nil, and that path returns tfPENDING with no
error, forever. The emulator's request log for one hung apply shows 50
ListServiceDeployments calls and zero DescribeServiceDeployments: the provider
never got past the join. DescribeServiceDeployments itself was fine all along.

recordServiceDeployment now names the revision by the deployment's task set id.

The status that join leads to has to mean something too, so it is derived for
the deployment a service is currently on, the same way deploymentsFor derives
rolloutState: IN_PROGRESS until runningCount has reached desiredCount,
SUCCESSFUL once it has. Recording every deployment SUCCESSFUL with a finishedAt
at create time, as before, would have turned wait_for_steady_state into a wait
that can never fail -- a silent false pass in place of a loud timeout -- and
terraform-aws-ecs's own failure tests deliberately break the container and
assert the apply errors. A deployment the service has moved off keeps what it
was last recorded with. What that derivation still does not model -- a terminal
failure state, rollback, closing out superseded deployments -- is filed
separately.

Measured end to end on the example that timed out: the service now converges in
13s, with one ListServiceDeployments and seven DescribeServiceDeployments, so
the wait is gated on real convergence rather than passing instantly.

* test(ecs): say what the zero-desired deployment test guards

One of the five tests added with the fix passes on the build the bug was found
on, because there every deployment was born SUCCESSFUL and a zero-desired
service was trivially SUCCESSFUL too. That makes it a guard rather than a
repro, and an undocumented guard reads as slack: the next reader counts five
tests, sees four bite, and assumes the fifth is padding.

Measured rather than asserted. Mutating settleStatus to refuse to call a
zero-desired service converged -- adding `&& svc.getDesiredCount() > 0`, the
shape a defensive "nothing was asked for, so nothing succeeded" slip takes --
turns it red with `expected: <SUCCESSFUL> but was: <IN_PROGRESS>` while both
desiredCount-1 tests in the same class stay green. It is the cheap cousin of
deriving the status on a reconciler tick instead of at read time, which for a
service that never needs a tick amounts to the same thing.

The comment also records that it is not independent coverage: the same mutation
reddens this fix's integration twin and the pre-existing
EcsFargateEdgeCaseIntegrationTest.aServiceDeploymentPointsAtTheRevisionItDeployed,
both of which use desiredCount 0 as well. It is kept because it is the only one
of the three whose failure names the condition; the others report a wire
assertion.

* fix(ecs): settle a deployment on its own tasks, not the service's

A service's runningCount counts every RUNNING task it owns, including the ones
still draining from the deployment a rolling change replaced. Deriving a
deployment's status from it reported a task-definition change finished the
instant UpdateService returned, on the strength of the OLD revision's task. The
provider joins to that deployment and stops polling on its first tick, so
wait_for_steady_state on an image change -- the most common real use of the
flag -- returned immediately and a new image that could not start read as
stable.

The create path in the preceding commit was right because a new service owns no
tasks yet, so the service-wide count and the deployment's own count agree. They
diverge exactly when a deployment replaces another, which is the case that
commit did not test. Adding that test is what found this.

runningOnCurrentDeployment counts the service's RUNNING tasks that are not
stale for the current deployment, reusing the ownedBy and isStaleForDeployment
predicates the reconciler already applies. It recomputes rather than caching
what the reconciler derived one line above where it sets runningCount: that
value is a fact about the last tick, and a deployment is read on demand between
ticks -- right after UpdateService, which is the moment that matters.

Applied to the two other places that asked the same question of the wrong
number, both of which predate this branch:

  deploymentsFor  rolloutState, and the Deployment's own runningCount, which is
                  per-deployment in AWS. Left alone it would overstate the count
                  mid-rollout and contradict the ServiceDeployment resource that
                  is now derived correctly -- two Floci views of one deployment
                  disagreeing is worse than both being wrong together.
  eventsFor       the steady-state event, emitted on the same condition.

Measured as a side effect: convergence is now visible one tick earlier, because
the count is taken from the tasks at read time instead of from runningCount,
which the reconciler sets from a snapshot taken before it launches anything. A
test comment that documented the old one-tick lag is updated.

Adjacent cases now covered: a deployment whose task dies goes back to
IN_PROGRESS and withdraws its finishedAt; two updates with no tick between them
settle only the newest; scaling to zero reports converged while the task is
still draining, which is recorded as measured behaviour rather than asserted as
ideal, since AWS's waiter compares with == and would hold it pending.

* fix(ecs): make a finished deployment terminal, and settle onto a copy

Two faults with one root: a deployment's status was derived from a live count
on every read, with nothing to stop it moving.

SUCCESSFUL is terminal in AWS. A completed deployment does not un-complete
because the service later became unhealthy, and finishedAt records when the
deployment finished, not the last time it was asked about. Deriving afresh let
tasks dying afterwards flip a finished record back to IN_PROGRESS, blank a
finishedAt it had already published, and stamp a new one on recovery. Scoping
the count to the deployment's own tasks does not fix this -- when its own tasks
die that count drops too -- so the transition now runs once and never reverses.
Measured both ways: the new test goes red against the preceding commit, which
has the scoped count but no latch, and that commit's update-path test goes red
against the one before it, which has the latch's absence but the wrong count.
Neither fix subsumes the other.

Reads no longer hand out the stored record. settleStatus writes to it and the
response is serialised after it returns, so one request's settle could land
inside another's serialisation; ServiceDeployment's fields are plain and
non-volatile, and a reader could see status=SUCCESSFUL beside a finishedAt that
had not arrived. The transition and the copy now happen under one lock, so a
caller sees a single consistent moment.

Also reverts this branch's changes to deploymentsFor and eventsFor. They were
made to stop rolloutState contradicting the ServiceDeployment resource, but a
terminal SUCCESSFUL makes the two legitimately diverge when tasks die later --
the record stays finished, the live rollout state does not -- so the
consistency argument for touching them no longer holds. Reverting also restores
the property that DescribeServices output is byte-identical to upstream for
services that never ask to wait, which keeps this branch to the one API the bug
is about. The same miscount is still there in rolloutState, predates this
branch, and is recorded on floci-n5kb.

The task scan sits after the is-this-the-current-deployment guard, so a call
costs at most one scan however many deployments it returns, and none once one
has latched.

* fix(ecs): derive rolloutState from the deployment's own tasks too

Reinstates the deploymentsFor and eventsFor half that the previous commit
reverted, because the reason given for reverting it was wrong.

That reason was: once SUCCESSFUL latches, the deployment record and
rolloutState legitimately diverge when tasks die later, so "keep the two views
consistent" is no longer a reason to touch rolloutState. The first half is
true; the conclusion does not follow. It generalises from the one case where
divergence is correct to the case that actually matters, and they are different
questions.

Late divergence is two questions with two right answers: the record is history
and stays finished, rolloutState is live and follows the service. Divergence
DURING a rollout is one question with two answers. Immediately after a
task-definition change, both are describing a rollout that has not started --
and with rolloutState still derived from the service-wide count it reported
COMPLETED while the record correctly said IN_PROGRESS. A client reading
DescribeServices was told the rollout was done when it had not begun, and had
no way to tell which of Floci's two answers to trust.

So the quantity is corrected in all three places that ask the question, while
the latching stays only on the record, where it belongs. Deployment.runningCount
becomes this deployment's count, which is what the field means in AWS; a count
that means something different in two places is the same class of bug as the
one being fixed.

Cost is bounded by the latch rather than by this change: the SUCCESSFUL test is
the first conjunct in settleStatus and && short-circuits, so a settled
deployment never runs the scan, and the is-this-the-current-deployment guard
skips it for the rest. A converged service pays what it always did.

Adds a test pinning both directions: the two views agree while a rollout is in
flight, and the steady-state event stays withheld until it lands.

* test(ecs): pin the two behaviours that survived their own mutants

Both new behaviours on this branch were asserted from a state where the defect
they describe cannot manifest, so removing either production change left the
suite green.

The agree test changed the task definition one reconciler tick after create.
reconcileService sets svc.runningCount from a snapshot taken before it launches,
so one tick short of a steady state that field is still 0 -- and the buggy
derivation, which reads it, gives the right answer by accident. Any service
alive longer than one 5-second tick is past that window, which is every service
anyone actually changes an image on. It now ticks twice and asserts
runningCount == 1 as an explicit precondition, so a future change to tick timing
cannot quietly move it back into the window where it stops testing anything.

The task-death test only re-read the record after the tasks died, when the
converged branch is not taken, so it never exercised the latch itself. Deleting
the already-SUCCESSFUL clause left it green while finishedAt was re-stamped on
every read of a converged deployment. It now re-reads once while still
converged, before stopping the task.

Measured with each production change reverted in turn:
  deploymentsFor/eventsFor -> svc.getRunningCount()
    expected: <IN_PROGRESS> but was: <COMPLETED>
  the SUCCESSFUL clause deleted from settleStatus
    expected: <2026-09-29T18:01:10.537673Z> but was: <...538869Z>

Also from review, three fixes and one correction:

settleStatus folds its guard into the synchronized condition, so every copy is
taken under the lock. "Current" is decided against a deploymentId UpdateService
can mint at any moment, so two threads can disagree about which deployment is
current and the unsynchronised early-return copy could have run beside the
write -- the torn record the lock exists to prevent.

runningOnCurrentDeployment resolves the task definition the same way the
reconciler does. isStaleForDeployment falls back to comparing that against a
task's ARN for tasks minted before deployment ids were stamped, so passing the
raw family reference would have marked every task stale and reported a running
service as having none. Extracted resolvedTaskDefinitionArn, shared by both
callers; the reconciler still caches the resolution, the read path does not,
because a read has no business writing to the service.

currentServiceDeployment now settles like every other read instead of handing
out the stored record. Its caller reads only the two ARN fields, so this was
safe by accident rather than by construction, and copyOf's contract is that no
read returns the stored object. That makes it a third read path depending on
the copy, which is noted at the call site: the copy is load-bearing there, not
tidiness.

The cost note is corrected. The short-circuit bound covers settleStatus alone;
deploymentsFor and eventsFor call runningOnCurrentDeployment unconditionally,
because there is nothing to latch on the live side. The comment said "none at
all once one has latched", which was true of the method and false of the
response.

* docs(ecs): replace the guessed scan cost with a measured one

The note said deploymentsFor and eventsFor call runningOnCurrentDeployment
"unconditionally". True of deploymentsFor, which is a bare call. False of
eventsFor, whose call is the last disjunct of an || chain and so is skipped
entirely for a service that is absent or not ACTIVE -- checkable by reading the
three lines, which is how review caught it.

The number was guessed too. Measured instead, by counting calls to
runningOnCurrentDeployment per DescribeServices per service on a clean tree:

  ACTIVE, first poll after a create or a rollout   3   (1 + 1 + 1)
  ACTIVE, every later poll of a settled service    2   (1 + 1 + 0)
  not ACTIVE, or the service is gone               0

The third term is currentServiceDeployment, which settles and therefore scans
until the current deployment latches and never again -- the poll that reads 1 is
the poll that latches it. So the steady-state cost a polling waiter actually
pays is 2, not the 3 of its first call, and an earlier claim of "none at all
once one has latched" was true only of settleStatus in isolation.

An earlier attempt at this measurement read 0 for deploymentsFor, which is
impossible against a bare call, and that impossibility is what exposed a
corrupted worktree rather than a surprising result. Those numbers were voided.
This run refuses to start unless the tree is clean and restores with git
checkout, so the baseline is a commit rather than a byte copy taken at an
unknown moment.

* docs(ecs): the unlatched cost is every poll, not the first one

The row read "first poll after a create or a rollout", which implies later
polls of a rollout in progress cost 2. They cost 3. A deployment stays unlatched
until it converges, so a slow rollout -- or one that never converges -- pays the
third scan on every poll for its whole duration, which is precisely when a
waiter is polling hardest.

The measured numbers were right and the prose beneath them was right
("scans until the current deployment latches and never again"); only the label
contradicted both. Worth recording that it survived into the commit whose
purpose was to replace a guessed cost with a measured one: measuring the right
thing does not stop you describing it wrongly, and the description is what the
next reader acts on.

* style(ecs): drop em dashes, and the unreachable region literal

Two upstream policy gates on #4694, neither a defect in behaviour.

AGENTS.md prohibits em dashes in any content. Thirteen in lines this branch
adds, replaced with colons, commas or periods as each sentence needed. Em
dashes on lines the branch does not touch are left alone, so the diff stays
about this change.

The partition gate flagged a new region literal in serviceRegion, the helper
added for resolvedTaskDefinitionArn:

    return regionResolver != null ? regionResolver.getDefaultRegion() : "us-east-1";

It was copied from the sibling taskRegion, which upstream annotated with
// partition-literal in #4494. Mirroring that annotation would have been the
cheap route and the wrong one: the guard is unreachable. Nothing constructs an
EcsService without a resolver, and the class dereferences regionResolver
unguarded in the create paths, so a null one fails long before this line. The
literal is therefore dead code that is also wrong in any non-default partition,
which is the worst combination available. Routed through the resolver instead,
which is the gate's own first suggestion, and the dead branch is gone rather
than documented. taskRegion is left as upstream wrote it.

The REGION = "us-east-1" constant in the new test matches four existing ECS
test classes and was not flagged; test fixtures are not partition-sensitive.

* style(ecs): import Map rather than qualifying it inline

AGENTS.md wants the import. Every other ECS test class already does it this
way.

* fix(ecs): count every task a DAEMON service owns, stale or not

Scoping the count to the current deployment is right for REPLICA and wrong for
DAEMON, and left unqualified it created for DAEMON exactly the hang this branch
removes for REPLICA.

reconcileDaemonService has no notion of staleness anywhere in it: no
deploymentId, no task-definition comparison. It decides which tasks to keep
purely by which container instances they cover, so after a task-definition
change the old revision's task holds its slot and no replacement is launched.
A deployment-scoped count therefore sits at zero for ever.

Measured across four reconciler ticks on a DAEMON service with one active
container instance, before this commit and with the count reverted to main's:

  after task-def change   this branch             main
  tick 1 .. tick 4        IN_PROGRESS / nofin     COMPLETED / SUCCESSFUL
                          events 0                events 1
  tasksRunning = 1, and it is the OLD revision's task, throughout

So wait_for_steady_state on a DAEMON image change would have hung until its
timeout where main returned promptly. Counting every owned RUNNING task keeps
DAEMON exactly as main behaves, which makes this branch a strict improvement:
REPLICA fixed, DAEMON unchanged.

This is a mitigation, not a claim that DAEMON is correct. Reporting a
deployment finished while the previous revision is what is running is wrong,
and the real fault is that DAEMON services never roll on a task-definition
change, which is a pre-existing reconciler defect this branch only made
visible. Fixing it means changing daemon scheduling, which does not belong in
a change about when a deployment is finished; it is filed separately.

The test pins the limitation as well as the fix: it asserts the surviving task
is still the old revision's, so the day DAEMON rolling is implemented, the test
says so rather than silently passing.

* docs(ecs): the DAEMON count matches main from tick one, not exactly

The comment claimed counting stale tasks "keeps DAEMON exactly as it behaves on
main". Off by one tick. An identical probe across create, two ticks, a
task-definition change and four more ticks matches main on every row from tick
one onward, and differs on exactly one: a DAEMON deployment with no tasks
running yet reads IN_PROGRESS here and SUCCESSFUL on main.

That difference is the birth-state fix applied uniformly, which is this
branch's whole subject, so DAEMON is a strict improvement rather than merely
unchanged. "Exactly" claimed both less and more than the measurement supports.

The same correction cannot be made to the preceding commit's message, which
carries the original wording. Force-push is barred here and rightly so, so it
is corrected here instead: read that message with this commit beside it.

The test's note on why the limitation is pinned is also sharpened. It said the
assertion stops a mitigation outliving its reason. The coupling is stronger
than that: once DAEMON rolls, counting stale tasks would reproduce on DAEMON
the exact REPLICA bug this branch removes, so the DAEMON branch of the count
has to come out at the same moment, and this assertion is what forces it.

* fix(ecs): stop a deployment the next one supersedes

settleStatus finishes only the deployment a service is currently on, so
a deployment superseded before its tasks converged could never be moved
again: it stayed IN_PROGRESS with no finish time for the life of the
emulator, describing a rollout that could no longer happen. Listing a
service's deployments returned a growing pile of them apparently in
flight at once, and a listing filtered on IN_PROGRESS returned every
rollout the service had ever abandoned.

Recording a deployment now lands the ones it takes over from in STOPPED,
which is the status AWS uses for a deployment that ended without
completing, stamping finishedAt and updatedAt. Only a deployment still
in progress is moved, so one that had already reached SUCCESSFUL keeps
its status and the instant it finished at: that record is history, not
something a later rollout rewrites. The scan is scoped to the one
service ARN.

The write is made under the same monitor settleStatus writes under,
because the two race: a read settling the outgoing deployment can run
beside the update minting its replacement. Both transitions now require
IN_PROGRESS, so whichever lands second finds a terminal status and
leaves it alone and neither can undo the other. That tightens
settleStatus's own guard from "not SUCCESSFUL" to "still IN_PROGRESS",
which is the same condition for every status it can legally advance.

* fix(ecs): stop the deployment a deleted service leaves unfinished

Superseding a deployment was one of the two ways a deployment could be
put permanently beyond settleStatus. This is the other. settleStatus
finishes a deployment only while its service is ACTIVE, and deleteService
sets the service INACTIVE without touching the deployment records at all,
so deleting a service before its first rollout converged left that
deployment IN_PROGRESS with no finish time for ever. No later update
could supersede it, because there are no later updates on a deleted
service. ListServiceDeployments filtered on IN_PROGRESS returned it
indefinitely, which is the same symptom a superseded deployment had,
reached through a different door.

Both routes now go through one helper, which stops only the deployments
of the one service that are still in progress.

Deliberately narrower than AWS, which documents that it "deletes the
service deployment when you delete a service". Stopping the records
removes them from an IN_PROGRESS listing, which is the actual harm,
without turning a DescribeServiceDeployments a client is mid-poll on into
a failure. Deleting them would match AWS and destroy history a client may
still be reading, which is a larger and less reversible change than this
fix warrants; full parity is tracked separately.

Also adds stoppedAt and statusReason to the deployment model, the
response writer and the detached copy every read hands back. Both are
members of AWS's ServiceDeployment shape and neither was written at all,
so a client asking when a stopped deployment ended, or why, got nothing.
AWS files STOPPED under its "Completed" lifecycle stage, so a stopped
record carries finishedAt as well as stoppedAt; a deployment that is
running or that succeeded carries neither field, absent rather than null.

* docs(ecs): drop private tracker ids from javadoc

Four javadoc references named issues in a private tracker, so a reader of
this code upstream could not resolve any of them. The behaviour each one
described is stated in the surrounding prose already, which is where it
belongs: a comment has to stand on its own for whoever reads it next.

* test(ecs): name the deployment asserted on, never its index

The superseded-deployment assertion read the listing's index 1 and 2.
listServiceDeploymentsDetailed sorts on createdAt and List.sort is
stable, so three deployments minted inside one clock tick share a
timestamp and their order in that listing is ConcurrentHashMap iteration
order. The assertion held here only because Instant.now() resolves finer
than the cost of minting a deployment on this machine; where the clock is
coarser it would pass or fail by hash order. Each record is now selected
by its own task set id, which is what the rest of the class already does
and what its javadoc already claimed of the whole file.

Also records why the supersede pass runs before the new deployment is
published rather than after, since that ordering looks arbitrary and is
not: two concurrent UpdateService calls can leak one stale IN_PROGRESS
record this way, whereas publishing first and stopping everything but
self lets one caller stop the current deployment and hang a steady-state
wait, which is the failure this branch exists to remove. Locking is not
the answer at this level, because updateService already mutates the
shared service model unsynchronised.

Drops an unreachable null check on the service ARN: the caller
dereferences the same value before calling in, so a null cannot arrive.

* fix(ecs): stop a deleted service's deployments before zeroing its count

deleteService wrote status INACTIVE and desiredCount 0, then stopped the
service's unfinished deployments several statements later. Both fields are
plain non-volatile fields of a service model shared with every reader, and
settleStatus reads them under synchronized (deployment), a monitor nothing
takes for the service. So in that window a reader could see the new
desiredCount of 0 beside a status it still read as ACTIVE, and zero
running tasks satisfies the convergence test trivially: the deployment
latched SUCCESSFUL, reporting a rollout that never happened as having
succeeded. The already-terminal guard cannot help, because the record is
still IN_PROGRESS at that point and its revision ARN still matches.

Stopping the records between the two setters closes the window rather than
narrowing it. A reader arriving earlier still sees the honest pre-delete
desiredCount, so it can only finish a deployment that really converged.
One arriving later finds the record already STOPPED, so the guard blocks
the latch whatever it sees of the service. The dangerous pairing becomes
observable only once the record is terminal anyway.

The call is safe in its new position because the helper reads nothing
about the service: it takes an ARN, a timestamp and a string, and branches
only on each deployment's own status. It stays below the force-flag
validation, so a request that throws still stops nothing.

The ordering is a correctness constraint rather than a style choice, and
nothing in the code said so, so the call site now does: moving
setDesiredCount up, or the helper back down, silently reopens this.

Reasoned, not pinned. The window is a memory-visibility race between two
threads, so single-threaded execution cannot distinguish the two orders at
all: both leave identical state. Reverting the move fails no test.

* test(ecs): identify the stopped deployment after the delete, not before

The wire test read DescribeServices to find the deployment before deleting
the service, and its javadoc claimed determinism on the grounds that
nothing read the service in that window. That read was the window. Every
response serialising a service settles that service's current deployment,
so a reconciler tick landing between the create and the read would launch
the task, the read would latch the deployment SUCCESSFUL, and the delete
would then correctly leave a terminal record alone, failing the
assertions. A few milliseconds against a 5000ms period.

The service is created once and never updated, so it has exactly one
deployment and needs no join to identify. Deleting first and listing
afterwards removes the read, and a terminal record cannot change under a
read anyway.

One window remains and is now written down rather than papered over: a
tick between CreateService putting the service in the map and that same
response being serialised would still latch it. Sub-millisecond, and not
closable from a test without stubbing the clock. The behaviour is pinned
without timing in the unit suite; this test exists for the wire mapping.

Also restores the null check on the service ARN in the stop helper. The
reason given for removing it was only half right: recordServiceDeployment
does dereference that field first, but deleteService does not, so at that
call site the check was load-bearing and removing it turned a silent
no-op into an NPE inside DeleteService. A service model can arrive by
deserialisation from the store rather than through createService, so a
non-null ARN is not an invariant, and ownedBy guards the same field for
the same reason.

* fix(ecs): settle the outgoing deployment when UpdateService supersedes it

A converged deployment was only marked SUCCESSFUL when something read it
while it was still current, so an update with no read in between left it
STOPPED. UpdateService now settles it first, before it changes the desired
count or task definition, which the settle judges against.

* docs(ecs): trim the deployment comments to what the code needs

Drops branch history and private tracker references, and corrects the
recordServiceDeployment Javadoc, which described AWS's revision ARN form
rather than the service-revision/<id> one it builds.

* fix(ecs): DeleteService settles a converged deployment before stopping it

A deployment whose tasks were up when the service was force-deleted was
marked STOPPED unless something had read it first. DeleteService now
settles it against the service as it stands, as UpdateService does.

The integration test that stops a deployment through a delete retries on
a fresh service when the reconciler converges it first, instead of
failing on that race.
2026-09-30 13:12:20 -04:00
Vinícius Macedo 5ee81e7006 fix(s3): emit ObjectRemoved:Delete when deleting a specific object version (#4710)
* fix(s3): emit ObjectRemoved:Delete when deleting a specific object version

DeleteObject with a versionId permanently removed the version but was
the only delete branch that never fired a notification. It now sends
ObjectRemoved:Delete carrying the deleted versionId, including when the
version is a delete marker. A versionId that matches nothing fires
nothing.

Closes #4680

* fix(s3): carry version-id in EventBridge S3 event details

The EventBridge detail for an S3 event listed the object's key, size and
etag but never its version, so the Object Deleted event for a permanent
version delete could not say which version went. Add object.version-id
whenever the object has one, as AWS does for versioned buckets.

* test(s3): disable the versioned bucket's EventBridge notification in cleanup

* fix(s3): set deletion-type on EventBridge Object Deleted events

AWS tells the two kinds of deletion apart in the EventBridge detail:
"Permanently Deleted" for an object or version that is gone, and
"Delete Marker Created" for a marker. Floci set neither, so the
permanent version delete looked the same as a marker to a rule written
for AWS. Derive it from the event name.
2026-09-30 11:34:32 -04:00
Niels Kootstra 888a718924 fix(s3): stream GetObject bodies from disk instead of the heap (#4691)
* fix(s3): stream GetObject bodies from disk instead of the heap

GetObject read the whole object into a byte array before responding, so
every concurrent download of a large object held a full copy in the heap.

Add S3Service.openObject, which runs the same dataGeneration check as
getObject but opens a file channel instead of reading the bytes. Writes
replace the object file with an atomic move, so the open channel keeps
serving the version its headers describe. Full, Range and website index
responses stream from it and close it on every early exit.

* fix(s3): close the object stream when a response fails to build
2026-09-30 10:57:53 -04:00
Vũ Thế Huy 184b50e2ba feat(elasticache): authenticate each RBAC user by its own authentication mode (#4536)
* feat(elasticache): authenticate each RBAC user by its own authentication mode

Resolve issue #4457.

- Add hasMembers and memberAuthMode resolution to ElastiCacheService and PasswordValidator callback.
- Allow AuthMode.NO_AUTH users to be admitted with any password (Redis ACL nopass semantics).
- Refactor ElastiCacheAuthProxy to validate each user according to their configured AuthMode (IAM, PASSWORD, NO_AUTH) when the cluster has members.
- Fallback single-arg AUTH to authToken or default user.
- Add comprehensive unit and integration tests.

* fix(elasticache): address review feedback on per-user RBAC authentication

- Allow passwordless access when default member requires no auth
- Support explicit default username with group auth token
- Clean up group associations when deleting users to avoid lockout
- Reject duplicate usernames in ModifyReplicationGroup with DuplicateUserNameFault
- Validate password strictly against the resolved user's auth mode

* fix(elasticache): require auth when default member is missing and handle HELLO AUTH

- ElastiCacheAuthProxy: require auth when group has members but no default member

- AbstractRedisAuthProxy: intercept HELLO with AUTH option on open caches and validate credentials before forwarding

- Add unit and integration tests for missing default user and HELLO AUTH on open cache

* fix(elasticache): require auth for disabled default user and reject disabled members

- ElastiCacheUser: evaluate ACL accessString to determine whether user is enabled (on) or disabled (off)

- ElastiCacheService: reject authentication for disabled users and exclude them from memberAuthMode

- ElastiCacheAuthProxy: remove obsolete unreachable comment on NO_AUTH switch arm

- Add unit and integration tests covering disabled default user and disabled members
2026-09-30 10:41:51 -04:00
mitsukado-shinagawaandmitsukado-shinagawa 955c11dc56 fix(stepfunctions): record the iterations a failing Map iteration cuts, and the state each was in (#4724)
* fix(stepfunctions): record the iterations a failing Map iteration cuts, and the state each was in

AWS records, for each iteration an inline Map failure cuts, a
MapIterationAborted and then the TaskStateAborted or WaitStateAborted
of the state it was in, all chained to the failing iteration's last
event and ahead of MapIterationFailed and MapStateFailed. Floci cancelled
the iterations and recorded nothing for them.

MapIterationScheduler cancelled the in-flight iterations without knowing
their chains, so the Map saw them only after they had left their states.
It now calls back with each in-flight index before cancelling, and the
Map reads and cuts each one in one step through abandonInState, as the
Parallel does. The failing iteration's MapIterationFailed is recorded by
the Map after the cut, so the aborted events come first; its
previousEventId is unchanged.

Closes #4722

* fix(stepfunctions): never report a Map iteration both ended and cut

The scheduler names every iteration it has not yet taken off its queue,
so an iteration that finished after the failing one was dequeued was
cut as well and recorded MapIterationAborted after its own
MapIterationSucceeded. The iteration's end event is now published under
the chain's lock together with an ended marker, and the cut reads that
marker in the same step it reads the state, so an iteration is reported
either ended or cut, never both.

* fix(stepfunctions): record the iterations a Map failure cut only with its MapIterationFailed

A States.Runtime failure records no MapIterationFailed. When it was a
declared tolerance that failure exceeded, the Map ended with
States.ExceedToleratedFailureThreshold instead, which passed the check
for the cut iterations, so they were recorded aborted without the
MapIterationFailed of the iteration that cut them. Both now follow the
one condition.

* fix(stepfunctions): record a cut Map iteration by the rule of the event it accompanies

The cut iterations are recorded right before MapStateFailed and now
follow its rule, that the failure ending the Map is not States.Runtime,
while MapIterationFailed keeps the iteration's own. Tying both to the
iteration's condition had dropped the cut iterations for an ItemSelector
that fails before its iteration starts, which has nothing to report
itself but still cuts the others and still records MapStateFailed.

An iteration is also reported cut only when its MapIterationStarted is
recorded: the start is published under the chain's lock with a started
marker, read by the cut in the same step, so an iteration cut while its
ItemSelector was still being evaluated records neither a start nor an
abort.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 10:33:37 -04:00
mitsukado-shinagawaandmitsukado-shinagawa fd094aee05 fix(stepfunctions): return the PascalCase execution envelope from states:startExecution, .sync and .sync:2 (#4737)
AWS returns, as the Task result of the optimized states:startExecution
integration (measured in ap-northeast-1 on 2026-09-30):

- request-response: the StartExecution response, {ExecutionArn, StartDate},
  StartDate in epoch milliseconds
- .sync: the child's DescribeExecution response, PascalCase with its keys
  in alphabetical order, dates in epoch milliseconds, Input and Output as
  JSON strings
- .sync:2: the same envelope with Input and Output as JSON values

Floci returned camelCase with dates in seconds for the first two and the
child's output alone for .sync:2, so a state machine written against AWS
found nothing at $.Output, $.ExecutionArn or $.Status.

The failure cause of the two .sync modes already built this envelope
(#4675). It now builds the success result too: a SUCCEEDED child carries
Output, OutputDetails and RedriveStatusReason and reports NOT_REDRIVABLE.
Request-response returns the response TaskSubmitted already records.

This changes the result shape for state machines written against Floci's
earlier one: the child output of .sync:2 moves from $ to $.Output.

Closes #4723

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 10:14:12 -04:00
Langning Zhang d267ba3a9d fix(ses): validate EventBridge default bus ARNs (#4677)
* fix(ses): validate EventBridge default bus ARNs

Signed-off-by: boulea7 <zln1905391059@163.com>

* fix(ses): reject EventBridge bus account and Region mismatches

Signed-off-by: boulea7 <zln1905391059@163.com>

---------

Signed-off-by: boulea7 <zln1905391059@163.com>
2026-09-30 10:00:19 -04:00
Hector Ventura 99c1c4129a fix(iam): derive the AWS managed policy catalog per partition (#4742)
The bundled managed policy catalog is the commercial one, so
arn:aws-cn:iam::aws:policy/AdministratorAccess did not resolve and a China
deployment listed commercial ARNs. Every other partition's catalog is now
derived from the bundled data on first use and cached per partition: every
arn:aws: inside a document takes the partition, as AWS's SAM translator does
for managed policy ARNs (arn_generator.py), and the region-bearing
kms:ViaService hosts (s3.*.amazonaws.com) take the partition's DNS suffix.
Bare service principals and service-linked role paths are universal (#4633)
and are left alone, as is the ::aws:policy/ owner slot.

IamService resolves a managed policy under the partition its ARN names, so a
China ARN resolves under any signing scope, and ListPolicies lists the catalog
of the caller's partition.

Partition literal baseline 4 -> 3.

Part of #4272
2026-09-30 09:20:49 -04:00
David 5aad012e78 feat(emr-serverless): tag, untag and list tags for applications (#4667)
EMR Serverless had no tagging API: no TagHandler was registered for the
emr-serverless ARN service, so TagResource, UntagResource and
ListTagsForResource could not be routed, and a tagged
aws_emrserverless_application could not be planned.

Register an emr-serverless handler with the shared /tags dispatcher,
answering 200 as the model does, over the tags already stored on the
application. Validate keys and values, the user guide's 50 tag limit
and its reserved aws: prefix, refuse job run ARNs as not found, and
synchronize the application mutators so a tag write cannot lose a
concurrent update.

Closes #4662
2026-09-30 09:11:04 -04:00
Priamo Germosen 48214e04e0 fix(codeartifact): extend idempotent asset republish to Published versions (#4708)
Two follow-ups hectorvent flagged on #4619, approved but marked as
separate-PR material:

Compares an existing asset's persisted SHA-256 instead of reading its
bytes. The hash is normal metadata (not @JsonIgnore like the content
field), so this needs no disk read, no in-memory-store lookup, and no
special case for a backing file that happens to be missing - a stored
hash never "goes missing" the way a file can, and a genuinely different
republish still conflicts even when the file is gone, closing a gap the
previous byte-comparison approach had.

Extends the idempotent-retry allowance to an already-Published version.
AWS's "Overwriting package assets" rule isn't scoped to Unfinished, and
the terminal publish call (the one that actually finishes a version) is
the likeliest one a client retries after a dropped response. A brand-new
asset name against a Published version still always conflicts; only a
byte-identical replay of an asset that's already there is idempotent.
2026-09-30 08:00:43 -05:00
Priamo Germosen f752946acf refactor(secretsmanager): build the rotation function ARN with Lambda's own helper (#4709)
Follow-ups from the review of #4697.

rotationFunctionArn built the partial-ARN case by string concatenation while the bare-name case went
through AwsArnUtils.Arn. Turning a FunctionName reference into a full function ARN is Lambda's
knowledge, so it now lives in LambdaArnUtils.functionArn, next to eventSourceMappingArn: the
reference is read with LambdaArnUtils.resolve, the parser Lambda itself uses, and every case is
minted through AwsArnUtils.Arn from the parts. Secrets Manager calls it with the secret's partition
and account, and keeps no Lambda layout of its own. ResolvedFunctionRef also carries the account a
full or partial ARN names (null for a bare name), which the helper needs.

A reference Lambda cannot read, such as a Region-prefixed partial ARN, is now refused with Lambda's
InvalidParameterValueException before the permission check, instead of being minted with the Region
twice and failing later at the function lookup.

The missing-function message names its service principal through ServicePrincipals.of, as AGENTS.md
now asks, in place of the literal marked partition-invariant in #4697.

The comment on the caller == null branch of IamEnforcementFilter.authorizeAdditionalResource said the
path only served a presigned POST whose signature was already verified. It now also serves CopyObject,
RotateSecret and SSM GetParameter, and even for the presigned POST the signature check runs after
it, and only when S3 auth enforcement is on. The comment now says what actually makes an unknown key
safe on each path.
2026-09-30 08:00:21 -05:00
Niels Kootstra 6df2a6cfc2 fix(ssm): run direct executions on virtual threads (#4689)
* fix(ssm): bound direct-execution threads for SendCommand

Each SendCommand target backed by a Floci EC2 container ran on a cached
thread pool, so a command with many targets started one thread per target,
each held for the whole container exec (up to TimeoutSeconds). Use a fixed
pool of max(4, availableProcessors) daemon threads instead; extra targets
wait in the executor queue and still complete.

* fix(ssm): run direct executions on virtual threads

* fix(ssm): keep a cancelled invocation cancelled when its exec finishes
2026-09-30 08:43:47 -04:00
mitsukado-shinagawaandmitsukado-shinagawa 6ca104042b fix(stepfunctions): fail a Parallel the moment any branch fails, whichever is listed first (#4713)
executeParallelState joined the branch futures in declaration order, so a
failure in a later branch was only seen once every earlier branch had
returned: a .sync Task listed before the failing branch kept the Parallel
running until its job ended on its own, and a Wait listed first until the
Wait ended. AWS fails the Parallel within about 0.1 s of the failing branch
either way (measured in #4646).

The branches now go through an ExecutorCompletionService, as the Map
iterations already do, and are polled as they complete under the same two
deadlines. The failed branch is the one whose future came off the queue, so
continueFrom and the aborted-state events of #4660 attach to the same chain.
The outputs are collected by branch index and still come back in declaration
order.

Closes #4646

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 07:00:42 -04:00
Daniël van Ziel b0b191e0bc fix(lambda): poll Kinesis event source in the mapping account (#3964) 2026-09-30 06:40:52 -04:00
mitsukado-shinagawaandmitsukado-shinagawa 2eadc106c5 fix(stepfunctions): record TaskSubmitted for a .sync Task, named as AWS names it (#4719)
* fix(stepfunctions): record TaskSubmitted for a .sync Task, named as AWS names it

AWS records TaskSubmitted for every .sync Task once the call that starts
the job has returned and before it waits on the job, chained to
TaskStarted and carrying that call's response as output in PascalCase:
{ExecutionArn, StartDate} in epoch milliseconds for states:startExecution
.sync and .sync:2, {Failures, Tasks} for ecs:runTask.sync. Floci recorded
nothing between TaskStarted and the terminal event, so a client reading
the job's id from the history found nothing until the Task ended.

The two poll loops do not have the HistoryChain; invokeResource hands
them a callback that publishes the event. The SDK's SdkHttpMetadata and
SdkResponseMetadata, which AWS folds into the response, are left out,
as everywhere else in Floci.

The task event profile also split a well-formed integration id at its
last colon, so every event of a .sync:2 Task read resourceType
states:startExecution.sync, resource 2. AWS reports states /
startExecution.sync:2, so a parsed id now splits at its service.

Closes #4648

* test(stepfunctions): name the types in the TaskSubmitted history test

* fix(stepfunctions): stop the job when TaskSubmitted cannot be recorded

TaskSubmitted is the first event after the job exists. When it is the
event that hits the 25,000-event history limit, the publish throws
before the poll loop whose catch stops the job is entered, so the parent
failed with States.Runtime while the child execution or ECS task ran on.
Both loops now abort the job on that path, the way the wait would have.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 06:35:09 -04:00
Mario Toffia 560de5c13f fix(tagging): find resources by the tags their own service holds (#4563)
* fix(tagging): list resources by the tags their own service holds

GetResources, GetTagKeys and GetTagValues merge the tagging store with every
ResourceProvider, so SQS, Lambda and Logs tags are discoverable. Resource type
filters now parse colon and leading-slash ARNs (function:f, log-group:x, /apikeys/k),
and TagResources/UntagResources write through to the owning TagHandler.

* fix(apigateway): expose tagged resources and API key tags to the tagging API

ApiGatewayService is a ResourceProvider for REST APIs, stages, API keys, usage plans and
domain names, and ApiGatewayTagHandler serves /apikeys/<id> ARNs, so GetResources finds
API Gateway resources by tag and tagging-API writes land on the API key itself.

* fix(cloudformation): forward AWS::Lambda::Function Tags

CreateFunction now receives the template Tags; an in-place UpdateStack untags dropped keys and retags the desired set, mirroring SqsCfnProvisioner.

* fix(tagging): scope global-ARN resources by region and clamp stale page tokens

Provider resources with an empty ARN region use their own region, stale page tokens
past the end return an empty page, and provider tags are copied inside the skip guard.

* test(compat): discover SQS, Lambda, Logs and API Gateway resources by tag

* docs(tagging): describe owning-service discovery

* fix(tagging): forward tags only for resources the owning service lists

* fix(apigateway): report the calling account and tag usage plans

* docs(cloudformation): note Lambda tag reconciliation on update

* fix(tagging): match declared resource types and scope owner writes to the request

API Gateway API key and usage plan ARNs must now name the key or plan at the
start of the resource part, so a nested /apikeys/ segment no longer tags the key.

* fix(tagging): match AWS type filters, regions and failure codes

Compared against a live AWS account: type filters, IAM listing, cross-region
TagResources and FailedResourcesMap entries now answer as AWS does.

* fix(cloudformation): keep Lambda tags added outside the template

* fix(tagging): route TagResources to V1 tag handlers too

* fix(apigateway): reject sub-resource ARNs when tagging a REST API

* fix(tagging): write tagging API tags through to SQS, Lambda and Logs

TagResources and UntagResources now reach the queue, function or log group's own tags through TagHandler beans qualified @TaggingApiOnly, so ListQueueTags, Lambda ListTags and Logs ListTagsForResource show them. The qualifier keeps these handlers off the /tags/{arn} and /v1/tags/{arn} paths, since each service defines tags in its own protocol.

* fix(cloudformation): forward SSM parameter tags

AWS::SSM::Parameter now applies its Tags after the overwriting put. On UpdateStack only the keys the previous template set and the new one drops are removed, tracked in the internal FlociSsmTemplateTagKeys attribute, so tags added outside the template are kept.

* fix(tagging): hide tagging-store copies of global resources

GetResources no longer lists an IAM role or user tagged through TagResources, since AWS never lists global resources.

* fix(tagging): reject every wildcard log group ARN

TagResources and UntagResources now send a log group ARN ending in :* to CloudWatch Logs even when the group does not exist, so it is rejected as in AWS instead of stored.

* fix(tagging): clear store tags on every untag

UntagResources now removes the keys from the tagging store for every ARN, even one the owning service rejects, so a copy stored earlier can always be cleared.

* fix(cloudformation): tag an adopted Lambda function

When CreateFunction conflicts and the provisioner adopts the existing function, the template's tags are now applied to it.

* fix(apigateway): tag only exact domain and stage ARNs

A domain or stage segment nested elsewhere in an API Gateway ARN, such as /restapis/<id>/domainnames/<d>, is now rejected instead of tagging that domain or stage.

* fix(cloudformation): leave an adopted Lambda function's tags alone

Adoption uses the existing function as it is, as before, so a function outside the stack keeps its tags.

* fix(cloudformation): record no template tag keys for an adopted Lambda function

An adopted function keeps its own tags, so a later update adds the template's tags without removing any it never set.

* fix(tagging): never list IAM ARNs from the tagging store

A role tagged through TagResources stays hidden after DeleteRole, as AWS never lists IAM resources.

* fix(tagging): fail a write when an owning service cannot be read

A provider that fails while routing TagResources or UntagResources now returns InternalServiceException instead of writing the tagging store and reporting success.

* fix(tagging): fail only unresolved ARNs when a provider cannot be read

A provider failure no longer fails the whole TagResources or UntagResources call; only ARNs whose owner could not be resolved are reported in FailedResourcesMap.

* fix(tagging): report another account's ARN instead of storing it

TagResources and UntagResources report an ARN from another account in FailedResourcesMap with AccessDeniedException, as AWS reports it per ARN, and never write it to the tagging store.

* fix(tagging): keep stored tags for an ARN an untag could not resolve

UntagResources leaves the tagging store unchanged for an ARN it reports as unresolved or from another account; an ARN its owner rejected is still cleared.

* fix(tagging): fail an unresolved ARN only when its own service cannot be read

A provider failure now only affects unlisted ARNs of the services that provider declares.

* fix(tagging): copy stored tags under the writers' lock

GetResources, GetTagKeys and GetTagValues no longer race a concurrent TagResources on a stored mapping.

* fix(apigateway): reject reserved tags when tagging a usage plan

TagResources on a usage plan now refuses floci:override-id as the other API Gateway tag paths do, instead of dropping it and reporting success.

* fix(apigateway): reject tag ARNs with an account or another region

The /tags path now answers an ARN with an account segment with BadRequestException and one naming another region with NotFoundException, as AWS does, instead of resolving the id in the caller's region.

* fix(ssm,lambda): reject tag keys outside the AWS pattern

AddTagsToResource, PutParameter, TagResource and CreateFunction now reject a tag key outside the AWS pattern or 1 to 128 characters with ValidationException, as AWS does, which also keeps the CloudFormation managed-key attributes lossless.

* fix(ssm,lambda): validate CloudFormation tag keys before changing the resource

* docs(tagging): say every handled ARN ending in :* reaches its service

* fix(tagging): read a negative pagination token as the first page
2026-09-30 06:10:27 -04:00
vamsiakandVamsi Akavarapu af3d387140 fix(apigateway): route REST execute-api virtual hosts (#4553)
* fix(apigateway): route REST execute-api virtual hosts

* fix(apigateway): preserve REST connection paths

* fix(apigateway): prioritize WebSocket connection routes

* fix(apigateway): honor explicit REST domain routes

* fix(apigateway): preserve WebSocket domain connections

* fix(apigateway): scope base path routes to REST APIs

* fix(apigateway): retain API type for domain mappings

* fix(apigateway): find WebSocket connection routes across accounts

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-30 06:07:57 -04:00
XuJian a5dd3c2f2e fix(cloudhsm): add issuer key identifiers to hardware chain (#4707)
* fix(cloudhsm): add issuer key identifiers to hardware chain

* fix(cloudhsm): certify the shared hardware key twice

* chore(cloudhsm): sort service imports
2026-09-30 06:00:13 -04:00
Niels Kootstra 70efa35fe3 fix(codebuild): keep only the tail of phase output for failure messages (#4690)
* fix(codebuild): keep only the tail of phase output for failure messages

runPhase buffered every byte a phase printed in a ByteArrayOutputStream,
but only the last 512 characters reach the failure message. A phase with
gigabytes of logs held them all in the heap, and past 2 GiB the buffer
threw OutOfMemoryError. Keep a fixed 4 KiB tail instead.

Strip trailing whitespace before taking the last 512 characters. The
offset was computed on the unstripped text, so more than 512 trailing
whitespace characters replaced the message with an index error.

* fix(codebuild): keep the last error when a phase ends in long whitespace

* test(codebuild): name runner test after the class it covers
2026-09-30 05:54:50 -04:00
TATSUNO “Taz” Yasuhiro e6ee346761 feat(sqs): expire messages after MessageRetentionPeriod (#4706)
* feat(sqs): expire messages after MessageRetentionPeriod

ReceiveMessage, GetQueueAttributes counts, the inspection endpoint and
StartMessageMoveTask skip messages older than the queue's retention
period. A sweeper frees expired messages every 60 seconds.

As on AWS, a standard DLQ keeps the original enqueue time, while a FIFO
DLQ and StartMessageMoveTask start the retention period over.
SentTimestamp is kept in all cases.

* fix(sqs): drop messages that expire during a rate-limited move task

* test(sqs): cover a failing retention sweep

* test(sqs): make the rate-limited move task expiry test deterministic

* test(sqs): assert the expiring message is live when the move task starts

* fix(sqs): reject MessageRetentionPeriod outside 60 to 1209600 seconds
2026-09-30 00:03:48 -04:00
Allen Sanborn 6b7d17698c fix(ec2): an interface VPC endpoint reports its network interfaces, and they resolve (#4598)
* fix(ec2): report an interface VPC endpoint's network interfaces

DescribeVpcEndpoints never emitted networkInterfaceIdSet, so an interface (PrivateLink)
endpoint came back with no interfaces at all. Terraform's aws_vpc_endpoint surfaces that
element as network_interface_ids, and modules feed the output downstream to
security-group rules, flow-log filters and DNS, so the empty list does not merely differ
from AWS: it propagates into whatever consumes it.

The interfaces already existed. Ec2Service.endpointNetworkInterfaces derives one per
subnet deterministically, with a stable id, the subnet's availability zone and
interfaceType vpc_endpoint, so flow-log generation can attribute AWS-service traffic to a
stable endpoint address. Nothing reported them on the wire.

So this adds a reader rather than a new resource. endpointNetworkInterfaceIds returns the
same ids that endpointNetworkInterfaces synthesizes, reusing endpointEniId, deliberately
derived instead of stored: a second, stored copy could disagree with the one flow-log
attribution reads, and then two answers would exist for one question. It mirrors the
existing endpointDnsEntries accessor, which the same XML writer already calls.

A Gateway endpoint is a route-table entry and owns no interfaces. AWS reports none for
one, and so does this: the element is omitted rather than emitted empty.

Ec2VpcEndpointNetworkInterfaceIdsIntegrationTest covers one interface per subnet with
distinct ids, the ids being stable across two DescribeVpcEndpoints calls (Terraform reads
them between plan and apply), a single-subnet endpoint reporting exactly one, and a
gateway endpoint reporting none. That last case is what stops a change that simply
emitted the set unconditionally from passing.

Verified by reverting the emission alone: 2 of the 3 tests fail, and the gateway case
correctly still passes. Restored, all 3 pass.

Ec2*Test is 1246 tests with 2 failures, both in Ec2VolumeBlockDeviceDockerIntegrationTest
(Docker block devices, mke2fs). Measured on a clean checkout of upstream/main with these
changes removed: the same 2 fail. Pre-existing and environment-specific, not from this
change.

* fix(ec2): reattach the DnsEntries javadoc to its own method

The previous commit inserted endpointNetworkInterfaceIds and its javadoc between the
endpointDnsEntries javadoc and endpointDnsEntries itself. Java binds a doc comment to the
next declaration, so that left two consecutive blocks on the new method -- the first
dangling, the second the real one -- and endpointDnsEntries documented by nothing.

Moving the new method above the DnsEntries javadoc restores that binding and puts the
accessor next to endpointEniId, the helper whose ids it returns. Comment placement only;
no behaviour changes.

Ec2VpcEndpointNetworkInterfaceIdsIntegrationTest: 3 tests, 0 failures.

* refactor(ec2): derive endpoint ENI ids from the interfaces, not beside them

Review found that the javadoc on endpointNetworkInterfaceIds asserted an invariant the
code did not have. It said the ids were derived from endpointNetworkInterfaces so a
second copy could not disagree with what flow-log attribution reads. They were not
derived from it: both called endpointEniId independently, and they filtered differently.
endpointNetworkInterfaces skips a subnet whose record has gone; the id method emitted one
for every entry of getSubnetIds() unconditionally.

The gap is reachable. deleteSubnet checks only for transit-gateway attachments, so
nothing stops a subnet being deleted out from under a live endpoint, and the two were
then measured reporting different sets -- two answers to one question, with flow-log
attribution reading the shorter. Real AWS answers DependencyViolation to that delete and
Terraform's graph destroys the endpoint first, so the state is reachable only in an
emulator. That is the argument for the emulator staying self-consistent in it, not
against.

Extracts endpointNetworkInterfacesOf(VpcEndpoint). The region-wide
endpointNetworkInterfaces(String) is now that method looped, and the id list is mapped
over it, so one copy of the subnet-existence filter serves both and congruence holds by
construction rather than by inspection.

A distinct NAME rather than an overload: endpointNetworkInterfaces(VpcEndpoint) beside
endpointNetworkInterfaces(String) makes a Mockito any() ambiguous, and
FlowLogServiceTest:31 already uses one. Caught by the compiler; a new method should not
make an existing test stop compiling.

Incidental saving: vpcEndpointXml called the region-wide scan once per endpoint in a
response, so DescribeVpcEndpoints was quadratic in subnet lookups. It no longer is.

THE TEST WAS DECORATIVE UNTIL IT WAS MEASURED. Its first draft compared the wire ids to
the service's list for an endpoint whose subnets all still existed -- a case where both
derivations trivially agree, and it passed against the buggy version. It now deletes a
subnet out from under the endpoint first. Verified both ways: it FAILS on the old
independent derivation and PASSES on this one.

Ec2VpcEndpoint*, FlowLogServiceTest, Ec2ServiceTest and Ec2NetworkInterfaceIntegrationTest:
1251 tests, the only failures being Ec2VolumeBlockDeviceDockerIntegrationTest's known 2
of 8 (Docker block devices, mke2fs), measured identically on a clean upstream/main
checkout.

Not addressed here, filed separately: the ids this publishes do not resolve through
DescribeNetworkInterfaces, which never consults endpointNetworkInterfaces. Real AWS
returns endpoint ENIs there as requester-managed with interfaceType vpc_endpoint. That
gap predates this branch; publishing ids makes it visible rather than creating it, and no
corpus module looks one up today.

* docs(ec2): narrow the congruence claim to what the code actually guarantees

Three findings from review of #21, none behavioural.

The javadoc said the wire ids are BY CONSTRUCTION "the interfaces flow-log attribution
reads". Within one account that is exact -- vpcEndpoints.scan and subnets.get share a
prefix and both stores are account-wrapped. But FlowLogService runs on a scheduler with
no request context, so it reads the default account while this path reads the caller's;
for a non-default account the flow-log side sees no endpoints at all. Each side stays
internally consistent, which IS the property the refactor established and the one worth
claiming. Both seeing the same endpoints is not, and the absolute phrasing claimed it.
Restated as shared derivation rather than shared view.

endpointNetworkInterfacesOf was public with no caller outside the class -- not in
Ec2QueryHandler, which calls endpointNetworkInterfaceIds, and not in any test. Every
sibling helper in the same block is private (endpointEniId, endpointDnsDiscriminator,
endpointServiceToken, endpointPrivateIp), so public was the outlier. Now private. The
javadoc's argument for the distinct NAME stands untouched; that was about the Mockito
ambiguity, not the visibility.

The same javadoc cited FlowLogServiceTest:31 for that ambiguity. The line is 44 on this
base, and a comment carrying a line number is wrong again at the next rebase, so it now
names the stub instead.

Also drops a stray backslash in "method\'s" that survived from the heredoc the comment
was written in.

* test(ec2): say what the gateway case actually catches, which is less than claimed

The class javadoc and the PR description both said the gateway assertion is "what stops a
change that simply emitted the set unconditionally from passing". It is not. The emission
is guarded by `if (!endpointEniIds.isEmpty())`; remove that guard and a gateway endpoint
gets an empty `<networkInterfaceIdSet/>`, whose `item` list is empty, so
`eniIdsOf(...).isEmpty()` still holds and the test still passes.

Found by review of #21. Third claim on this branch that asserted more than the code
delivered -- after the javadoc that claimed a congruence invariant the code lacked, and
the one that claimed both sides see the same endpoints across accounts.

Not fixed by tightening the assertion to pin absence, which was the obvious move and the
wrong one: real AWS emits the empty element where this omits it. Absent and empty are
indistinguishable to any ec2query SDK, and Terraform's TypeSet lands both as an empty set,
so the behaviour is fine -- but an assertion pinning absence would pin the side of that
choice further from AWS, and make a later move toward AWS look like a regression.

So the comment now states the limit instead. The case still earns its place as a
regression guard: a gateway endpoint must never report interface ids.

Also orders the new test's imports like the sibling SubnetConfiguration suite.

* fix(ec2): an endpoint on a subnet whose CIDR is not dotted IPv4 must still answer

Both findings from the Greptile review of #4598.

P1. endpointPrivateIp splits the subnet's CidrBlock on dots and reads parts[1] and
parts[2]. CreateSubnet calls setCidrBlock with whatever it was given and never validates
the address family, so the value is not guaranteed to be dotted IPv4 -- "2001:db8::/56"
splits to one element and parts[1] throws.

This PR is what makes that reachable from a request. Deriving an endpoint's interfaces
used to happen only on the flow-log scheduler, where a throw was contained; it now also
happens while rendering CreateVpcEndpoint and DescribeVpcEndpoints, so the same odd subnet
turns into a failed EC2 response rather than a degraded address. Measured, with the guard
removed:

  Unhandled error dispatching Query action CreateVpcEndpoint for service ec2:
  java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1

Falls back to the same default the existing null-CidrBlock branch already uses, so "no
usable IPv4" has one behaviour instead of two. Deliberately NOT fixed by validating in
CreateSubnet: rejecting a non-IPv4 CidrBlock is what AWS does and is probably right, but
it is a behaviour change with a wider blast radius than this PR should carry, and it would
not help an IPv6-only subnet, which legitimately has no IPv4 CIDR at all.

anEndpointOnASubnetWithoutIpv4StillAnswers is a regression guard and states so. Measured
both ways: it FAILS at CreateVpcEndpoint without the guard and PASSES with it. Reviewer
found the defect by reading; the test is what keeps it found.

P2. Import order -- io.restassured sorts before jakarta. I reordered the first two imports
in an earlier commit and did not notice the same rule applied further down the block.

Ec2VpcEndpoint* and FlowLogServiceTest: 52 tests, 0 failures.

* fix(ec2): the non-IPv4 fallback gave every subnet on an endpoint the same address

Second Greptile round on #4598, and a defect introduced by the fix for the first.

The crash fix fell back to a CONSTANT network, 172.31.0.0. The host octet is derived from
the ENDPOINT, so it is identical across that endpoint's interfaces; on the IPv4 path the
only thing making them distinct is each subnet supplying its own network. Collapsing the
network to a constant threw that away, so every non-IPv4 subnet on one endpoint got the
same private address -- a crash traded for a silent collision. Measured:

  got [172.31.0.249, 172.31.0.249]

The third octet now comes from the subnet id, restoring the property the IPv4 path has by
construction rather than by luck. The ENI ids were never affected -- endpointEniId already
mixes the subnet in -- and the new test asserts both, so a later change cannot fix one and
break the other.

twoSubnetsWithoutIpv4GetDistinctAddresses measured both ways: it FAILS on the constant
fallback with the collision above and PASSES with the subnet-derived one. The existing
non-IPv4 test could not have caught this: it uses a single subnet, where a collision has
nothing to collide with.

Ec2VpcEndpoint*, FlowLogServiceTest, Ec2ServiceTest, Ec2NetworkInterfaceIntegrationTest:
264 tests, 0 failures.

* test(compat): validate the endpoint's network interface ids through the Java SDK

Greptile's P2 on #4598. The integration test asserts the wire element over RestAssured,
which is deliberate -- an absent networkInterfaceIdSet and an empty one are different
things and only raw XML can tell them apart. But AGENTS.md's "Management APIs should be
validated with AWS SDK clients, not only handcrafted HTTP requests" sits under AWS Protocol
Rules, not under Compatibility Project, so it is general and "not only" is the operative
phrase. Both, not either.

src/test cannot host it: the main module has no AWS SDK dependency at all. sdk-test-java is
where the repo keeps SDK validation and already had 60 EC2 tests, covering
DescribeVpcEndpointServices but not an endpoint's own interfaces.

What this proves that the XML assertions cannot: that the real Java SDK DESERIALIZES the
element into networkInterfaceIds(). A response can be well-formed XML and still not populate
the model -- a wrong element name or nesting fails silently and leaves an empty list rather
than raising, which is the exact symptom this PR fixes.

Asserted on CreateVpcEndpoint and again on DescribeVpcEndpoints, and that the two agree,
because Terraform reads from one and re-reads from the other between plan and apply.

DeleteVpc moves from @Order(50) to @Order(51) so this runs while the shared VPC still
exists.

* fix(ec2): an endpoint's published interface ids have to resolve too

Blocking finding from hectorvent on #4598, and the gap it names is one this branch
filed as separate work (floci-5wby) on reasoning that turns out to be wrong.

DescribeVpcEndpoints publishes one ENI id per subnet in networkInterfaceIdSet.
describeNetworkInterfaces enumerated instance-attached interfaces and the standalone
CreateNetworkInterface store only, never endpointNetworkInterfaces, so asking about a
published id got InvalidNetworkInterfaceID.NotFound from the same emulator that had
just handed it over.

WHY IT CANNOT SHIP SEPARATELY. The bead argued no corpus module writes
data "aws_network_interface", so nothing resolves one. The corpus check was right and
the conclusion was wrong: the provider does the lookup ITSELF, inside its own read of
aws_vpc_endpoint. resourceVPCEndpointFlatten calls
findSubnetConfigurationsByNetworkInterfaceIDs over every id in network_interface_ids to
build subnet_configuration, and returns the lookup error rather than tolerating a
NotFound -- it handles retry.NotFound for the prefix list a few lines above and
pointedly does not here. So the blast radius is not "modules that look up an ENI", it is
every interface endpoint read. Publishing the ids without this turns an empty list on
main into a hard read failure, which is a regression against main rather than a
pre-existing gap left unfixed.

Endpoint interfaces now answer describeNetworkInterfaces: listed unfiltered, resolvable
by id, and selectable by interface-type, subnet-id and vpc-id. interface-type had no arm
at all, so it matched everything through the default; requester-managed is new alongside
it.

WIRE SHAPE. interfaceType vpc_endpoint and requesterManaged true, which is what AWS
reports for an interface it creates on the customer's behalf, and requesterManaged is now
emitted for every interface, false included, as the documented sample response does.
requesterId is left unset on purpose: real AWS reports an internal service account there,
which floci cannot know, and an invented twelve-digit id would be a wrong answer rather
than a missing one. No attachment block, for the same reason -- AWS reports one carrying
an AWS-side owner alias that would have to be fabricated, and the provider reads none of
it.

The new arm is deliberately NOT account-scoped, unlike the two above it. describeVpcEndpoints
is not account-scoped either, so scoping here would leave an id that IS published to a
caller unresolvable BY that caller -- the exact defect being closed. Its ids are added to
foundIds before the filter check, matching the other arms, so an id asked for by name and
then excluded by a filter is absent from the answer rather than NotFound.

Measured both ways at 1608dc7. Before: 5 of the new class's 6 tests fail, the id lookup
answering

  <Code>InvalidNetworkInterfaceID.NotFound</Code>
  <Message>The network interface ID 'eni-787c7b66a5503789b' does not exist</Message>

for an id DescribeVpcEndpoints had just published. After: 6 of 6 pass. The sixth is the
guard that an id which was never published still does not exist, and it passes both ways --
a store that resolves everything would satisfy the other five.

Ec2VpcEndpoint*, Ec2NetworkInterfaceIntegrationTest, FlowLogServiceTest, Ec2ServiceTest,
Ec2IntegrationTest, plus the two internal describeNetworkInterfaces callers
(EcsFargateTaskIntegrationTest, EksVpcRouteProgrammingTest) and CloudControlIntegrationTest:
504 tests, 2 failures, both in Ec2VolumeBlockDeviceDockerIntegrationTest and both measured
failing identically on this head with the change reverted -- a loopback mount inside the
container returning EINVAL on this machine, which no ENI path reaches.

* docs(ec2): drop the private tracker ids from shipped source

Second point on #4598: floci-5vs is an id in a private tracker, so an upstream reader
cannot resolve it. The sentence it sat in stands on its own -- the parenthetical was
the only part carrying the dangling pointer.

Two more of the same kind, both introduced by the previous commit on this branch rather
than pre-existing: floci-5wby on the new describeNetworkInterfaces arm, and the same id
in the new test class's javadoc. The test keeps its floci-io/floci#4598 reference, which
is this PR and resolves for anyone reading it.

The PR's diff now adds no tracker-shaped id at all. Note that upstream main already
carries several on lines this branch does not touch -- floci-kt9 appears eleven times in
Ec2Service alone, plus floci-k41 and the floci-3wz the review cites -- so this is the
convention changing, not a slip being corrected, and the rest is left where it is rather
than widened into this fix.

Deliberately NOT the javadoc trimming the review asks for in the same breath. That was
sequenced as a separate follow-up PR and the branch-history lines it targets are a
different problem from an unresolvable id.

Comment-only. Ec2VpcEndpoint*, Ec2NetworkInterfaceIntegrationTest, FlowLogServiceTest:
89 tests, 0 failures.

* fix(ec2): an endpoint's interfaces carry its security groups, and own their owner

Third review round on #4598. One finding is real, one rests on a misreading I had
written into the code myself, and the correction runs the other way from what was asked.

SECURITY GROUPS -- the real one. An interface endpoint's security groups are enforced ON
its interfaces; that is the entire mechanism by which a PrivateLink endpoint is
firewalled, and AWS reports them in each interface's groupSet. Floci reported an empty
groupSet, so a group-id filter excluded the very interfaces the group is attached to.
The group name is best-effort: it is cosmetic, the id is what filters and rules match on,
and the lookup reads the caller's account while FlowLogService runs on the default one,
so a miss omits the name rather than inventing one.

ACCOUNT SCOPING -- the misreading, and it was mine. The previous commit justified leaving
this arm unscoped by asserting that describeVpcEndpoints is not account-scoped either,
citing its vpcEndpoints.scan(k -> true). That is wrong. Plain scan on an
AccountAwareStorageBackend filters to the caller's partition before the predicate runs:
k -> true selects every KEY within one account, not every account. The endpoint side was
scoped all along, and so is the subnet lookup inside endpointNetworkInterfacesOf, which
would yield no interfaces for a foreign endpoint even if one were reached. Two
independent layers, neither visible at the call site.

So the review's conclusion -- that this arm exposed other accounts' interfaces -- does
not hold, and neither did my stated reason for writing it that way. Measured rather than
argued: deleting an account filter from the describe arm changes no observable behaviour,
because the scoping is not there to begin with. The arm is therefore left as it was and
the COMMENT is corrected, since the comment was the defect.

ownerId is the part of that finding with a real kernel, and it is fixed: it now comes
from callerAccountId(), the account these interfaces were actually read under, instead of
from safeAccount. The explicit-account overload can set safeAccount to an account this
ambient-scoped arm cannot honour, and labelling a resource with an account it did not
come from is worse than either showing or hiding it.

Also: the not-found matcher is statically imported rather than inline-qualified, per
AGENTS.md.

TESTS. anEndpointInterfaceCarriesTheEndpointsSecurityGroups measured both ways -- it
FAILS with the group loop removed ("expected: <[sg-13d37d8313c325d98]> but was: <[]>")
and passes with it, and it asserts the group-id filter as well as the groupSet, since the
empty-groupSet bug satisfies neither. anotherAccountsEndpointInterfacesAreInvisible is
labelled in the source as what it is: a characterization test that passes with and
without an account filter, kept because it pins the behaviour a reviewer doubted rather
than the mechanism, and positioned to fail if either scoping layer changes.

Ec2VpcEndpoint*, Ec2NetworkInterfaceIntegrationTest, FlowLogServiceTest, Ec2ServiceTest,
Ec2IntegrationTest, EcsFargateTaskIntegrationTest, EksVpcRouteProgrammingTest,
CloudControlIntegrationTest: 499 tests, 0 failures.

* test(compat): the endpoint SDK test creates the fixtures it needs

The ordered suite shares mutable fixtures, so what exists at a given point is a function
of position. @Order(44) deletes the shared subnet and sets subnetId to null and
@Order(45) deletes the shared security group, both before this @Order(50) test ran: it
was passing a null subnet id to CreateVpcEndpoint and asserting groups() was non-empty
while supplying no group at all.

It now creates its own subnet and security group, uses them, and deletes them in the
same finally block that already removed the endpoint.

Worth noting why neither half failed loudly enough to catch earlier: compatibility-tests
is not a module of the root pom, so `./mvnw test` never compiles or runs it. Verified
here by building the module directly.

Authored by Allen; committed from the branch worktree alongside the review round.
2026-09-29 22:28:01 -04:00
Simone Primarosa c0ec98b43e feat(ec2): return spot price history for known instance types (#4698)
* feat(ec2): return spot price history for known instance types

* fix(ec2): address review feedback on spot price history pagination and platforms

* style(ec2): fix import ordering and inline qualified class names
2026-09-29 22:05:16 -04:00
XuJian 433893d298 feat(cognito): support software-token MFA setup and challenges (#4620)
* feat(cognito): require TOTP MFA after primary authentication

* test(cognito): verify TOTP MFA with Java SDK

* fix(cognito): reject disabled users completing TOTP challenges

* fix(cognito): preserve new-password trigger through TOTP

* fix(cognito): gate custom password auth with required MFA

* fix(cognito): limit failed TOTP verification attempts

* fix(cognito): report code mismatch for invalid TOTP setup
2026-09-29 19:43:09 -05:00
XuJian e6894119f4 fix(iam): populate PrincipalIsAWSService for signed requests (#4695)
* fix(iam): set PrincipalIsAWSService for signed IAM requests

* fix(iam): apply global conditions to additional resources

* fix(iam): accept JSON booleans in Bool conditions
2026-09-29 20:37:36 -04:00
Hector Ventura 43ed79d15b fix(core): service principals are universal in every partition; accept the legacy forms (#4633)
* fix(core): service principals are universal in every partition; accept the legacy forms

A service principal is <service>.amazonaws.com in every partition, the rule the CDK applies
(region-info.ts, principals.ts). Floci now emits it through ServicePrincipals.of: generated trust
policies, SAM's Lambda permissions, CloudTrail's eventSource, service-linked role paths (Macie,
GuardDuty, Connect, Application Auto Scaling, RAM, SSO) and the Redshift COPY trust check.

Policies may still name a service in the per-partition form AWS accepted before
(elasticmapreduce.amazonaws.com.cn, logs.cn-north-1.amazonaws.com.cn, config.c2s.ic.gov), and AWS
still honours them. ServicePrincipals.canonical folds a published DNS suffix and a regional label
away, and the trust-policy evaluator and CreateServiceLinkedRole compare in that form, so either
spelling matches.

DescribeVpcEndpointServices now lists China's S3 interface service, cn.com.amazonaws.<region>.s3,
beside the com.amazonaws gateway one, each with its own type; where the names agree it stays one
service carrying both types.

Partition literal baseline 34 -> 4 occurrences. The web-identity and pod-identity audiences keep
their commercial literals, escaped for the STS phase.

Part of #4272

* fix(iam): put a legacy-named service-linked role under the universal principal

CreateServiceLinkedRole derived the role name from the universal principal but kept the caller's legacy spelling (es.amazonaws.com.cn) in the path and the trust policy. All three now use the universal principal, so the role lists under /aws-service-role/es.amazonaws.com/ like one created from the universal name.

ServicePrincipals.canonical no longer lower-cases: service-principal matching is exact and case-sensitive since #4555, and AWS matches principals case-sensitively, so only a suffix written the way AWS publishes it folds.
2026-09-29 20:33:07 -04:00
Abhigya cea6d3e99f fix(s3): journal the object index under persistent storage (#4642)
* fix(s3): journal the object index under persistent storage

Under persistent mode every PutObject, CopyObject and DeleteObject
rewrote s3-objects.json in full, and that file holds the metadata of
every object in every bucket, so the cost of one write grew with the
total object count (two rewrites per write on a versioned bucket).

Create the object store with WriteProfile.APPEND_HEAVY, as CloudWatch
Logs events already are: a change is appended to s3-objects.wal and the
JSON file is rewritten on the WAL compaction interval and at shutdown.
An existing s3-objects.json is read as the first snapshot.

* fix(s3): journal both index entries of a current version's metadata update

A versioned put indexes the new object under its version key and the latest
key. Tagging, retention, legal hold, ACL and the SSE-C fields set on multipart
completion wrote back only one of the two. With the object index journaled,
each entry replays on its own, so a restart before compaction brought the
other entry back with the old metadata.

Write both entries when the update targets the current version. The restart
tests now shut down every factory and replay a copy of the stopped process's
directory, so no two writers share a journal.

* test(lambda): stub the WriteProfile overload for S3 stores in the stream poller test

* fix(s3): write object metadata under the bucket lock and the owner account

A metadata update checked whether the latest key still pointed at the object
and then wrote it without holding the bucket lock that puts and deletes take,
so a concurrent delete marker or overwrite could be replaced by the object it
had superseded. The check and both writes now run under that lock, and the
latest key is written only while it still refers to the updated object.

Multipart completion wrote the SSE-C fields back through the caller's account
partition, so with the global bucket namespace a cross-account completion
left a shadow latest entry and version in the caller's partition. It now goes
through the same helper with the bucket owner's account.
2026-09-29 19:18:51 -05:00
XuJian 600797db17 fix(tls): add key identifiers to local CA certificates (#4644)
* fix(tls): add key identifiers to local certificates

* test(tls): assert served certificate key identifiers

* style(tls): follow logging and import conventions
2026-09-29 19:18:37 -05:00
Simone Primarosa d1a9b50cf5 feat(ec2): resize volume backing files and loop devices on ModifyVolume (#4666) 2026-09-29 19:00:10 -05:00
Priamo Germosen a075e25290 fix(secretsmanager): require lambda:InvokeFunction for RotateSecret under IAM enforcement (#4697)
AWS requires the caller of RotateSecret to hold lambda:InvokeFunction on the rotation function as
well as secretsmanager:RotateSecret (Secrets Manager API Reference, RotateSecret, "Required
permissions"). Floci checked only RotateSecret and then invoked the function in-process, so under
IAM enforcement a caller refused lambda:InvokeFunction could still run any function it could name by
configuring it as a rotation function.

RotateSecret now authorizes the invoke for the same caller the filter evaluated, against the exact
function the rotation will run (the requested ARN, or the one already configured, with a bare name
or partial ARN resolved in the secret's account and Region), and the rotation then invokes that same
full ARN. Invoking the reference as given would let a name or partial ARN resolve in whatever account
the rotation thread sees, so the function checked and the function run could differ. The check runs
before the function is
looked up or the secret changed, so a refused call leaves nothing configured for the scheduled sweep
to invoke later. A refusal is reported as Secrets Manager reports one: AccessDeniedException with
HTTP 400 (API Reference, "Common Errors").

A rotation function that does not exist is now reported the way AWS reports it too:
AccessDeniedException, HTTP 400, "Secrets Manager cannot invoke the specified Lambda function. Ensure
that the function policy grants access to the principal secretsmanager.amazonaws.com.", with the
secret's rotation settings left as they were. It used to be ResourceNotFoundException with HTTP 404.

The caller credential reaches the handler through IamEnforcementFilter.requestAuthorization, the
filter's own header-or-presigned logic, so a presigned request is checked the same way. Requests
with no caller credential, such as API Gateway service integrations, and rotations started by the
scheduled sweep are unchanged. With IAM enforcement off the caller check does not run; the
missing-function response above applies either way.
2026-09-29 18:54:38 -05:00
mitsukado-shinagawaandmitsukado-shinagawa 7ff6a7cfa7 fix(stepfunctions): fail a .sync Task on its child with States.TaskFailed and the child's description (#4675)
* fix(stepfunctions): fail a .sync Task on its child with States.TaskFailed and the child's description

Measured on AWS (ap-northeast-1, 2026-09-29), six child endings under
both states:startExecution.sync and .sync:2: FAILED with a custom error
with and without a cause, FAILED with States.Timeout from a Task's own
TimeoutSeconds, FAILED with States.TaskFailed, TIMED_OUT, and ABORTED by
a StopExecution carrying an error and a cause. In every case the parent
Task fails with States.TaskFailed, and the cause is the child's
DescribeExecution response as JSON: PascalCase, keys in alphabetical
order, Cause and Error only when the child has them, dates in epoch
milliseconds, no Output.

Floci passed the child's own error and cause straight through, falling
back to States.TaskFailed and "Nested execution ended with status: X"
only when the child had none. The error name matched AWS in two of the
six cases and the cause in none, so a parent Catch on States.TaskFailed
missed a child that failed with its own error or timed out, and a Catch
on the child's error name fired where AWS never takes it.

Closes #4562

* fix(stepfunctions): read a nested child's terminal state consistently, and keep its alias and version

Review of #4675.

The poll read the child's status without the monitor its worker and
StopExecution write the terminal fields under (status last), so a
terminal status could be seen before the error, cause or stop date
behind it, and the cause built from a half-written child. The status is
now read under that monitor, which makes everything written before it
visible.

A child started through an alias or a version also carries
StateMachineAliasArn and StateMachineVersionArn in the cause, measured
on AWS (ap-northeast-1, 2026-09-29): an alias gives both, a version
only the version, each in its alphabetical place between StartDate and
Status.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-29 18:54:22 -05:00
mitsukado-shinagawaandmitsukado-shinagawa dc3beadf6a fix(stepfunctions): stop a .sync job whenever its Task is cut, and record the cut state (#4660)
* fix(stepfunctions): stop a .sync job whenever its Task is cut, and record the cut state

Measured on AWS (ap-northeast-1, 2026-09-29): Step Functions stops the
job a .sync Task waits on however the Task ends before the job does.
Besides the Task's own TimeoutSeconds and StopExecution, which #4519
covered, that is the execution's budget (child ABORTED, ECS task
UserInitiated, both at the budget) and a failure in a sibling Parallel
branch (both within about 0.1 s of the failure), always with the cause
"The Task state in AWS Step Functions execution [<arn>] which was
managing this resource was aborted". Floci left the job running in both
cases: the poll loops only stopped it on the Task's own timeout, and an
interrupt from a cut Parallel unwound through them untouched.

AWS also records the state each cut branch was in: one TaskStateAborted
per cut Task, or WaitStateAborted for a cut Wait, each chained to the
failing branch's last event and recorded before ParallelStateFailed,
which points at that same event. The Parallel now reads each branch's
current state before it cuts them and records those events with
HistoryChain.publishBeside. The execution's budget records none, as on
AWS.

Part of #4646

* fix(stepfunctions): read and cut a Parallel branch in one step

Review of #4660: the state a branch is in was published apart from the
event that enters or exits it, and read apart from the cut. A sibling
failure could therefore see a TaskStateEntered with no state marked and
record no TaskStateAborted, or mark a state that then exited before the
cut and record TaskStateAborted after its TaskStateExited.

HistoryChain now publishes the Entered and Exited events together with
the marker (publishStateEntered, publishStateExited), and the Parallel
reads and cuts each branch with abandonInState, all under the chain's
lock. A Task whose own failure ends its branch leaves the state and
records its TaskStateAborted in one step too (leaveStateAside), so a
concurrent cut reports it at most once. runState leaves the state in a
finally for the paths that end by throwing.

* fix(stepfunctions): let the cut branch's state alone decide its aborted event

Review of #4660: the cut read each branch's future after cutting it, so
a branch that finished in between had its Exited event suppressed by
the cut and its *StateAborted skipped by the isDone check, leaving a
state with neither. The future read is not needed: runState leaves
every state it entered before the branch returns, so a finished branch,
the failed one included, is always read as between states. The cut now
decides on the state it reads under the chain's lock and nothing else.

* test(stepfunctions): assert the parent's budget aborts a nested child over HTTP

StepFunctionsTimeoutSecondsIntegrationTest still said the child keeps
running when the parent's TimeoutSeconds fires, which this PR changes
to match AWS. The comment now says the child is aborted, and the test
asserts it through ListExecutions, so the change is covered end to end
and not only by the executor's unit tests.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-29 18:54:05 -05:00
Allen Sanborn b8aec4c50f fix(elasticache): serve a second cache asking for 6379 instead of refusing it (#4693)
* fix(elasticache): serve a second cache asking for 6379 instead of refusing it

CreateReplicationGroup answered a second cache on port 6379 with

  InvalidParameterValue: Port 6379 is already in use by another
  replication group.

AWS has no such rule. Port belongs to a cache's own endpoint, and 6379 is
the Redis default, so nearly every ElastiCache cluster uses it and they
coexist: AWS gives each cache a DNS name of its own and the port never has
to tell them apart. Floci puts every cache's proxy on one host, where a TCP
port is exclusive and the port IS the only thing that tells them apart. Any
module standing up two Redis clusters, and any suite running one per test in
parallel, failed at the second create.

A pinned port that is free and inside the proxy range is still honored. One
that is taken, or outside the range, now yields a port from the range rather
than a rejection, and that port is what the cache's endpoint reports.

The port a cache reports is always the port it is actually on. That is the
whole design, and it rules out the tempting alternative of reporting the
pinned port while listening elsewhere: the endpoint would then name a
DIFFERENT cache's listener, and a client following it reads the wrong
cache's data with no error at all. Measured, on a build that did exactly
that: two no-auth caches pinned to 6379, write through each, then read
through the second's advertised endpoint and get the FIRST cache's value,
from the host and from inside a container both. #4094 removed that same
failure from the restore path last week, where "the old endpoint then
reached an unrelated cache instead of failing cleanly".

What a caller gives up is the pinned port when Floci cannot serve it, which
terraform surfaces as a replacement-forcing diff on the next plan. A visible
difference, against a silent wrong answer: the create still succeeds, which
is what unblocks the modules.

The out-of-range rejection goes for the same reason. That range bounds what
this emulator may listen on and never bounded what AWS accepts. The only
rejection left is AWS's own, 1150 to 65535, as RdsService already applies.

Tests: the two that pinned the old rejections now pin the substitution, and
ElastiCachePortSharingIntegrationTest asserts at the DATA plane, writing
through each cache's own advertised endpoint and reading its own value back.
A control-plane-only test passes against the wrong-endpoint design too,
which is how that design survived review. ElastiCache surface: 214 tests,
0 failures.

Refs: floci-j55a

* test(elasticache): gate Docker per test, tie each endpoint to its own group

Five review points, no behaviour change. The service diff is the 1150 comment.

CORRECTING THE PREVIOUS COMMIT MESSAGE, which cannot be amended without a
force-push. It said a control-plane-only test "passes against the wrong-
endpoint design too, which is how that design got through four rounds". False
about this file: Order(2) compares the two REPORTED ports and requires them to
differ, and the withdrawn design reported 6379 for both, so it fails there
before anything connects. The general point stands, but not as stated. An
assertion about a SINGLE reported value cannot see a wrong-endpoint design,
because "the API says 6379" is satisfied whatever 6379 serves. An assertion
about a RELATIONSHIP between reported values often can. That is the
distinction, not control plane against data plane. Both javadocs said the
wrong thing and both are rewritten.

@BeforeAll gated the whole class on Docker, and only Order(6) needs it: a
group reaches available with no daemon reachable. On a Docker-less runner the
entire regression test for this fix would have vanished, silently and green,
including the control-plane assertion that catches the original bug. The
assumption now sits in Order(6) alone.

Order(6) claimed more than it proved. Writing "first" and "second" through the
two endpoints and reading each back passes under a consistent relabelling,
where each endpoint reaches a distinct cache that is not its own. Each group
now carries its own AuthToken and each proxy validates the token of the group
it was started for, so an endpoint reaching the other group's proxy is refused
its own group's token. The test AUTHs with its own token and requires the
other group's to be refused, which is what makes the method name true. Order(2)
stays: the two catch different things and neither subsumes the other.

Those refusal assertions check the proxy's actual error text, not the helper's
prefix, because a connection returning nothing would also fail to start with
"+OK" and must not read as a pass.

The docs section stated two rules as the service's that are false for
Memcached: CreateCacheCluster routes that engine to a path Port is not passed
to, so a pinned port is ignored and the 1150 check never runs. Scoped to
redis/valkey, with Memcached's behaviour stated. Third time on this work that
a Redis-path rule was written as though it covered the service.

The 1150 bound is no longer called AWS's own, in docs or javadoc. It is the
bound RdsService applies to the same argument; nothing here establishes
ElastiCache's real limit. It is strictly more permissive than the check it
replaced, so the risk is accepting a port AWS would refuse, never refusing one
AWS accepts. The upper arm was untested and now is.

ElastiCache surface: 215 tests, 0 failures, 0 skipped.

Refs: floci-j55a

* test(elasticache): stop the method name claiming the bound is AWS's

Two review points, both about claims rather than behaviour. The only
non-comment change in the diff is the rename.

aPortOutsideTheRangeAwsAcceptsIsStillRefused was the last place in the tree
still asserting that 1150 to 65535 is what AWS accepts, after the previous
commit removed that claim from the docs, the service javadoc and the unit
test. It is now aPortOutsideTheAcceptedRangeIsStillRefused, and its javadoc
says the bound is the one RdsService.reserveProxyPort applies to the same
argument, with nothing here establishing ElastiCache's real limit.

It survived a round that corrected the identical claim in three other places
because a method name does not present itself as prose. It is read far more
often than the body under it and re-read far less, which is true of a display
name, a bead title and a commit subject too.

Order(2) carried a one-line javadoc about the original bug, so a reader
landing there sees no reason it is not redundant against Order(6). It now says
what it catches that Order(6) cannot: comparing the two REPORTED ports is what
rejects a build reporting one port for both caches, it does so before anything
connects, and it still runs on a machine where Order(6) skips for want of
Docker. The non-subsumption was already stated in the class javadoc and in
Order(6)'s, which is not where someone doubting Order(2) is standing.

ElastiCache surface: 215 tests, 0 failures, 0 skipped. The renamed test is
present in the surefire report under its new name.

Refs: floci-j55a

* test(elasticache): SDK coverage for port sharing, and two test defects

Three Greptile findings on #4693, all in the tests. Verified live against
87d663e4e rather than trusting the stale marker: the single-read helper, the
absolute 6379 assertion and the absent SDK coverage were all still there.

SDK VALIDATION. AGENTS.md wants management APIs exercised through an AWS SDK
client, and src/test has no SDK dependency, so it cannot host that; the repo
keeps it in compatibility-tests/sdk-test-java. ElastiCachePortSharingTest goes
there. It proves what the RestAssured assertions cannot: that the substituted
port deserialises into the MODEL a caller reads, on the create response, on
the describe, and on the member cluster terraform follows. A response can be
well formed and still leave PrimaryEndpoint.Port null.

Self-contained by construction, after the shared-fixture trouble on #4598: its
own client, its own uniquely named groups, its own cleanup, no @Order coupling
and no fixture another class can tear down first.

Measured both ways rather than assumed. Against a build with the old refusal
put back, it fails with InvalidParameterValueException "Port 6379 is already
in use by another replication group"; against this branch it passes. An
assertion never seen red is not evidence.

PARTIAL READS. readReply did one in.read(), so a RESP reply split by TCP
misparsed. Theoretical over loopback until Order(6) went from four round trips
to six, and it fails against a WORKING proxy, which makes it a flakiness
source rather than a correctness bug. A flaky test in a regression suite is
worse than no test: it teaches people to re-run. It now reads a line at a time
and honours a bulk string's declared length.

THE FIRST PORT IS NO LONGER ASSUMED FREE. Order(1) required 6379 exactly. If
another class in the shared Quarkus instance holds it, substitution is the
feature working correctly, and the test would have failed on that before
reaching what it exists to check: broken by the code behaving as designed. It
now records whatever port comes back and asserts the relationship, which is
what the class is about anyway.

ElastiCache surface: 215 tests, 0 failures, 0 skipped. SDK suite: the new
class passes against a running emulator.

Refs: floci-j55a

* test(elasticache): guard the data-plane test with the service's own Docker check

The assumption gating Order(6) shelled out to `docker info`. Floci reaches its
daemon through DockerClientProducer, which resolves the endpoint from the
active Docker context rather than the platform default, so on a machine using
an OrbStack socket, or with no docker CLI installed, the guard can fail while
the client that actually starts the containers works.

It now calls ElastiCacheContainerManager.isDockerReachable(), which is the
method the service itself uses to tell a missing daemon from a container that
failed for its own reasons, pinging the same DockerClient bean the caches are
started with. Not a second check that happens to agree: the same one.

This is the failure mode worth spending a commit on. Order(6) is the only
data-plane assertion in the class, and it is the only thing standing between
us and an unverified endpoint-identity property now that the guard sits on it
alone rather than on the whole class. A guard that fires spuriously deletes
exactly the test the class exists for, and leaves a green run behind. Every
other defect on this branch was caught by somebody reading the code; a
spurious skip is invisible to that.

It is also the shape of most of the findings here: the check and the thing it
checks used different mechanisms. The docker CLI is not the connection under
test, a single read() is not a RESP reply, and 6379 is not the port a cache is
necessarily on.

ElastiCache surface: 215 tests, 0 failures, 0 skipped, with Order(6) present
in the surefire XML and no skipped tags.

Refs: floci-j55a

* test(elasticache): name the SDK model types the port test validates

AGENTS.md wants explicit types at call sites so the AWS models under
validation are visible, and three response values in the new SDK test were
var.

Not only style here. The reason that class exists is that a response can be
well formed and still leave PrimaryEndpoint.Port unset in the model a caller
reads, so the model types ARE the subject: var hid
CreateReplicationGroupResponse, DescribeReplicationGroupsResponse and
DescribeCacheClustersResponse at exactly the three places a reader checks what
is being deserialised.

Refs: floci-j55a
2026-09-29 18:47:50 -04:00
XuJian a247b68abb fix(s3): include bucket name in bucket-scoped errors (#4624)
* fix(s3): include bucket name in bucket-scoped errors

* fix(s3): preserve multipart precondition error details

* fix(s3): include CORS bucket name in error response
2026-09-29 16:57:18 -04:00
Goooooooooody 90c55114f9 fix(appconfig): resolve AppConfigData identifiers by name as well as ID (#4661)
* fix(appconfig): resolve AppConfigData identifiers by name as well as ID

StartConfigurationSession looked the application, environment and profile
up by ID only. AWS accepts either, and the AppConfig agent and Lambda
extension are normally given names, so they got ResourceNotFoundException
against Floci. Resolve each identifier by ID first, then by name.

* fix(appconfig): prefer an exact ID over a name and skip nameless resources

Resolve each AppConfigData identifier with a direct ID lookup first (kept
within the parent application), so an ID is never shadowed by another
resource's name and legacy unprefixed keys stay reachable; only a miss
scans by name, and the name match is null-safe.

* fix(appconfig): answer a missing session identifier with ResourceNotFoundException

An omitted or null Application, Environment or ConfigurationProfile
identifier reached the name fallback and threw a NullPointerException.
It now returns ResourceNotFoundException, as the direct lookups did.

* style(appconfig): brace the null-identifier guards

* fix(appconfig): reject a missing session identifier with BadRequestException
2026-09-29 16:49:27 -04:00
Sam Fakhreddine e6d22e8bcf fix(lambda): validate enum and pattern-constrained request fields (#4611)
* fix(lambda): validate enum and pattern-constrained request fields

CreateFunction, UpdateFunctionConfiguration, PublishLayerVersion, the event source mapping calls, and the function URL calls now reject values outside the botocore Runtime/Architecture/FunctionResponseType/FunctionUrlAuthType/InvokeMode enums and the Role/Handler/KMSKeyArn/LayerVersionArn/Alias/Arn patterns (including AWS-managed awslayer ARNs and eusc- regions), and ListEventSourceMappings honors its EventSourceArn filter. Constraint failures use ValidationException, matching the existing pattern checks in LambdaArnUtils.

* fix(lambda): validate KMSKeyArn on update, alias names, event source ARNs, and PackageType

Adds KMSKeyArn pattern on UpdateFunctionConfiguration, alias name pattern and length on Create/UpdateAlias, EventSourceArn pattern on CreateEventSourceMapping, and PackageType enum on CreateFunction.

* fix(lambda): accept every botocore NamespacedFunctionName in ListEventSourceMappings

Add eusc- region, dotted names and $LATEST.PUBLISHED to the function name pattern.

* fix(lambda): reject non-list members and validate before mutating on update

UpdateFunctionUrlConfig now validates AuthType and InvokeMode before applying
either, so a rejected request leaves the stored config unchanged. A non-list
Layers, CompatibleRuntimes or CompatibleArchitectures is a SerializationException
instead of being read as absent. Get and DeleteFunctionUrlConfig enforce the
FunctionUrlQualifier constraint, UpdateFunctionConfiguration enforces the 256
character Description limit, and an empty or missing alias name is rejected.
2026-09-29 16:07:56 -04:00
vamsiakandVamsi Akavarapu 0383ecf53e fix(apigateway): resolve AWS variables on REST import (#4547)
* fix(apigateway): resolve AWS variables on REST import

* fix(apigateway): preserve OpenAPI mapping templates

* fix(apigateway): resolve imported authorizer variables

* chore(ci): retry Docker Hub limited tests

* fix(apigateway): resolve import variables across definitions

* test(apigateway): cover variable imports with AWS SDK

* refactor(apigateway): remove unused import validation region

* style(apigateway): sort OpenAPI parser import

* fix(apigateway): preserve imported authorizer merge behavior

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-29 15:32:17 -04:00
Mario Toffia 86c4904bcc fix(ssm): resolve Secrets Manager references in GetParameter (#4581)
* fix(ssm): resolve Secrets Manager references in GetParameter

GetParameter and GetParameters now answer
/aws/reference/secretsmanager/<secret-id>[:<version-id-or-label>] from
Secrets Manager, with the checks, error texts and response fields
measured against AWS: WithDecryption must be true, a missing secret is
ParameterNotFound, and GetParameters lists a reference it cannot answer
in InvalidParameters. ECS task secrets and CodeBuild parameter-store
variables read through the same path; a CloudFormation
AWS::SSM::Parameter::Value<String> parameter still refuses one, as on AWS.

* fix(ssm): check secretsmanager:GetSecretValue on a Secrets Manager reference

AWS reads /aws/reference/secretsmanager/ with the caller's own
secretsmanager:GetSecretValue, checked before the secret is looked up.
With IAM enforcement on, a caller allowed only ssm:GetParameter now gets
the ValidationException AWS sends, and GetParameters fails as a whole.

* fix(ssm): authorize a Secrets Manager reference on the secret's ARN

A grant on a secret's exact ARN, which CDK grantRead and a CloudFormation
Ref produce, did not match the suffix-less name ARN, so an allowed caller
was refused. The check now uses the secret's ARN and falls back to the
name only when the secret does not exist.

* fix(ssm): check a Secrets Manager reference's value on the secret it came from

The value is read by name after the check, so a secret force-deleted and
recreated in between was returned on the old secret's grant. The ARN of
the secret actually read is now checked too.

* fix(ssm): read a Secrets Manager reference's value from the secret it described

* docs(ssm): note the partial-ARN fallback a Secrets Manager reference read leaves

* fix(ssm): return SourceResult on a Secrets Manager reference

* fix(ssm): reject a malformed Secrets Manager reference before checking IAM

* chore(ssm): sort SsmService imports
2026-09-29 14:57:11 -04:00
Abhigya 014156a546 fix(ecs): register reachable task addresses in Cloud Map and bound synthesised ENI addresses (#4509)
* fix(ecs): register reachable task addresses in Cloud Map and bound synthesised ENI addresses

ECS service discovery registered an awsvpc task's ENI address, but task
containers never join the subnet's network, so peers resolved a name and
then timed out. Register the address the task container holds on its
Docker network instead, falling back to the ENI address only when there
is no running container.

The synthesised private-address fallback in EC2 counted past the subnet
CIDR (10.70.1.549) and restarted at .10 on every boot. It now allocates
inside the subnet CIDR, skips the AWS-reserved addresses and every address
a persisted ENI, instance or NAT gateway still holds, and reports
InsufficientFreeAddressesInSubnet when the subnet is full.

* fix(ec2): hold the synthesised-address lock until the resource is persisted

The allocator chose a free address under its lock but released it before the
network interface, instance or NAT gateway holding the address was stored, and
it decides what is free from stored resources. Two concurrent creates could
both take the same address, most visibly at the end of a /28 where the cursor
clamps back onto the last one handed out.

A dedicated lock now covers allocation through persistence at each caller:
CreateNetworkInterface, CreateNatGateway and the RunInstances loop, where it
is taken inside imageRegistryLock.

* fix(ecs): advertise the container port for an awsvpc task registered at its container address

* docs(ecs): state which Cloud Map address and port each network mode registers

* fix(ecs): look for stale Cloud Map instances at an awsvpc task's container address

The registrar registers an awsvpc task at the address its container holds on
its Docker network, but the eviction from #4513 resolved the task's addresses
through resolveContainerHost, which is 127.0.0.1 when Floci runs natively, so a
stale instance at the container address was never found. Load balancer target
eviction is unchanged, since targets are still registered through
resolveContainerHost.

* refactor(ec2): nest the address allocation lock visibly inside runInstances

Scope privateIpAllocationLock to the instance-building loop, the only part that
allocates and persists addresses, and indent it under imageRegistryLock.

* fix(ec2): allocate a launch's addresses before storing any of its instances

A RunInstances larger than the subnet's free addresses failed with
InsufficientFreeAddressesInSubnet only after the instances that fit had been
stored with their root volumes. The launch now allocates every address first,
counting the ones it has already picked as taken, and releases any Docker
leases it took when the subnet runs out.
2026-09-29 14:36:28 -04:00
Simone Primarosa b2d668d9ae fix(eks): stop mirroring cluster audit logs to the Floci console (#4589)
* fix(eks): stop mirroring cluster audit logs to the Floci console

* docs(eks): clarify audit stream console flag

* fix(eks): scope console flag to audit exec stream

* test(eks): reuse shared log capture helper
2026-09-29 14:27:48 -04:00
Aniket Shukla ef08877837 fix(eks): isolate capacity backups from live clusters (#4663) 2026-09-29 14:25:29 -04:00
XuJian 78c06239be feat(sns): support SMS account preferences (#4597)
* feat(sns): support SMS account preferences

* fix(sns): include result element in SetSMSAttributes response

* fix(sns): validate SMS sender IDs and cover JSON updates

* refactor(sns): centralize SMS preference storage key
2026-09-29 14:20:34 -04:00
TiM 18ef1f58e9 fix(s3): honour If-Match on DeleteObject and the ETag element on DeleteObjects (#4526)
* fix(s3): honour If-Match on DeleteObject and the ETag element on DeleteObjects

A conditional delete was ignored: DeleteObject with a stale If-Match answered
204 and deleted the object, and a DeleteObjects entry carrying a stale <ETag>
was reported under <Deleted> and removed. S3 treats both as preconditions.

The precondition is evaluated against the current version of the key, as S3
documents, including when versionId addresses an older version. A matching
ETag (or *) proceeds; a mismatch answers 412 PreconditionFailed and leaves the
object in place; a missing key or a current delete marker answers 404 NoSuchKey.
In DeleteObjects each entry is checked on its own and a failure is reported
under <Error> while the rest of the batch proceeds.

The check runs under the bucket monitor that PutObject's conditional write
already holds, so an overwrite cannot land between the check and the delete.

* fix(s3): require s3:GetObject for a conditional delete by ETag

An ETag condition on DeleteObject, or an <ETag> element in DeleteObjects,
tells the caller whether the object still has that ETag, so S3 requires
s3:GetObject alongside s3:DeleteObject for it. The If-Match: * existence
check needs only s3:DeleteObject. DeleteObjects reports a refused entry
under <Error> as AccessDenied and deletes the rest.

* fix(s3): require s3:GetObject for an ETag-conditional delete under IAM

The bucket-policy check added earlier left the IAM identity-policy layer
alone, so an IAM user allowed s3:DeleteObject but not s3:GetObject could
still delete by ETag. IamEnforcementFilter now authorizes that read for a
DeleteObject whose If-Match is an ETag, the way it already does for a
conditional PutObject. If-Match: * still needs only s3:DeleteObject.

* fix(s3): limit the IAM conditional-delete read to DeleteObject

AbortMultipartUpload is also a DELETE on an object key filed under
s3:DeleteObject, and it has no object ETag to compare, so an If-Match on it
must not ask for s3:GetObject. The read is now required only when the DELETE
carries no subresource besides versionId.

* fix(s3): skip the IAM delete read only for routed subresources

Allowing only versionId as a query key let any other parameter bypass the
check, including the x-id=DeleteObject SDKs add and the X-Amz-* parameters of
a presigned URL, while the controller still handled the request as a
conditional DeleteObject. The read is now skipped only for the subresources
S3Controller routes elsewhere: uploadId, tagging and annotation.

* style(s3): import XmlPath in the conditional-write test

* docs(s3): record why a delete marker answers 404 on a conditional delete

The conditional-deletes guide says 412, real S3 answered 404 when measured. The comment keeps the next reader of the guide from flipping it back.
2026-09-29 11:44:08 -04:00
XuJian 95cbe7de34 feat(appsync): execute VTL pipeline resolvers on sidecar (#4586)
* feat(appsync): execute VTL pipeline functions

* fix(appsync): validate VTL functions before early return
2026-09-29 11:36:27 -04:00
TATSUNO “Taz” Yasuhiro 1465251e0c fix(dynamodb): reject a request member of the wrong JSON type (#4636)
* chore(dynamodb): vendor the input shapes of botocore's DynamoDB model

tools/aws/regen_dynamodb_shapes.py keeps each operation's input shape and
the type of every shape it reaches, from the pinned botocore release.
make aws-data-sync regenerates it and make aws-data-check keeps it in sync.

* fix(dynamodb): reject a request member of the wrong JSON type

DynamoDB answers a member of the wrong JSON type with a
SerializationException before it runs the operation, such as
"NUMBER_VALUE cannot be converted to String" for a number BillingMode or
IndexName. The message names the JSON token and the Java type, or says
"Unexpected field type", "Unexpected value type in payload",
"Start of structure or map found where not expected" or "UnknownError"
by where the value sits. The first bad member in body order is reported.
A JSON null counts as absent and an unknown member is ignored.

Floci now checks every DynamoDB JSON request against the vendored input
shapes. A number in an ExclusiveStartKey S value is one of these errors on
AWS, so that test now expects the SerializationException.

* fix(dynamodb): keep provenance out of the shapes freshness check

The shapes file now carries its provenance in a _source block, like the
other vendored AWS data, and --check compares it without that block. A
run against --botocore-data or a local checkout no longer reports the
file as stale when only the botocore label differs.
2026-09-29 11:18:40 -04:00
Aniket Shukla 33617e340d fix(iam): match condition values case-sensitively (#4672)
* fix(iam): match condition values case-sensitively

* chore(ci): retry transient registry pull failure
2026-09-29 11:05:26 -04:00
Aniket Shukla 970bdf2e54 fix(iam): return protocol-correct access-denied statuses (#4673)
* fix(iam): return protocol-correct access-denied statuses

* chore(test): alphabetize IAM enforcement imports
2026-09-29 10:52:39 -04:00
Aniket Shukla 9ae71eceda fix(rds): recover metadata after backend startup failures (#4532)
* fix(rds): recover metadata after backend startup failures

* fix(rds): restore control-plane and member retry relays

* fix(rds): isolate member relay recovery failures

* fix(rds-data): retry member relays for running clusters

* fix(rds-data): avoid locking healthy cluster resolution
2026-09-29 08:08:43 -04:00
Abhigya e8b768382a fix(lambda): apply FunctionResponseTypes on UpdateEventSourceMapping (#4584)
* fix(lambda): apply FunctionResponseTypes on UpdateEventSourceMapping

UpdateEventSourceMapping ignored FunctionResponseTypes, so turning
ReportBatchItemFailures on or off for an existing mapping succeeded but
changed nothing: GetEventSourceMapping kept the old list and the pollers
kept retrying whole batches. Apply the member when present, sharing the
create path's parsing; an empty list clears it.

* fix(lambda): validate FunctionResponseTypes on event source mappings

AWS accepts at most one FunctionResponseTypes entry, and only
ReportBatchItemFailures. Reject anything else with
InvalidParameterValueException on both CreateEventSourceMapping and
UpdateEventSourceMapping instead of storing it.

* fix(lambda): validate every UpdateEventSourceMapping member before applying any

A request that failed on a later member (FunctionName in another region,
empty Topics) still changed the members parsed before it on the stored
mapping, which the pollers share. A JSON null FunctionResponseTypes is now
an absent member, and a non-array value is a SerializationException rather
than silently clearing ReportBatchItemFailures.

* fix(lambda): honour ReportBatchItemFailures on Kinesis event source mappings

The Kinesis poller checkpointed the whole batch after a successful invoke,
so records the function reported in batchItemFailures were never retried.
It now checkpoints just before the lowest reported record and retries the
whole batch on a malformed response, matching the DynamoDB Streams poller.
2026-09-29 08:00:57 -04:00