Commit Graph
1025 Commits
Author SHA1 Message Date
Kenshin Okinaka ddfea8b161 docs(ses): describe how v2 boolean members are read (#4967) 2026-10-02 18:52:55 -04:00
Priamo Germosen b679fe2312 fix(s3): match a bucket policy's Principal the way IAM does in S3's own checks (#4961)
Follow-up from the reviews of #4838 and #4839.

S3 checks a bucket policy itself in two places, and neither matched its
Principal the way the IAM evaluator does since #4839:

- The signed-request check (s3.enforce-auth) passed the caller to the IAM
  evaluator as a bare ARN, so a role session was matched through a role ARN
  rebuilt from the session ARN, which drops the role's path. A bucket policy
  naming role/team/App never reached that role's sessions.
- The CopyObject/UploadPartCopy source check used S3's own matcher, which
  compared each AWS entry with the caller's ARN as a string. A grant to the
  caller's account, by id or root ARN, or to its role, never matched, so a
  cross-account caller allowed to read an object could not copy it.

Both now pass the typed caller to the IAM evaluator, a role session with the
ARN of the role it assumed, through a RequestPrincipal.caller factory the
enforcement filter now uses too. The copy check's own matcher is gone: its
direct-grant rules (an exact user ARN, or "*" with aws:PrincipalArn pinned to
it) are the IAM evaluator's, and the unit tests that pinned them there move to
IamPolicyEvaluatorTest. S3PublicAccessEvaluator keeps its principal matching
for CloudFront's origin access identity check.

A CanonicalUser entry matched nothing since #4839, and docs/services/iam.md
described that as AWS behaviour. The IAM User Guide ("AWS account principals")
lets an S3 bucket policy name an account by its canonical user ID, which the
S3 User Guide describes as an obfuscated form of the account ID. It now
matches the IAM identities of that account, as an account principal does.
Floci's canonical ID for an account is its account id, the owner ID its S3 ACL
responses report.

Integration tests (IAM and S3 enforcement, real SigV4) read and copy across
accounts under bucket policies naming the caller's account, a role under a
path, and the account's canonical ID; each fails on main. docs/services/iam.md
and docs/services/s3.md describe the matching.
2026-10-02 17:17:27 -05:00
Kenshin Okinaka bb3dd2de92 feat(ses): paginate the contact, dedicated IP pool, suppressed destination and receipt rule set lists (#4877)
* feat(ses): paginate the contact, dedicated IP pool, suppressed destination and receipt rule set lists

Page ListContactLists, ListContacts, ListDedicatedIpPools, GetDedicatedIps,
ListSuppressedDestinations and v1 ListReceiptRuleSets with the probed bounds
and messages. ListContacts serves 50 by default and receipt rule sets 100, the
figure the model documents; the lists whose default could not be measured
serve up to 1000. Where SES's own order is not stable Floci keeps the order
its unpaged lists already had. A suppressed-destination token is bound to the
reason filter and tenant it was taken with, as on SES.

* test(ses): isolate the contact paging compat test and cover v1 receipt rule set paging on the wire

The contact paging compatibility test cleared every contact list in the
account before and after it ran; it now runs as its own account and removes
only the list it created. A new integration test pages 101 receipt rule sets
through the Query API, where the earlier coverage only reached the service.

* docs(ses): note that SES lists receipt rule sets by name

Floci pages ListReceiptRuleSets in the creation order its unpaged list already
had; the paging paragraph now says SES lists them by name.
2026-10-02 17:10:06 -05:00
Allen Sanborn a4c952db54 feat(ec2): support Dedicated Hosts (AllocateHosts, DescribeHosts, ModifyHosts, ReleaseHosts) (#4816)
* feat(ec2): support Dedicated Hosts (AllocateHosts, DescribeHosts, ModifyHosts, ReleaseHosts)

terraform's aws_ec2_host failed at create with "Operation AllocateHosts is
not supported". Add the four host actions following the Capacity
Reservation pattern: region-scoped store, dedicated-host tags through
TagSpecification and CreateTags, released hosts kept in DescribeHosts with
state "released", and unknown ids as InvalidHostID.NotFound on describe.
ModifyHosts and ReleaseHosts answer per host, putting an unknown, released
or (on release) occupied host in the unsuccessful set rather than failing
the call.

RunInstances now honours Placement.HostId and Placement.Tenancy: the host
must exist, tenancy defaults to "host", the zone defaults to the host's,
and DescribeInstances reports placement.hostId. DescribeHosts lists the
instances placed on each host.

* fix(ec2): default AllocateHosts AutoPlacement to off and drop the non-AWS host-recovery filter

AWS documents AutoPlacement as defaulting to off; the host record defaulted it
to on. host-recovery is not a DescribeHosts filter in the EC2 API, so it is no
longer matched.

* fix(ec2): validate Dedicated Host zone, settings and launch placement, serialise release against launch

RunInstances now rejects a host placement whose zone, tenancy or instance type
contradicts the host, re-checked under a lock shared with ModifyHosts and
ReleaseHosts. AllocateHosts rejects unknown zones; on/off host settings are
validated on allocate and modify. The hosts store is final again, braces and
the Consumer import follow AGENTS.md, and the RunInstances mock matcher in
Ec2RunInstancesPublicIpParamTest gains the two host parameters.

* test(ec2): pin exact host placement error codes and the in-lock host re-check

* fix(ec2): validate AllocateHosts zone against modelled zones, import classes

* style(ec2): fix import order and hostLock indentation, match AWS occupied-host message

* style(ec2): put java.util.Arrays after the non-java imports in the dedicated host test

* style(ec2): brace the host tag update and host tag lookup conditionals
2026-10-02 17:18:58 -04:00
Allen Sanborn 5ad97781ef feat(kms): serve the AWS managed keys under alias/aws/* in every region (#4792)
* feat(kms): serve the AWS managed keys under alias/aws/* in every region

Every AWS account has a per-region AWS managed key for each service that
encrypts data on the account's behalf, published under a reserved
alias/aws/<service> alias. Floci had none, so a lookup that succeeds
against any real account failed here: DescribeKey on alias/aws/s3
returned NotFoundException and ListAliases returned nothing in that
namespace. Nothing declares these keys in a template, which is what made
their absence costly to diagnose. A module that leaves a service's
encryption at its default resolves one through a data source and fails at
plan time.

The catalog is data, in kms/aws-managed-keys.yaml, following the IAM
managed policy catalog: adding a service is a line there. A region's keys
are minted the first time anything reads that region's alias namespace,
which is ListAliases or a lookup naming one of the reserved aliases. That
mirrors AWS, where a service's key appears once the account first uses the
service, and it keeps an unused region free. Minting is idempotent, so the
ids survive a restart against persistent storage and ciphertext encrypted
under them keeps decrypting.

These are AWS's keys, not the account's, so DescribeKey now reports
KeyManager per key instead of the constant CUSTOMER it returned before,
GetKeyRotationStatus reports true for them, and the administrative
operations AWS reserves to a key's owner are refused with
AccessDeniedException: ScheduleKeyDeletion, CancelKeyDeletion,
PutKeyPolicy, UpdateKeyDescription, EnableKey, DisableKey,
EnableKeyRotation, DisableKeyRotation, RotateKeyOnDemand, TagResource and
UntagResource. The alias/aws/ namespace is reserved too: CreateAlias under
it is rejected with InvalidAliasNameException, and UpdateAlias or
DeleteAlias against one of these aliases with AccessDeniedException.
Cryptographic operations are unaffected, which is the point of the keys
existing.

Two deliberate simplifications, both documented: the key policy is the
standard account-root policy rather than the service-principal policy with
a kms:ViaService condition AWS attaches, and AWS distinguishes some of
those refusals as unsupported operations rather than access denials.

* fix(kms): seed only AWS managed keys, and rebuild them if the key store is lost

Five corrections to the alias/aws/* catalog and the code that mints it.

The catalog went from 40 entries to 23. An AWS managed key lives in the
customer's account and has an alias/aws/<service> alias; an AWS owned key
lives in an AWS-owned account and has no alias there, so DescribeKey on it
fails against a real account. Seeding the second kind makes a call succeed
here and fail against AWS, which is the worst error this emulator can
produce: a module looks compatible when it is not, and nothing reports it.
Seventeen entries could not be sourced to a customer-account context and
are gone, EKS among them, whose API-data envelope encryption uses an AWS
owned key by default. The YAML header now states the managed-versus-owned
test so the next line added has a bar to clear.

Minting is gated on the alias being present and the key that alias targets
being present, not on the alias alone. The two stores are different files
and PersistentStorage quarantines an unreadable one and starts that store
empty by itself, so a lost kms-keys.json used to leave every alias dangling
for the life of the instance: ListAliases advertised alias/aws/s3 while
DescribeKey on it reported NotFoundException. The catalog is in the
repository, so this is the one part of a damaged store that can rebuild
itself, and now it does.

ListKeys mints too. Real AWS returns the AWS managed keys from ListKeys
unconditionally, and a caller that reads ListKeys, then DescribeKey, then
filters on KeyManager saw them or not depending on whether something else
had read the alias namespace earlier in the same process.

Both stores are written once per region as a batch instead of once per
entry. PersistentStorage.put serialises the whole map, so the old path cost
two whole-file rewrites per catalog entry on the first read of every region,
while holding the mint lock. The aliases are written before the keys
deliberately: a crash between the two batches then leaves aliases whose
target is missing, which the gate above repairs, rather than keys with no
alias, which nothing repairs and which would sit in ListKeys forever.

CreateAlias and UpdateAlias no longer accept an AWS managed key as the
target. AWS excludes them, so a second alias on one of these keys is the
same false-pass shape as seeding a key AWS does not have. The refusal is
AccessDeniedException: it is an authorization outcome, the key's policy
grants the account nothing, and CreateAlias publishes no error code for
this case.

Two pre-existing tests asserted counts that ListKeys and ListAliases now
answer as AWS does; they select the customer-managed subset instead.

* docs(kms): group the AWS managed key catalog by the strength of its evidence

* fix(kms): drop alias/aws/elasticache and cite alias/aws/acm in the managed key catalog

The ElastiCache at-rest encryption guide describes the default as a
service managed key and serverless caches as using an AWS owned key; it
never names alias/aws/elasticache, so the entry failed the catalog's own
bar. The KMS ListAliases API reference prints alias/aws/acm with a
TargetKeyId in its example output, so acm joins the cited group.

* refactor(kms): fold requireCustomerManagedTarget into requireCustomerManaged

The two helpers had identical bodies. Also narrow the ensureAwsManagedKeys
Javadoc: writing aliases before keys helps only for a crash between the
two batches; losing kms-aliases.json alone still mints fresh keys and
orphans the old ones.

* fix(kms): refuse CreateGrant on AWS managed keys

An AWS managed key's policy allows kms:CreateGrant only via the owning
service (kms:ViaService), never to the account directly, so a direct
CreateGrant now gets AccessDeniedException like the other administrative
refusals.

* test(kms): concurrent cold reads mint each AWS managed key once

Sixteen threads read ListAliases on a cold region at once; the key store
must hold exactly the catalog's keys and each reserved alias must appear
once. Replacing the awsManagedKeyLock monitor with a fresh Object makes
this fail (138 keys minted against a 25-entry catalog).

* fix(kms): register the AWS managed key catalog for native and re-point squatted reserved aliases

- Add kms/*.yaml to quarkus.native.resources.includes. AwsManagedKeys reads
  kms/aws-managed-keys.yaml through a constant, which native resource
  analysis cannot follow (NativeImageResourceIncludesTest).
- Reconcile a reserved alias as present only when its target is an AWS
  managed key. A store persisted before alias/aws/ was reserved could hold
  alias/aws/s3 on a customer key, which DescribeKey then reported as
  CUSTOMER and the AWS managed key guards let through.
- When the alias store is lost but keys survive, re-alias the surviving
  AWS managed keys by description instead of minting a duplicate set.

* docs(kms): cite the sqs, sns, ses, s3 and ebs managed aliases
2026-10-02 17:09:12 -04:00
Simone Primarosa 548f4698c5 feat(eks): name cluster nodes after their EC2 instance (#4916)
* feat(eks): name cluster nodes after their EC2 instance

* fix(eks): prune legacy hostname nodes on finalize and test container recreation

* fix(eks): preserve active nodes when pruning legacy cluster nodes

* fix(eks): delimit jsonpath node records with newline outside condition range

* fix(eks): name nodes using EC2 private DNS name format and align synthetic instance

* fix(eks): implement DnsRecordSource to resolve node private DNS names

* fix(eks): prevent VPC forwarding rules from bypassing node private DNS resolution

* fix(eks): scope node DNS system rules to matching VPC only
2026-10-02 16:17:45 -04:00
danielxoi 73b8c6124c feat(lambda): bound the warm pool globally with LRU eviction (#4683)
* feat(lambda): bound the warm pool globally with LRU eviction

Adds warm-pool-max-per-function (replaces the hardcoded max(4, cpus)) and warm-pool-max-total (0 = unbounded). When the total would be exceeded, the least-recently-used idle container of any function is stopped before the released one is pooled, so the function that just ran keeps its container. Busy containers are not counted; their ceiling is region-concurrency-limit.

WarmPool now takes a Clock so LRU order and the idle sweep are testable without sleeping.

Closes #4682

* fix(lambda): warn when warm-pool-max-total is negative instead of treating it as unbounded

Math.max(0, value) turned -1 into 0, the documented opt-out, so a mistyped cap silently restored the unbounded pool. Resolve it like warm-pool-max-per-function: a negative value is logged and the total stays unbounded.

* docs(lambda): state the warm-pool peak bound per region

region-concurrency-limit applies independently in each region while warm-pool-max-total is emulator-wide, so a single sum understated peak container count with more than one active region. Describe the cap as an idle-only, emulator-wide bound and the peak as the cap plus in-flight invocations across every active region. Also document that a negative value is ignored with a warning.

* fix(lambda): do not stop a drained container again from the global cap eviction

evictIdleBeyond snapshots each idle deque, then removes the chosen handles under the pool lock. drainEnvironment and drainFunction detach the deque from the pool and stop its contents themselves, so a drain between the snapshot and the removal left the eviction holding the orphaned deque: remove(handle) still returned true and the container was stopped a second time. Check the deque is still the live one for its environment before removing from it.
2026-10-02 16:05:26 -04:00
Vũ Thế Huy 1d85e6bf6e fix(ecs): complete failed service deployment handling (#4874)
* fix(ecs): complete failed service deployment handling

* fix(ecs): address failed deployment review feedback

* fix(ecs): preserve rollback revisions across restarts

* fix(ecs): emit completion after service convergence

* fix(ecs): avoid duplicate completion events after upgrade

* fix(ecs): preserve completion event compatibility

* fix(ecs): read legacy deployment event state

* fix: report ECS rollback lifecycle and metadata

* fix: keep ECS deployment alarm metadata current
2026-10-02 14:09:33 -04:00
Vũ Thế Huy d7d2f73e99 feat(redshift): add external catalog statement parsing and metadata writers (#4679)
* feat(redshift): add external catalog statement parsing and metadata writers

* fix(redshift): harden external statement parsing and reference scanning

- Scanner: recognise dollar-quoted bodies, E'..\'..' strings and nested
  block comments; catch SELECT INTO, CREATE VIEW and CREATE INDEX writes;
  ignore FROM inside EXTRACT, SUBSTRING, TRIM and IS DISTINCT FROM.
- Parser: accept CREATE EXTERNAL SCHEMA IF NOT EXISTS, strip leading
  comments, support quoted names with dots, read TBLPROPERTIES and
  PARTITION values that contain parentheses or escaped quotes, validate
  IAM_ROLE as one quoted literal, and canonicalise Redshift type aliases
  to Hive types.
- Registry: percent-encode key parts so separators in identifiers cannot
  collide.
- Backend session: do not treat socket write failures as source read
  failures during COPY.
- Keep property order stable in statements.

* fix(redshift): address external catalog review findings

* fix(redshift): inherit omitted partition settings

* fix(redshift): preserve explicit empty partition settings

* fix(redshift): canonicalise character and varbyte external column types

* fix(redshift): default unsized character types

* fix(redshift): enforce Spectrum varchar default length

* fix(redshift): null surplus varchar values during Spectrum copy
2026-10-02 13:42:21 -04:00
Attila Kis 5de9b0d6c1 fix(dynamodb): match the AWS shape of the Kinesis destination responses (#4917)
DisableKinesisStreamingDestination now returns EnableKinesisStreamingConfiguration
with the precision the destination still carries, like AWS does.
Drop DestinationStatusDescription from the Enable and Disable responses. AWS carries
that member on DescribeKinesisStreamingDestination only, where it stays.
Build both responses from one snapshot taken while the call runs, so a concurrent
call on the same destination cannot change the status this answer reports.
Add an SDK compatibility test, because the SDK parses the typed response members
that handcrafted HTTP cannot check.
Document that Enable and Disable report the precision too.
2026-10-02 13:39:34 -04:00
vamsiakandVamsi Akavarapu 3ce093f208 fix(scheduler): validate expressions and target role ARNs (#4561)
* fix(scheduler): validate expressions and target role ARNs

* fix(scheduler): keep persisted weekly schedules firing

* test(scheduler): use valid role ARNs in SDK error cases

* fix(scheduler): validate rate units and format constraint errors

* fix(scheduler): match AWS validation message details

* fix(scheduler): exempt quoted model pattern from partition scan

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-10-02 13:28:09 -04:00
Sam Fakhreddine a833551d03 feat(codepipeline): emit EventBridge state-change events and SNS approval notifications (#4616)
* feat(codepipeline): emit EventBridge state-change events and SNS approval notifications

Publishes pipeline, stage, and action execution state changes to the default bus and notifies NotificationArn topics for manual approvals.

* fix(codepipeline): match the approval message and event timestamps to the user guide

Mint the pipeline ARN with AwsArnUtils.Arn.of, publish the approval notification as the pipeline's account, emit expires and start-time as ISO-8601, add externalEntityLink, drop the dead console links, truncate the SNS subject to 100 characters, and use warnv.

* fix(codepipeline): restore the approval console links and keep event timestamp precision

consoleLink and approvalReviewLink point at the AWS console URLs from the user guide, expires is to the minute, and start-time keeps its milliseconds. Terminal event dispatch uses switch expressions.
2026-10-02 11:53:44 -04:00
Simone Primarosa 86c06247e3 feat(eks): support per-cluster kubelet and API server arguments (#4772)
* feat(eks): support per-cluster kubelet and API server arguments

* fix(eks): prevent security group leak and reject authorization-mode override

* refactor(eks): classify authorization-mode as refused argument

* fix(eks): strip modifier suffixes before collision validation
2026-10-02 11:16:31 -04:00
David 044c700d68 feat(emr): scaling and termination policies and block public access (#4893)
Serve PutManagedScalingPolicy, GetManagedScalingPolicy,
RemoveManagedScalingPolicy, PutAutoTerminationPolicy,
GetAutoTerminationPolicy, RemoveAutoTerminationPolicy,
PutAutoScalingPolicy, RemoveAutoScalingPolicy,
GetBlockPublicAccessConfiguration and PutBlockPublicAccessConfiguration.

The managed scaling and auto termination policies are stored on the
cluster and the automatic scaling policy on its instance group, as the
JSON given. RunJobFlow and AddInstanceGroups accept the same policies
instead of dropping them, and ListInstanceGroups reports an attached
automatic scaling policy. Validation follows the API model: ComputeLimits
members and minimum not above maximum, IdleTimeout 60 to 604800 seconds,
automatic scaling only on core and task groups, port ranges within 0 to
65535. Block public access is kept per account and Region and starts at
the AWS default (public rules blocked, port 22 permitted).

The cluster mutators are synchronized, since each reads, changes and
stores the whole cluster.

Refs #4888
2026-10-02 10:37:45 -04:00
Priamo Germosen a5379cd5d8 fix(secretsmanager): refuse a rotation function in another Region with InvalidParameterException (#4873)
Follow-up from the review of #4768.

A well-formed full function ARN in another Region passed the reference check,
then Lambda's lookup refused it with InvalidParameterValueException ("Region
'us-west-2' in ARN does not match request region 'us-east-1'") and RotateSecret
rethrew that unchanged. InvalidParameterValueException is not an error
RotateSecret declares, so an SDK client could not type the refusal.

The Region is now checked with the rest of the reference, before the caller's
lambda:InvokeFunction check, and refused with InvalidParameterException and
Lambda's reason in the message, like a reference Lambda cannot parse. Checked
only at the lookup, it came after the caller check, so under IAM enforcement a
caller not allowed to invoke that ARN got AccessDeniedException for a reference
that is invalid whoever sends it. Any other 400 Lambda gives at the lookup is
mapped the same way, through one helper; a missing function is still
AccessDeniedException and anything else still passes through. The secret is
left as it was.

Neither the Secrets Manager User Guide nor the API Reference says which error a
function in another Region gets, or that the function must share the secret's
Region. InvalidParameterException is the one RotateSecret declares for an
invalid parameter value.

An integration test runs RotateSecret against the real Lambda service with a
us-west-2 function ARN from us-east-1; it fails on main with
InvalidParameterValueException. Unit tests check the Region refusal comes
before the caller check and keeps a previously configured function, and that a
Lambda 400 at the lookup maps too. docs/services/secrets-manager.md describes it.
2026-10-02 07:45:59 -05:00
Mario Toffia 3b1ac49f4f docs(lambda): correct CloudFormation and SAM event source mapping notes (#4739)
* test(lambda): qualify CloudFormation mapping execution

A stack-created SQS mapping now has a compatibility test that sends messages through it: the filter drops and deletes a nonmatching message, the batching window holds a batch open until a later message joins it, and a partial batch response retries only the reported message. The Lambda docs no longer claim CloudFormation drops FilterCriteria, and they describe SQS failure and partial batch handling.

* test(lambda): widen the mapping window margin and read every log page

The third message must join the batch while the window is still open, so a 10 second window leaves room for a stalled runner. FilterLogEvents can return a partial page with a token, so the batch log is read through the paginator.

* test(lambda): drop the stack-created SQS delivery test

SqsEventSourcePollerTest already pins the batching window, the filter and partial batch responses with an injected clock, so the wall-clock delivery test only added a race and long polls. The stored-property checks stay.
2026-10-02 08:40:02 -04:00
Hector Ventura 2170c89d88 fix(lambda): include the resource namespace in code volume names (#4872)
* fix(lambda): include the resource namespace in code volume names

Code volumes, their completion markers and the populate helper container are
named through prefixedDockerName, so FLOCI_DOCKER_RESOURCE_NAMESPACE follows the
container name prefix as it already does for Lambda containers. Two namespaced
instances on one daemon no longer share a code volume, and one's superseded-volume
cleanup can no longer remove the other's. Names are unchanged without a namespace.

* fix(lambda): keep two resource namespaces from sharing a code volume

Greptile and pgermosen on #4872: a namespace and a function name may both
contain dashes, so namespace ci with function foo-code-bar and namespace
ci-code-foo with function bar spelled the same volume name for the same code,
and the superseded sweep, which works from a per-process map of names, could
remove the other instance's volume. A namespaced code volume name now ends with
a short hash of the namespace (names without a namespace are unchanged), and the
sweep checks the volume's floci_namespace label before deleting, so a volume of
another namespace is left alone however its name parses.

Also imports the Mockito types in ContainerLauncherCodeVolumeReuseTest instead
of qualifying them inline.
2026-10-01 23:00:33 -04:00
Hector Ventura 24c655050f feat(docker): give internal Docker labels io.floci.* names and keep the old keys as aliases (#4871)
* feat(docker): give internal Docker labels io.floci.* names and keep the old keys as aliases

Owner, ECS run, credentials-proxy, security-group and VPC network labels move to
io.floci.owner, io.floci.ecs.run, io.floci.ecs.credentials-proxy,
io.floci.security-group.helper/workload, io.floci.component and the standard
resource-identity keys. The previous keys (floci_owner_port, floci.ecs-run,
floci.ecs-task-role-credentials-proxy, floci.security-group-*, floci.component,
floci_component, floci_vpc_id, floci_vpc_region, floci_vpc_owner_port) are still
written as legacy aliases with the same value.

Readers take the new key first and fall back to the legacy one, label filters
query both key sets, and owner-scoped cleanup leaves an object alone when the two
disagree. All alias keys are reserved from extra-labels.

VPC networks are now owned by ownerIdentity (namespace and port) instead of the
bare API port, so two namespaced instances on the same port no longer reconcile
each other's networks.

* fix(ec2): keep pre-upgrade VPC networks of a namespaced deployment its own

Greptile and pgermosen on #4871: a VPC network created before the owner label
took the resource namespace carries only floci_vpc_owner_port with the bare API
port, so with a namespace set the deployment read its own surviving network as
a CIDR collision and the startup sweep left it behind. Such a legacy-only
network is now this deployment's when it holds this port and its
floci_namespace label names this deployment's namespace, the identity the new
io.floci.owner key encodes. Matching the bare port alone would also claim, and
let the sweep delete, the pre-upgrade networks of another namespace on the same
port.

Also imports List in ContainerStorageHelperTest instead of qualifying it inline.
2026-10-01 22:59:57 -04:00
XuJian bcb50b765f feat(cloudformation): provision Transfer Family servers (#4809)
* feat(cloudformation): provision Transfer Family servers

* fix(cloudformation): clear Transfer update snapshot after success

* test(cloudformation): cover Transfer tag rollback

* fix(cloudformation): match Transfer server return values
2026-10-01 22:28:47 -04:00
Priamo Germosen 2bdfe45207 fix(iam): match a resource policy's Principal by the kind of caller it names (#4839)
IamPolicyEvaluator matched a resource policy's Principal against one string,
the caller's ARN, and compared every principal type other than AWS and "*"
with it by glob. So {"Service": "*"} and {"Federated": "*"} matched every IAM
caller: under enforcement a bucket policy granting {"Service": "*"}, a form AWS
does not accept at all, let an IAM user from any account read the bucket.
Services could not be passed as a caller at all, so {"AWS": "*"}, which AWS
itself relies on to cover services (an FIS Deny pausing DynamoDB replication
names the replication service that way), could not match one. And a role
session matched a Principal naming its role only through a role ARN rebuilt
from the session ARN, which drops the role's path, so a policy naming
role/team/App never matched that role's sessions.

A new RequestPrincipal carries the kind of caller (IAM, service, anonymous),
and for a role session the ARN of the role it assumed. Each principal type now
matches only the callers it can name (IAM User Guide, "AWS JSON policy
elements: Principal"): "*" anyone; {"AWS": "*"} IAM identities and services;
any other AWS entry IAM identities only, a role session matching through its
role's own ARN; {"Service": "<name>"} that service exactly; {"Service": "*"}
nothing; Federated and CanonicalUser never an IAM caller. NotPrincipal is typed
the same way. The direct-IAM-user branch and the aws:PrincipalArn stand-in for
a missing caller stay IAM-only.

A new evaluateResourcePolicyFor takes a RequestPrincipal; the existing String
evaluateResourcePolicy reads its argument as an IAM caller and delegates to it.
The typed method has its own name rather than being an overload of the same
arity, so a call passing a literal null caller to the String form still
compiles. A new
evaluateServicePrincipal decides a call a service makes on its own behalf from
the resource policy alone, since a service principal has no identity policy,
boundary or session policy and SCPs do not apply to it: Deny denies, Allow
allows, silence denies. Nothing calls it yet; the shared service-call
authorizer will.

The enforcement filter now passes the typed principal, with a role session's
role ARN from IamService.resolveCallerArns, to both resource-policy
evaluations. S3's own bucket-policy checks still go through the String
overload; giving them the role ARN follows the change that splits the two ARNs
there.

docs/services/iam.md describes the matching rules.
2026-10-01 21:18:26 -05:00
Priamo Germosen cd89be4a80 fix(codeartifact): treat identical-content maven redeploy as idempotent (#4837)
Reposilite's own redeployment:false setting rejects a redeploy to an
existing GAV path unconditionally, even when the new content is
byte-identical to what is already there (confirmed against a real
instance). AWS's own CodeArtifact docs ("Overwriting package assets"
in the packages overview) say a republish of an asset whose content
matches what is already published succeeds because the operation is
idempotent; only a genuine content mismatch is a real conflict.
Reposilite has no content-aware mode of its own, so this fetches the
existing artifact first and short-circuits to a 200 on an exact match
rather than ever sending Reposilite a PUT it would reject regardless
of whether the retry was actually harmless.
2026-10-01 21:18:01 -05:00
Priamo Germosen c7bb03ace3 feat(iam): model virtual MFA devices with real TOTP verification (#4820)
Replace the ListMFADevices stub with the virtual MFA device lifecycle:
CreateVirtualMFADevice, ListVirtualMFADevices, DeleteVirtualMFADevice,
EnableMFADevice, DeactivateMFADevice, ResyncMFADevice, ListMFADevices,
and the device tag readers/writers.

The seed is real rather than a placeholder. CreateVirtualMFADevice
generates a 160-bit secret from SecureRandom and returns it as an RFC
4648 base32 string, and EnableMFADevice/ResyncMFADevice verify codes
against it as RFC 6238 TOTP, so a caller that does not hold the seed
cannot enable a device. The codes must be consecutive, as AWS asks for.
Implemented on the JDK's own javax.crypto, with no new dependency.

The TOTP arithmetic is the shared core.common.Totp primitive (#4814):
CognitoTotp keeps its single-code window and attempt budget, and
VirtualMfaCodes holds the consecutive-pair rule that is specific to IAM.

Request shapes are validated against the wire model before the device is
resolved, so a malformed SerialNumber is a ValidationError rather than a
NoSuchEntity, and UserName is enforced as required on Enable and Resync.
VirtualMFADeviceName gets its own validator because it is the one IAM
name type with no documented maximum length, so borrowing the usual
1-to-128 name check would have rejected names AWS accepts.

Device state also reaches the places that report on it: DeleteUser now
returns DeleteConflict while a user still holds a device, GetAccountSummary
counts devices and their assignments, and the credential report's
mfa_active column is backed by real state instead of a constant.

Documented as out of scope: QRCodePNG is not returned (it needs a QR
encoder, and the otpauth URI it encodes is derivable from the seed that
is returned), GetMFADevice takes only FIDO security key ARNs, hardware
and FIDO devices are not modeled, MFA still has no effect on
authorization because the aws:MultiFactorAuth* keys are never populated,
and STS does not accept SerialNumber/TokenCode.
2026-10-01 21:17:50 -05:00
Simone Primarosa 9840b5a998 feat(eks): link containerd certs directory for launch template registry hosts (#4265) 2026-10-01 19:55:53 -05:00
Michał Łomnicki cbc4cf9b91 fix(apigatewayv2): allow an idempotent override-id tag on UpdateApi (#4602)
* fix(apigatewayv2): allow an idempotent override-id tag on UpdateApi

A CloudFormation update resends the template's full tag set, so an
AWS::ApiGatewayV2::Api that pinned its id with floci:override-id failed
every stack update with "Reserved tag key floci:override-id can only be
supplied during resource creation" and rolled back.

UpdateApi now passes the api id to the reserved-tag guard, which already
treats an override equal to the existing id as a no-op (as TagResource
does since #3430), and stores the tags with the override keys stripped.
A different override value is still rejected.

docs/services/api-gateway.md now says a changed override is rejected on
TagResource and UpdateApi while resending the current id is accepted.
The TagResource half has been true since #3430 but was never documented.
CloudFormationIntegrationTest covers a stack update that resends the
pinned id and one that changes it.

* fix(apigatewayv2): validate UpdateApi tags before applying any field

UpdateApi set the name, description and other fields before the
reserved-tag guard ran, so a request it rejected had already changed the
stored API. A CloudFormation update that changed an api's override id
rolled back with the stack reporting UPDATE_ROLLBACK_COMPLETE while the
api kept the rejected update's description.

The guard now runs first, so a rejected update leaves the api as it was.
The CloudFormation test checks the description and tags after the
rollback.
2026-10-01 19:54:15 -04:00
Goooooooooody 2316b2fc28 feat(appconfig): serve feature flag variants to the AppConfig Agent as Amazon Ion (#4674)
* feat(appconfig): serve feature flag variants to the AppConfig Agent as Amazon Ion

The AWS AppConfig Agent evaluates multi-variant feature flags itself: it asks
AppConfigData for application/ion;type=AWS.AppConfig.FeatureFlags and gets each flag's
variants and rules back as Ion. Floci returned the stored JSON document unchanged, which
the agent cannot read, so every variant flag failed with NoSuchFlag.

A caller that accepts that type now gets the Ion stream AWS sends: a symbol table
importing AWS's ops and anns tables, then a list per flag holding its variants (name,
rule, attributes) and its default. Rules of the form (eq $attribute "value") are encoded;
any other is left to the existing JSON path with a warning. The encoding reproduces a
captured AWS response for a real 22-flag profile byte for byte.

* fix(appconfig): honour q=0 for Ion, label the stored content type, read the stream back in tests

An Accept of application/ion;type=AWS.AppConfig.FeatureFlags;q=0.0000 was treated as
acceptable; any run of zeros now means the caller rejects it.

The content type of a response was inferred from its first bytes. It now comes from the path
that produced them, so a profile that is not a feature flag profile keeps its stored type
even if it holds Ion and the caller accepts the feature flag type.

The tests decode the stream with Amazon's ion-java (test scope), with the ops and anns
shared tables registered, instead of checking the encoder against itself.

* fix(appconfig): encode a basic flag in an Ion profile as an annotated string

AWS sends a flag without variants in the Ion format as its retrieval-time JSON, annotated with
its key, not as a list holding a default variant. The encoder now does the same, reusing the
JSON path's per-flag conversion, so a profile that mixes variant and basic flags reads as AWS's.

The encoder and docs cite the layout AWS documents for the agent's local development
mode rather than the captured responses.
2026-10-01 19:30:18 -04:00
Hector Ventura 8d056e9456 ci: limit contributors to 2 open pull requests (#4864)
Call the shared floci-io/.github pr-limit workflow on opened, reopened and
ready_for_review, and on closed and converted_to_draft to clear stale
labels. Runs for the same pull request queue rather than cancel, and manual runs use their own concurrency group. Contributors
keep at most 2 open, non-draft pull requests: the 3rd and 4th get the
over-pr-limit label and a reminder, and from 2026-10-08 the 5th and later
are closed automatically. Bots and maintainers are exempt.

This replaces the advisory bot that labelled authors with more than 5 open
pull requests: the limit is now 2, drafts no longer count, and the logic and
wording live in one shared workflow.

CONTRIBUTING.md and the pull request template describe the policy.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-01 17:44:05 -05:00
jwoa95 45b7be9362 feat(cognito): offer an email code on managed login (#4765)
* feat(cognito): offer an email code on managed login

Managed login could not sign in a user of a passwordless pool: /login was
a username and password form only. When the pool's SignInPolicy allows
EMAIL_OTP and the client allows USER_AUTH, the page now asks for the
username first, offers the factors that user has (PASSWORD and
EMAIL_OTP), and for EMAIL_OTP sends a code through the USER_AUTH
EMAIL_OTP challenge, so it arrives in Floci's SES. A correct code signs
the user in as the password does: a session cookie and a redirect to the
callback with code and state, redeemed at /oauth2/token with PKCE. The
USER_AUTH session travels in a hidden field. A wrong code shows the code
field again and keeps the session for another try. An unknown user is
asked for a code like anyone else, but nothing is sent and no code signs
them in. Pools and clients without choice-based sign-in keep the
password form unchanged.

USER_AUTH ignored the sign-in policy for existing users, so a pool that
allowed only EMAIL_OTP still offered PASSWORD and PASSWORD_SRP. The
available challenges are now narrowed to AllowedFirstAuthFactors, whose
PASSWORD covers both password challenges, and a PREFERRED_CHALLENGE or
SELECT_CHALLENGE answer outside it is refused as an unavailable one is.
A pool with no sign-in policy is not narrowed.

/oauth2/authorize now carries login_hint to /login, on Floci's host and
on a custom domain, and /login fills the username field with it, as AWS
documents.

Refs #4759

* fix(cognito): harden the managed login email-code step

The step after the username told accounts apart. The page looked each
user up, so a user with one factor skipped the choice others got, a user
who could not sign in was told why, and the USER_AUTH session in the code
form named the user it was for. The page now offers the policy's factors
to every username, and a user who is unknown, cannot sign in, or has no
verified email gets the same code field, with no message sent. Why a user
cannot sign in shows only after a correct code. Asking again within the
resend limit shows the code field for the code already sent, instead of
an error only a real user could get. USER_AUTH session tokens no longer
carry the username.

The same code could sign in twice: requests answering one session with
its code at once could all pass the check before any removed the
session. The code is now checked and the session spent under the lock
that every read and removal of a session takes, RespondToAuthChallenge's
included, so one request signs in and the others find the session spent.

A correct code spends the session, so a failure after it, such as a
failing PostAuthentication trigger or a user who cannot sign in, now goes
back to the username step with the reason, instead of showing a code
field that can no longer work.

Refs #4759

* fix(cognito): redeem an email or SMS sign-in code once across sessions

Every live EMAIL_OTP or SMS_OTP session of a user takes the user's one
sign-in code, and the code store reads a code before it deletes it. Two
of a user's sessions answered with the code at once through
RespondToAuthChallenge could both pass the check and both sign in. Such
a second session is easier to come by now that asking the sign-in page
for a code again within the resend limit opens one. RespondToAuthChallenge
now checks the code under the lock the sign-in page checks it under, so
one session signs in and the other gets CodeMismatchException. Nothing
held under that lock calls a Lambda trigger.

Refs #4759

* fix(cognito): redeem verification codes under a per-user lock

Redeeming an email or SMS sign-in code held the lock shared by every
USER_AUTH session while the code store read and wrote the code, which in
persistent storage mode is a disk write, so one user's slow redemption
held up other users' sign-ins. That lock now guards the session maps
alone.

The code store now redeems a code once by itself: consume() takes a lock
striped by the code's pool, user and purpose, and calls nothing but the
store under it, so no trigger runs and no other lock is taken there.
Sign-up, password reset and attribute verification codes gain the same:
each is redeemed once and every wrong attempt counts, where concurrent
requests could redeem one twice or undercount its attempts before. Of
several requests answering a user's sessions with one code at once, one
signs in and the rest get CodeMismatchException. The sign-in page looks
its session up, redeems the code, then removes the session, and still
signs in if RespondToAuthChallenge spent the session meanwhile, since
only one of them can have redeemed the code.

Refs #4759

* fix(cognito): issue and invalidate verification codes in turn with redemption

Only consume() took the code store's per-key lock, so redeeming the old
code could read it, let a resend write the new one, and then delete the
new one, leaving the user a code that never works. issue() and the two
invalidations now take the same stripe, so each of them and consume()
see the code as the one before left it.

Refs #4759

* fix(cognito): offer the choice for a preferred challenge the user cannot take

USER_AUTH refused a PREFERRED_CHALLENGE that the sign-in policy leaves
out or the user has not set up with InvalidParameterException. AWS
answers it as it answers InitiateAuth without one: SELECT_CHALLENGE and
the challenges the user can take, which is what clients expect on the
main sign-in path. Floci now does the same, and refuses only a name
Cognito does not support, with AWS's message listing the ones it does.
An unknown user whose client prevents user existence errors gets the
same answer as a known user: the preferred challenge when the policy
allows it, and the choice when it does not. A SELECT_CHALLENGE answer
outside the choice is still refused.

Refs #4759

* fix(cognito): default a pool's sign-in policy to PASSWORD alone

AWS's DescribeUserPool reports a SignInPolicy of
{"AllowedFirstAuthFactors": ["PASSWORD"]} for a pool created without one,
on any tier, and USER_AUTH offers that pool's users password challenges
alone. Floci stored no policy and did not narrow such a pool, so it
offered EMAIL_OTP and SMS_OTP that AWS would not. CreateUserPool now
stores the default, UpdateUserPool keeps the policy when the request
omits Policies and puts the default back when its Policies has no
SignInPolicy, and a pool persisted without one is treated as PASSWORD
alone.

Refs #4759

* test(cognito): pass login_hint in the scope tests from main
2026-10-01 16:40:31 -04:00
jwoa95 f1d718cae2 fix(cognito): scope OAuth tokens to the requested scopes (#4771)
* fix(cognito): scope OAuth tokens to the requested scopes

* fix(cognito): require the admin scope on access-token operations

* fix(cognito): bind an authorization code to the scopes granted at authorize

* fix(cognito): keep the provider's requested scopes apart from Cognito's grant
2026-10-01 13:54:01 -04:00
Vũ Thế Huy 436c15ca38 fix(sts): reject AssumeRole for roles that do not exist (#4463)
* fix(sts): từ chối AssumeRole khi role không tồn tại trong IAM

AssumeRole trước đây cấp credential cho mọi role ARN, kể cả role chưa
từng được tạo (iam:GetRole trả NoSuchEntity). Giờ trả AccessDenied như
AWS, bất kể enforcement có bật hay không; trust policy vẫn chỉ được
đánh giá khi enforcement bật. Các test cũ assume role chưa tạo được sửa
để tạo role trước.

Closes #4392

* fix(sts): so sánh chính xác role ARN và cập nhật compatibility tests

- StsQueryHandler: kiểm tra roleArn khớp chính xác role.getArn() để tránh chấp nhận role cùng tên khác path

- StsQueryHandlerTest: đổi tham số helper sang IamRole thay vì Optional, bổ sung test case từ chối role khác path

- AssumeRoleTrustPolicyIntegrationTest: sửa Javadoc mô tả đúng hành vi từ chối unknown role

- Cập nhật compatibility tests (Java, Node, Python, AWS CLI) để tạo role trước khi assume và kiểm tra lỗi 403 khi role không tồn tại

* fix(sts): accept partition-correct role ARNs and strictly catch cleanup exceptions

- StsQueryHandler: match role ARN structurally using AwsArnUtils to admit valid noncommercial partition ARNs

- StsQueryHandler: preserve caller partition when generating assumedRoleArn

- StsTest, test_sts.py, sts.test.ts: only ignore NoSuchEntity/EntityAlreadyExists in cleanup, re-raising unexpected errors per AGENTS.md

- StsQueryHandlerTest, AssumeRoleTrustPolicyIntegrationTest: add unit and integration coverage for partition-correct role ARNs

* fix(sts): preserve role partition in resolved session caller ARN

* fix(sts): preserve stored role partition in assumed identity

* fix(sts): validate web identity role ARN

* fix(sts): require role existence in AssumeRoleWithWebIdentity and reuse path helpers

* fix(sts): keep IAM ARN partition behavior unchanged

* fix(sts): derive trust caller account from identity ARN

* fix(iam): migrate legacy credential reports by partition

* fix(iam): serialize legacy credential report migration

* test(iam): make credential report race deterministic

* fix(sts): address review feedback

* fix(sts): reuse IAM role path normalization
2026-10-01 13:18:07 -04:00
Kenshin Okinaka a22e65f993 feat(ses): paginate the tenant and import job lists (#4819)
* feat(ses): paginate the tenant and import job lists

Page ListTenants, ListTenantResources, ListResourceTenants and ListImportJobs
on the shared SES paging, each with its own token namespace, and delete
SesTenantService.validateListPaging. The tenant lists answer the probed SES
rules: PageSize 1 to 100 with the Smithy validation messages, an empty
NextToken refused with its Smithy message before the tenant or resource is
looked up, an unreadable token answered "Invalid Next Token", tenants listed
by name, a tenant's resources by ARN and a resource's tenants in association
order. ListImportJobs could not be probed and is modelled on the tenant lists,
keeping Floci's oldest-first order. Without a PageSize all four lists serve up
to 100, a Floci assumption where nothing could be measured.

* fix(ses): follow the probed order, aggregation and token binding on the tenant lists

A second probe of real SES showed three differences on ListTenantResources and
ListResourceTenants: the tenant or resource is looked up, and the filter
checked, before the page size and token; a page size outside the bound and an
empty NextToken are reported together in one validation message; and a token
is refused once the tenant, resource or filter changes. ListImportJobs, which
cannot be probed, follows the same rules. The service docs keep the per-list
paging detail and gain a paragraph for these four lists.
2026-10-01 13:10:03 -04:00
Sam Fakhreddine bcf1045536 feat(codepipeline): execute ThirdParty GitHub version 1 source actions (#4615)
* feat(codepipeline): execute ThirdParty GitHub version 1 source actions

Downloads the configured branch archive from codeload.github.com and republishes it with the repo at the artifact root, keeping unix modes and symlinks; zip entries decode as STORED or DEFLATED only, avoiding the ZSTD/XZ dispatch path that breaks the native build.

* fix(codepipeline): bound GitHub source archive size and reject escaping entries

Cap download, uncompressed bytes and entry count; reject escaping paths and symlinks; end the Inflater.

* refactor(codepipeline): use explicit types and imports in the GitHub source, fix its symlink comment

Rename the test class to the *ServiceTest convention and correct the invalid-ref error message, which claimed the branch cannot contain slashes.

* fix(codepipeline): report the GitHub commit as the source revision and harden the GitHub source

Only the ThirdParty version 1 GitHub action takes the codeload path, so a custom action named GitHub still reaches its worker. The revision is the commit SHA from the archive comment, recorded in sourceRevisions as well. Branch segments are percent-encoded, entry checksums are verified, and the archive caps drop to 128 MiB to keep the heap bounded.

* test(codepipeline): wait on state with Awaitility and order imports in the GitHub source test

* refactor(codepipeline): make GitHub source limits final behind overridable accessors

Archive size, entry and base URL settings move from mutable fields to protected accessors that tests override. Also reject archive entries with a leading slash instead of treating it as the top-level separator.
2026-10-01 13:00:50 -04:00
danielxoi 5000bcd041 fix(apigateway): accept a region label before the built-in execute-api suffixes (#4705)
* fix(apigateway): accept a region label before the built-in execute-api suffixes

extractApiId accepted a region label only before localhost, the configured hostname, or an AWS DNS suffix, so <apiId>.execute-api.<region>.localhost.floci.io (the shape a client derives from a stage's invoke URL) was never claimed and fell through to S3's path routes, answering NoSuchBucket for the stage segment. Accept the built-in localhost.floci.io and localhost.localstack.cloud suffixes after a region label too, for REST and HTTP APIs alike.

Closes #4701

* fix(apigateway): accept every published region label on execute-api hosts

extractApiId validated the region label with a two-letter-geo pattern, so eusc-de-east-1 was rejected before the suffix was checked and the request fell through to S3, on every tail including amazonaws.eu. Check the label against the published region ids with AwsRegions.isRegionId, the same test RegionResolver.resolveRegionFromHost applies, so the hosts the filter claims match the regions it can resolve.

* fix(apigateway): accept execute-api region labels not yet in the partition catalog

isRegionId accepts only regions in the vendored published list, so a region launched after that data was generated was rejected on its execute-api host even though signed requests accept it. Use RegionResolver.isKnownRegion, which falls back to each partition's botocore region regex; an unrecognized label such as zz-nowhere-9 is still rejected.
2026-10-01 12:31:35 -04:00
XuJian b2dd5665db fix(s3): validate notification destinations before storing configuration (#4747)
* fix(s3): validate notification destinations before storing configuration

* test(s3): consume validation events before POST notifications

* fix(s3): preserve bucket lifecycle during notification validation

* fix(s3): enforce SQS queue policies for notifications

* fix(s3): align notification validation with IAM enforcement

* fix(test): stub IAM config for S3 failure delivery

* fix(s3): validate cross-account SNS without test publish

* fix(sns): recognize legacy topics during destination validation

* docs(s3): describe cross-account notification validation

* fix(s3): skip cross-account SNS notification test publishes
2026-10-01 11:35:16 -04:00
Aymen JAMAAOUI bc2592e300 fix(ecs): send container logs to the awslogs group and stream from the task definition (#4808)
* fix(ecs): send container logs to the awslogs group and stream from the task definition

* fix(ecs): keep console output for containers without awslogs
2026-10-01 10:39:44 -04:00
Abhigya 8f904afa5a fix(s3): verify header and presigned POST signatures under validate-signatures (#4786)
* fix(s3): verify header and presigned POST signatures under validate-signatures

floci.auth.validate-signatures verified only presigned URL signatures. A
header-signed request or a presigned POST with a forged signature or an
unknown access key was accepted unless enforce-auth was on, and enforce-auth
also turns on bucket-policy evaluation, so there was no way to authenticate
S3 requests without authorizing them.

S3 verifies a signature before, and independently of, deciding from policies
and ACLs whether the caller may act. validate-signatures now does the first
step for every placement: S3HeaderSignatureFilter runs under either flag, and
a browser POST that carries SigV4 form fields is verified. Bucket policies are
still not evaluated, and unsigned requests are still left to enforce-auth,
which decides anonymous access from policies and ACLs as AWS does.

docs/services/s3.md now says what each flag verifies.

* chore(s3): keep validatePresignedPostAuth's Javadoc on its method

* docs(s3): clarify multi-account credentials under signature verification

* docs(s3): update docs/configuration/multi-account.md

Signed-off-by: Abhigya <abhigyakrishna21@gmail.com>

---------

Signed-off-by: Abhigya <abhigyakrishna21@gmail.com>
2026-10-01 10:14:41 -04:00
Mario Toffia fa4d4663a2 feat(lambda): honour the Invoke Qualifier and wait between asynchronous retries as AWS does (#4733)
* feat(lambda): honour the Invoke Qualifier query parameter

* feat(lambda): wait between asynchronous retries as AWS does

A failed Event invocation now waits floci.services.lambda.async-retry-delay-seconds before its first retry and twice that before its second (default 60, matching AWS), capped at the event's remaining maximum age. The concurrency permit is held only for each attempt, and an emulator reset drops retries still waiting.

* test(lambda): prove asynchronous retries end to end

* docs(lambda): document asynchronous retry timing and the Invoke Qualifier

* fix(lambda): drop retries of deleted functions and tighten async retry edges

- Drop a pending asynchronous retry when its function (or version) was deleted.
- Decide expiry once, on the injected clock, when a retry is scheduled.
- Check the reset generation at routing, so no stale outcome is delivered.
- Restore upstream behavior when an attempt throws: stop retrying and route
  the previous result, or UnknownError when there is none.
- Harden tests: in-order permit release, deterministic reset, error types
  and an unqualified-ARN Qualifier case for Invoke.

* fix(lambda): drop a deleted function's pending events on every path

Replace the store lookup with a per-function deletion counter, captured
when the event is invoked and checked wherever an event is attempted or
routed. This covers the expiry path, which bypassed the old check, and a
delete-and-recreate of the same name during the wait, which the lookup
could not see. Verified against AWS that DeleteFunction drops pending
retries without delivering a record.

* fix(lambda): clear deletion counts before bumping the reset generation

An invoke between the two statements of clear() captured the new
generation with a stale deletion count and its event was dropped.
The expiry-path deletion test now drops inside the first attempt,
so it no longer races the one-second maximum event age.

* fix(lambda): keep deletion counts across a reset

Clearing them while the old generation was still current let a
deleted function's pending event see a zero count and be routed.
A reset now only bumps the generation, in one atomic step.

* fix(lambda): drop an Event invoke that races DeleteFunction

An Event invoke that resolved the function just before a concurrent
DeleteFunction could take its deletion-count snapshot after the delete
had already moved the count. The event then never looked stale, so the
deleted function could still be started and a failure record could
still reach its destination.

DeleteFunction now moves the deletion count only after the function has
left the store, and an Event invoke checks that the function is still in
the store after it takes its snapshot and before it queues the event.
Either the check sees the function gone and the invoke answers 202
without queueing anything, or the snapshot predates the count change and
the event is dropped as stale later.

* fix(lambda): validate the Invoke Qualifier query parameter

Invoke treated an empty or blank Qualifier as if none had been given
and ran $LATEST, and it passed a qualifier longer than 128 characters on
to the lookup, which answered 404. AWS rejects both with a 400.

A supplied Qualifier must now be 1 to 128 characters of letters,
digits, $, _ and -, or Invoke fails with ValidationException. The
controller reads the parameter from the raw query, because @QueryParam
reports a present but empty value as null and the check could not see
it.

* fix(lambda): stop pending events before a delete or reset removes state

DeleteFunction moved a function's deletion count only after it had
removed the function's code and store entry. A retry whose timer fired
in that gap still passed the staleness check, tried to start a function
with no code, and could deliver a failure record to its destination. An
attempt that finished in that gap could deliver its OnFailure record.
DeleteFunction now moves the count before it deletes anything, which
stops every queued or running event, and again after the store entry is
gone, which stops an Event invoke that read the count in between.

An emulator reset wiped storage before the executor's clear() moved the
reset generation, so a retry firing during the wipe could run or deliver
against half-cleared state. The executor now also moves the generation
in beforeReset(), which runs before the wipe. clear() still moves it, to
drop events accepted between the two.

* test(lambda): fix a doc comment and name the tolerated Docker ping failure

The class comment now reads "wait as they do on AWS". The Docker ping
check names its caught exception "expected" and says why returning
false is safe: the test is then skipped rather than failed.

* fix(lambda): count version and alias invokes against the function's reservation

Routing the Invoke Qualifier to a published version meant a qualified
invoke took its permit against the version's snapshot, which carries no
reservation, so a reserved concurrency of 0 on the function no longer
throttled it and a positive one stopped counting those invokes. The
name-qualified path (fn:1, fn:alias) already had the same gap.

Reserved concurrency is function-wide in AWS, so the executor now takes
the permit against the function's $LATEST record, which holds the
reservation. That covers direct Invoke with a Qualifier, qualified names
and ARNs, aliases, event source mappings and asynchronous retries alike.
It reads the stored record rather than the limiter's region registry
because event source pollers can invoke before LambdaService has
rehydrated that registry after a restart.

* fix(lambda): drop a deleted function's pending events before draining its containers

DeleteFunction drained the warm pool before fencing pending asynchronous
events, and draining blocks while idle containers stop. A retry whose
timer fired in that window still passed the staleness check and could
cold-start a container after the drain, leaving it warm for a function
that no longer exists. The fence now goes up first.
2026-10-01 10:00:47 -04:00
Aniket Shukla 8a2b998378 fix(mwaa): restrict CLI proxy to supported commands (#4797)
* fix(mwaa): restrict CLI proxy to supported commands

* test(mwaa): cover every supported CLI command
2026-10-01 09:11:06 -04:00
Priamo Germosen cf04f433b6 fix(iam): give a role session's aws:PrincipalArn as its role's ARN under enforcement (#4810)
Follow-up from the review of #4716.

The enforcement filter put the assumed-role session ARN
(arn:aws:sts::<account>:assumed-role/<role>/<session>) in aws:PrincipalArn for a
caller using role-session credentials. AWS puts the ARN of the role that was
assumed there, path included ("For IAM roles, the request context returns the
ARN of the role, not the ARN of the user that assumed the role", IAM User Guide,
global condition keys). So an identity or resource policy keyed on the role's
ARN never matched its sessions: an Allow scoped that way refused them and a Deny
written that way never fired, while a condition naming the session ARN, which
AWS says not to use for this key, matched.

The filter now reads both values from one lookup of the key, through a new
IamService.resolveCallerArns: the caller ARN, still the session ARN for a role
session, and the principal ARN, the role ARN the session recorded when it was
issued (#4716). A user's key and the account-root principal give the same value
for both. One lookup matters: two could straddle the session's expiry, answer
the first and not the second, and leave a fallback to fill aws:PrincipalArn
with the session ARN, so a Deny keyed on the role's ARN would miss.
resolveCallerArn and resolvePrincipalArn now read through it, and the STS trust
check, which made the same two lookups, uses it too. Both places the filter
fills the key (the request's own authorization and authorizeAdditionalResource)
take it from there. The session ARN stays the caller's principal for matching a
resource policy's Principal, which is a separate change.

docs/services/iam.md describes the key for role sessions and drops the caveat
about the session name, which no longer applies to it.

The integration test covers both paths: IAM calls whose policy is keyed on the
role's ARN, and an SSM GetParameter on a Secrets Manager reference, whose
secretsmanager:GetSecretValue check goes through authorizeAdditionalResource.
The SDK compatibility suite's IamEnforcementTest gets the same IAM checks with
AWS SDK clients; like the rest of that class it runs only against a Floci with
IAM enforcement on.
2026-10-01 07:50:19 -05:00
Mario Toffia 0a54d0708e feat(eventbridge): execute target retry and dead-letter policies (#4736)
* feat(eventbridge): execute target retry and dead-letter policies

PutTargets now validates, stores and returns a target's RetryPolicy and
DeadLetterConfig. Failed deliveries from PutEvents and scheduled rules are
retried with backoff within the configured attempts and event age, and
exhausted or non-retryable events are sent to the standard SQS dead-letter
queue with the AWS failure attributes.

* fix(eventbridge): order target retries by due time and honour a lowered retry limit

Pending retries are kept in a queue ordered by their next attempt, so each wake-up
takes only what is due instead of scanning every pending retry. The clock is read
again for each retry, so a slow target cannot let a later retry run past its event
age, and a reset mid-tick stops the remaining retries. A retry now checks the
target's current MaximumRetryAttempts before invoking it, as it already did for
MaximumEventAgeInSeconds.

* fix(eventbridge): drop a target retry that outlives a reset

An attempt still running when the emulator resets can fail afterwards. Its retry
or dead-letter delivery is now dropped, so a rule and target recreated under the
same names after the reset do not receive a pre-reset event. A scheduled retry
wake-up keeps only its due time, not the event.

* fix(eventbridge): wake a target retry at its due time after a slow attempt

The retry delay was measured from when the failed attempt started but counted from
when it failed, so every retry after a slow attempt woke late by the attempt's
duration, and an expired event reached its dead-letter queue late.

* fix(eventbridge): drop a removed target's retries and drive retries from one tick

RemoveTargets now drops the removed targets' pending retries, so a target re-added
under the same Id does not receive an event from before its removal. Pending retries
are taken by one periodic tick, as in the scheduler's dispatcher, instead of a timer
per retry, so a reset leaves no timers behind.

* fix(eventbridge): warn about a blank dead-letter queue ARN

PutTargets accepts a whitespace-only DeadLetterConfig Arn, since AWS constrains only
its length. Delivery skipped it without a word; it now gets the same WARN as any other
dead-letter queue that is not a standard SQS queue in the rule's region.
2026-10-01 07:59:18 -04:00
Hector Ventura ea06896984 test(compat): run the Java SDK suite nightly in cn-north-1 against an allowlist of known failures (#4790)
* test(compat): run the Java SDK suite nightly in cn-north-1 against an allowlist of known failures

Part of #4272 (P11). The partition work is covered by unit and integration
tests over all eight partitions, but nothing ran a real SDK whose own
partition logic (arn:aws-cn: ARNs, China signing scopes, the LocationConstraint
S3 CreateBucket sends) has to round-trip.

The Partition Compatibility workflow runs after each Nightly against the image
it published, or on dispatch with an image and region: Floci starts with
FLOCI_DEFAULT_REGION=cn-north-1 and sdk-test-java runs with AWS_REGION set,
which TestFixtures now reads (default us-east-1, so the per-PR legs are
unchanged). It runs once a night rather than per PR, to keep the shared runner
pools free.

compat-allowlist-check.py compares the JUnit results with
compat-partition-allowlist-<region>.txt and fails on a failure the list does
not name, on an entry that no longer fails, or on missing results, so the list
only shrinks. The cn-north-1 list holds the 112 failures measured locally on
main plus #4787: 96 tests that pin commercial ARNs, regions or zones, 13 that
exercise commercial-only behaviour, and 3 still to explain.

* test(compat): pin the nightly China run to its image's commit and catch an aborted suite

Greptile on #4790: the workflow checked out the Nightly run's head_sha but
pulled the mutable floci/floci:nightly tag, so the image and the tests could
come from different commits; it now pulls the image first and checks out the
commit in its org.opencontainers.image.revision label. And Maven exits
non-zero for allowlisted failures too, so a suite that stopped partway could
pass; the checker now takes --test-sources and requires a report for every
test class in that tree.

The cn-north-1 allowlist groups its entries by the verified cause: the RDS and
SSO portal entries are Floci bugs (an RdsService ownership check against the
literal partition "aws", and an arn:aws: seeded Identity Center instance),
and SsoAdminAccountAssignmentTest#createInstanceQuotaUsesAwsSdk passes alone
and fails only after OrganizationsTest leaves an organization behind.
2026-10-01 00:33:54 -04:00
Kenshin Okinaka ea41b775aa feat(ses): paginate the identity, configuration set and custom verification template lists (#4781)
* feat(ses): paginate the identity, configuration set and custom verification template lists

Move paging into the SES services, so each resource's cursor lives with its
list and the v1 and v2 operations of the same resource share it. Page
ListIdentities/ListEmailIdentities, ListConfigurationSets (v1 and v2) and
ListCustomVerificationEmailTemplates (v1 and v2) with the probed defaults,
bounds and messages: identities default to 25 on v2, configuration sets and
custom verification templates to 50, and a v1 page size outside the bound is
served the probed size instead of refused.

* fix(ses): refuse a list token replayed in another region

A list token carried only the resource kind and the cursor, so the same list
in another region read it as a position and could answer an empty last page.
Real SES refuses such a token with the operation's unreadable-token error
(probed on the identity and configuration-set lists), so the token namespace
now includes the region. The v1 and v2 lists of one resource still share
tokens within a region.
2026-09-30 23:29:35 -05:00
Priamo Germosen 275d874fed fix(ses): authorize SES v2 calls against their IAM actions under enforcement (#4775)
SES v1 is a Query API, so IAM enforcement resolves its action from the
request's Action like any other. SES v2 is REST-JSON under /v2/email and
IamActionRegistry had no rules for it, so every v2 call resolved to no action,
which the enforcement filter lets through: with enforcement on, the whole v2
API was unguarded, CreateConfigurationSetEventDestination included.

IamActionRegistry now has one rule per operation in the SES v2 model
(botocore sesv2/2019-09-27, 112 operations), each mapped to the IAM action
AWS's service reference lists for it
(servicereference.us-east-1.amazonaws.com/v1/ses/ses.json). That is always
ses:<Operation>, in the ses namespace v1 and v2 share. SendEmail has no entry
there; the Service Authorization Reference's SES v2 page defines ses:SendEmail
as v2's only send action whatever the content (ses:SendRawEmail is a v1
action), so it takes its name too. No two rules can match the
same path, so their order does not matter. The 20 operations Floci does not
serve yet are mapped too, so a route added later is guarded from the start.

Two ways round a rule are closed for every REST service, not only SES v2.
IamActionRegistry.resolve read X-Amz-Target before the path rules, so a REST
request carrying one was checked as whatever operation the header named: a
POST /v2/email/outbound-emails with X-Amz-Target: SES.GetAccount went through
for a caller denied ses:SendEmail. REST-claimed requests now resolve through a
new resolveRoute, from method and path alone. And the rules matched the
decoded path while the router matches the encoded one, so a%2Fb@example.com
reached the suppressed-destination endpoint while its decoded path matched no
rule and passed as an unknown action. resolveRoute matches the path still
percent-encoded, read from the request URI since RESTEasy Reactive does not
serve UriInfo.getPath(false).

A denied call answers AccessDeniedException with HTTP 403, as the SES v2 API
Reference lists among its common errors. Like v1, v2 is evaluated with
resource "*"; resource ARNs for SES, and the extra actions the service
reference lists for some operations (ses:TagResource on the create operations,
iam:PassRole for event destinations), are left for later and documented in
docs/services/ses.md.

IamActionRegistryTest checks every operation against a table generated from
the model and the service reference, not from the rule table.
SesV2IamEnforcementIntegrationTest shows a caller without SES permissions
refused, a single allowed action granting only that operation, a target header
not changing the checked action, and an encoded slash still authorized.
2026-09-30 23:29:23 -05:00
Mario Toffia a338a430cc feat(cloudformation): provision Cloud Map namespaces and services (#4599)
* feat(cloudformation): provision Cloud Map namespaces and services

AWS::ServiceDiscovery::PrivateDnsNamespace, PublicDnsNamespace,
HttpNamespace and Service were stubbed, so a stack reported them created
while nothing existed in Cloud Map and Fn::GetAtt resolved to literals.

CloudMapCfnProvisioner creates them through CloudMapService. Ref returns
the id; Fn::GetAtt exposes Id and Arn, HostedZoneId on a DNS namespace and
Name on a service. An unnamed service is named <LogicalId>-<12 chars>, as
measured on AWS. Description, DnsConfig, HealthCheckConfig and Tags update
in place; a createOnly change replaces the resource through
ReplacementCleanup, and a rolled-back replacement restores the createOnly
record. A Ref to a Number parameter is coerced back to a JSON number for
DnsRecords TTL and FailureThreshold.

Closes #4596
* fix(cloudformation): roll back in-place Cloud Map updates

An in-place namespace or service update followed by a later resource
failing left the Cloud Map changes live and the stack in
UPDATE_ROLLBACK_FAILED, since rollbackUpdate only undid replacements.
The provisioner now keeps the description, DnsConfig, HealthCheckConfig
and tags an in-place update overwrites and puts them back on rollback;
a committed update drops the snapshot.
* fix(cloudmap): reject DNS record type changes on service update

UpdateService only changes the TTLs of a service's existing DNS records on AWS. An in-place CloudFormation update that changes the record types, or gives a DnsConfig to a service without one, now fails with InvalidInput instead of being applied, so it rolls back like on AWS and a rollback never has to remove a DnsConfig.
* fix(cloudmap): accept only TTL changes in a service DnsConfig update

UpdateService carries only DnsRecords on AWS and CloudFormation does not support a RoutingPolicy update. Comparing the record types as a set let a RoutingPolicy change or an added record of the same type through; the requested and stored DnsConfig now have to match apart from the TTLs.
* fix(cloudmap): ignore DNS record order in a service DnsConfig update

A TTL-only update that listed the same records in another order was rejected. The comparison now uses the sorted record types, so counts, types and RoutingPolicy still have to match.
* test(cloudformation): restore a real HealthCheckConfig in the Cloud Map rollback test

The in-place rollback test went from a null health check config to null, so dropping it from the snapshot would have passed.
2026-09-30 21:45:18 -05:00
jwoa95 31038ee2a4 feat(cognito): add GetUserAuthFactors (#4764)
* feat(cognito): add GetUserAuthFactors

* fix(cognito): refuse access tokens with no scope claim where a scope is required

* fix(cognito): use AWS's message for a missing access-token scope
2026-09-30 21:45:10 -05:00
Abhigya d73e33fe4b fix(ecs): pull task images at launch so a moved tag reaches the next task (#4583)
* fix(ecs): pull task images at launch so a moved tag reaches the next task

Floci resolved an image reference to an image id the first time it saw it and
reused that id for the life of the process, so a rebuilt :latest pushed to the
registry never reached a new task, even through a new task definition revision
and a forced deployment, and nothing reported the mismatch.

ECS now pulls every container image when a task starts, before creating any of
its containers, following the agent's ECS_IMAGE_PULL_BEHAVIOR (configurable as
floci.services.ecs.image-pull-behavior, default "default": pull, and fall back
to the cached image when the pull fails). The cached image is whatever the
local tag names at launch rather than a remembered id. Each container reports
the manifest digest it runs as containers[].imageDigest.

* fix(ecs): create task containers from the image id their pull resolved to

An overlapping RunTask could pull the same moved tag between this task's pull
and its container creation, so the container was created from whatever the
shared tag cache named by then while reporting the digest this task pulled.
resolveForLaunch now returns the resolved image id with its digest, and ECS
builds each container from that id, so the image a task runs and the digest it
reports always come from the same pull.

The pull also now uses the reference the container is created from, including
floci.docker.image-registry-base, instead of the unprefixed name.

* fix(ecs): launch image ids without a pull and report the digest the pull resolved

A bare sha256 image id under always, or on the first once launch, went to the
registry as if it were a repository reference and failed the task although the
image was local. resolveForLaunch now runs an image id as it is, like
ensureImageExists.

The reported digest took the first RepoDigests entry for the repository, which
is not necessarily the manifest the tag resolved to when the image holds more
than one (an index and a platform manifest). It now comes from the Digest line
the daemon streams for the pull, kept while the tag still names that image; a
cached image falls back to its repo digest only when there is exactly one.

The shared test config uses prefer-cached so the other ECS Docker suites stop
adding a registry round trip per launch; the image pull integration test pins
default in its own profile. ContainerBuilder imports are back in order.

* fix(ecs): report a pull's digest only for the launch that pulled

The digest a pull reported was kept per reference and reused while the tag
still named the same image id, but on the classic image store an id is the
config digest and several manifests can share it, so an outside pull could move
the tag to another manifest and leave the reused digest stale. Only the launch
that pulled now uses the streamed digest. A cached launch uses the image's
repo digest for the repository when there is one, or the one equal to the id
(the containerd store names an image by its manifest), and otherwise none.

Also sorts the ContainerLifecycleManager imports.

* fix(ecs): pull the image-pull test's busybox and registry from Docker Hub

EcsImagePullDockerIntegrationTest pulled both images through the
public.ecr.aws/docker/library mirror, whose anonymous quota is shared per
runner IP; shard 3 failed on toomanyrequests: Data limit exceeded. Take
them from TestImages like the other Docker-backed tests, pinning the
registry image there, and prefetch both for the shard that runs the class.

* test(ecs): name the registry readiness probe's tolerated exception expected
2026-09-30 22:14:50 -04:00
TATSUNO “Taz” Yasuhiro be21e86057 fix(sqs): match AWS on stale, gone and invalid receipt handles (#4730)
* fix(sqs): reject empty, malformed and foreign receipt handles

* fix(sqs): accept receipt handles of gone and re-received messages

* fix(sqs): reject expired FIFO receipt handles

* fix(sqs): reject receipt handles that were never issued

* chore(sqs): parse receipt handles once and share the handle checks

* fix(sqs): sign receipt handles with a configurable secret

* test(sqs): merge the receipt handle error tests into one table

* fix(sqs): give a message moved by a move task a new message id
2026-09-30 21:29:09 -04:00
Hector Ventura 0bc85f3ef8 fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode (#4743)
* fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode

GetCallerIdentity's root fallback, the AssumeRole family's session ARNs, the
OIDC provider ARN and GetFederationToken built their ARNs with an empty
region, which falls back to the commercial partition, so they carried arn:aws:
whatever partition the request signed. They now go through
RegionResolver.buildGlobalArn. GetAccountSummary reports
GlobalEndpointTokenVersion only where the partition publishes a global STS
host, which is aws alone.

floci.partitions.strict (FLOCI_PARTITIONS_STRICT, default false) refuses a
request signed for a service AWS publishes in another partition but not in
the request's one (CloudFront in GovCloud, IAM in aws-eusc) with the
unknown-service guard's 404, mirroring the host that never resolves on AWS.
endpoints.json omits the services that ship only an endpoint ruleset, so a
service the data lists nowhere is served everywhere. Credential scopes carry
signing names, and 46 of them differ from the endpoints.json keys they cover
(73 keys, such as ecr for api.ecr); regen_partitions.py vendors that map as
signingNames and AwsPartition.offersSigningName joins it.

Part of #4272

* fix(core): read the gzipped botocore models the pip package ships when collecting signing names

The botocore wheel ships each service model as service-2.json.gz, while the checkout under local/aws/botocore ships it plain. collect_signing_names looked only for the plain file, so in CI, which resolves botocore to the installed package, it found no models, generated an empty signingNames and failed aws-data-check against the committed map. It now reads either form, as regen_dynamodb_shapes.py already does.

* fix(sts): keep an assumed-role session in its role's partition, and answer strict-mode Query requests in XML

GetCallerIdentity rebuilt an assumed-role session's ARN with an empty region, which falls back to the commercial partition, so a session AssumeRole issued as arn:aws-cn:sts:: came back as arn:aws:sts::, and a chained AssumeRole was then refused by a China trust policy as a caller from another partition. The session ARN now takes the partition its role ARN names.

Strict partition mode refused a form-encoded Query request (IAM in aws-eusc) with a JSON body; it now returns the Query XML error the unknown-region guard beside it already returns for such requests.

* fix(iam): mint IAM resource ARNs in the request's partition and keep them there

CreateUser, CreateGroup, CreateRole, CreatePolicy, CreateInstanceProfile and
CreateOpenIDConnectProvider minted arn:aws: whatever partition the request
signed, while STS now followed the request. Under China that denied
AssumeRoleWithWebIdentity (the trust policy names the arn:aws: provider ARN
CreateOpenIDConnectProvider returned, matched against arn:aws-cn:), and
AssumeRole reported the request's partition while GetCallerIdentity reported
the role's.

An IAM resource is now created in the request's partition and keeps it:
UpdateUser and UpdateGroup re-mint in the stored ARN's partition. Anything
derived from a stored role follows the role: all three AssumeRole handlers,
resolveCallerArn and the web identity OIDC provider ARN take the role ARN's
partition through AwsArnUtils.partitionOrDefault. The credential report's
root row takes the request's partition.

* fix(sts): mint a session from the stored role, and keep one credential report per partition

AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML find the role by
account and name, but minted the session ARN from the RoleArn the request
named. A China role assumed with an arn:aws: RoleArn therefore came back as an
arn:aws:sts:: session, while AssumeRole registered the session under the
stored role's ARN, so GetCallerIdentity reported aws-cn. All three handlers
now mint the session from the stored role's ARN when the role exists and
register it under the same ARN.

The credential report was cached once per account, so a report generated for
one partition was handed to a caller in another for four hours, with the
wrong partition's root row. It is now kept per partition.
2026-09-30 20:48:20 -04:00
Priamo Germosen 4e2c1d11ff fix(sts): evaluate AssumeRole trust-policy conditions against the real caller (#4716)
With IAM enforcement on, AssumeRole matched a trust policy on its Action and
Principal only. The Condition block was never read and the ExternalId request
parameter was ignored, so a role guarded by sts:ExternalId, the documented
confused-deputy guard, could be assumed without it, and a conditional Deny
applied whether or not its condition held.

Trust-policy conditions now go through IamPolicyEvaluator's condition engine,
through a new package-private conditionMatches, so they get the same operators
as identity and resource policies. The request context holds sts:RoleSessionName,
sts:ExternalId when the caller sends one, the global keys the enforcement filter
already provides, and aws:PrincipalArn.

A role session is now matched as the role that issued it, through that role's
own ARN, path included. AssumeRole records it on the session when it issues
one, and a new IamService.resolvePrincipalArn reads it back as is, so an old
session keeps naming its role even after a same-named role replaces it. The
evaluator used to rebuild the role ARN from
the assumed-role session ARN, which names the role without its path, so a
session of role/team/App was compared as role/App: a Principal naming the role
refused it, and a condition on aws:PrincipalArn saw the wrong value. IAM stores
a Principal naming a role as the role's unique ID, and aws:PrincipalArn is the
ARN of the role that was assumed, so both are the full role ARN.

A negated operator on an absent key now holds, as the IAM User Guide says for
every condition operator but the IfExists forms and Null: "If the policy
condition requires that the key is not matched, such as StringNotLike or
ArnNotLike, and the right key is not present, the condition is true."
evaluateConditionBlock failed every operator on an absent key, so once trust
conditions were evaluated a Deny with StringNotEquals on sts:ExternalId stopped
refusing a call that omits ExternalId. The change is in the shared engine, so
identity, resource and SCP conditions get the same rule; the set operators keep
their own rule for an absent key.

The AppSync service-trust path from #4555 had its own small condition evaluator
for aws:SourceArn and aws:SourceAccount. It now uses the same engine with those
two keys as its context, which also makes negated operators such as
StringNotEquals work there instead of refusing the document. A Condition that
is not an object of non-empty operator objects still invalidates the whole
trust document, now on every path.

The trust check also resolved the caller's account from the Authorization
header alone, where only a 12-digit key names an account. An IAM user's or a
role session's key, and any presigned request, therefore counted as the default
account and could assume a role that trusts only that account. The check now
uses the account the request was resolved to, and reads a presigned caller's
key from X-Amz-Credential.
2026-09-30 17:39:45 -05:00
Abhigya 55d37cfc41 feat(ecs): let the startup container sweep be turned off, and derive the credentials proxy owner from the shared helper (#4696)
* feat(ecs): let the startup container sweep be turned off, and derive the credentials proxy owner from the shared helper

The ECS startup sweep removes every task container carrying this deployment's
floci_owner_port label, so two Flocis sharing a Docker daemon with the same API
port and no resource namespace remove each other's task containers. EC2's sweep
already has an opt-out; ECS now has the same one,
FLOCI_SERVICES_ECS_RECONCILE_CONTAINERS_ON_STARTUP (default true). With it off,
containers are left alone and tasks start at once. The recorded load balancer
targets and Cloud Map instances are still released, since each Floci releases
only what its own persisted state recorded.

EcsCredentialsProxy.owner() now uses ContainerStorageHelper.ownerIdentity and
OWNER_LABEL instead of its own copy of the rule.

* fix(ecs): leave task-role credentials proxies alone when the startup sweep is off

The credentials proxy removed every proxy carrying this deployment's owner label
at startup regardless of reconcile-containers-on-startup. With the sweep off for
two instances sharing an owner identity, the second instance's startup still
tore down the first's proxy, and its running tasks lost their credentials
endpoint. The proxy's startup reap now follows the same setting.
2026-09-30 17:22:46 -05:00
Allen Sanborn 18128b432a fix(organizations): start a new root with no policy types enabled (#4756)
CreateOrganization (and EnableAllFeatures) seeded the root with
SERVICE_CONTROL_POLICY already ENABLED, so the first EnablePolicyType a
caller issues was rejected with PolicyTypeAlreadyEnabledException. That
is exactly what Terraform's aws_organizations_organization does with
enabled_policy_types right after CreateOrganization, so the common
"create the org and turn on SCPs" configuration failed at its first
resource.

On AWS a new root has an empty PolicyTypes list: the provider's
acceptance test for a plain organization asserts roots.0.policy_types
is empty, and its enabled_policy_types test enables SCPs on a fresh
organization successfully.

DescribeOrganization's AvailablePolicyTypes used to read the root's
list, which is what the seed was standing in for. It is now reported
separately and, as AWS documents for the deprecated field, lists only
SERVICE_CONTROL_POLICY for an ALL organization.

Tests that relied on the seed now call EnablePolicyType first, as a
real caller must. The CloudFormation test creates the stack without its
SCP, enables the type, then adds the SCP by UpdateStack, because no
CloudFormation resource enables a policy type.
2026-09-30 18:12:38 -04:00