On AWS, deleting or updating a GSI the table does not have fails with
ResourceNotFoundException "Requested resource not found: Index <index>
for table <table>", with the table name even when TableName is an ARN.
Floci used its own message for a delete and a ValidationException for an
update.
* feat(route53resolver): apply resolver rules to DNS resolution
Resolver rules were stored and ignored. The embedded DNS server now consults them
before resolving a name itself, via two CDI SPIs so core.common.dns imports neither
Route 53 Resolver nor EKS: DnsForwardingRuleSource supplies the rules associated with
one VPC, DnsClientVpcSource maps a query's source address to the VPC it came from.
FORWARD rules forward the raw query to their TargetIps, each on its own port, in a
random order with the next target tried when one does not answer. SYSTEM and RECURSIVE
rules carry no targets and hand the query back to Floci, so a SYSTEM rule carves a
subdomain out of a broader FORWARD. Matching is exact-or-subdomain on label boundaries
and the most specific matching rule wins. A rule takes precedence over a private hosted
zone matching the same name, as AWS documents. Floci's own suffixes and ec2.internal
names resolve locally whatever the rules say, as AWS autodefines system rules for its
internal domains. A rule whose targets are all unreachable answers SERVFAIL for that
query only.
Route53ResolverDnsForwardingRules reads the rule and association stores through
Route53ResolverService across account partitions, since the packet path has no caller.
EksClusterManager claims its cluster node container addresses for the cluster's
resourcesVpcConfig.vpcId.
* fix(route53resolver): scope rule DNS lookups to the querying account
AssociateResolverRule stores whatever VPCId the caller names without proving
ownership of it, so joining associations across account partitions by VPC id let
one account redirect another account's cluster DNS by naming its VPC. The DNS
client VPC now carries the account alongside the VPC id, and the rule source
reads only that account's associations.
Rules are fetched by id instead of scanned for, so a query reads only the rules
an association named rather than the whole rule store, and registration warns
when a running cluster's container addresses cannot be determined instead of
leaving its rules silently inert.
Also stop setting the authoritative bit on the SERVFAIL answer for a forwarded
query: Floci is not the authority for a name a rule sends elsewhere.
* style(route53resolver): import Optional instead of qualifying it inline
* fix(route53resolver): scope rule DNS lookups to the querying region
Route 53 Resolver is regional, so a rule created in one region governs nothing in
another, but the DNS path matched on account and VPC alone. A rule created in
eu-west-1 therefore steered a query from a VPC in us-east-1. The DNS client origin
now carries the region, and a rule is only applied when its own region matches.
The stores carry no region in their keys, so a rule's region is read back from the
ARN the service minted for it rather than reshaping the stores. A stored rule with
no parseable ARN has no region to claim and is treated as belonging to the region
asking, which no create path can produce.
Associations are now read as rule ids rather than as nodes, so a query no longer
deep-copies a record per association when all it needs is which rules to look at.
* test(eks): pin the warning when a cluster's addresses cannot be determined
Inspecting the node container can fail, and when it does the cluster gets no VPC
mapping and its queries quietly ignore every associated resolver rule. Nothing
fails, so the warning is the only way a reader finds out, which makes it worth a
test rather than leaving it to inspection.
Levels are compared by severity rather than identity because JBoss LogManager
has its own Level constants, so its WARN is not java.util.logging's WARNING.
Glue had no workflows: CreateWorkflow, StartWorkflowRun and the rest
answered InvalidAction. Add CreateWorkflow, GetWorkflow, ListWorkflows,
BatchGetWorkflows, UpdateWorkflow, DeleteWorkflow, StartWorkflowRun,
StopWorkflowRun, ResumeWorkflowRun, GetWorkflowRun, GetWorkflowRuns,
GetWorkflowRunProperties and PutWorkflowRunProperties, and let triggers
belong to a workflow.
StartWorkflowRun fires the workflow's starting triggers inside a new
run. The workflow's conditional triggers fire only on job runs and
crawls of that run, evaluate AND within it, and start their actions in
it; job runs get --WORKFLOW_NAME and --WORKFLOW_RUN_ID. A run completes
once nothing in it runs and nothing more fires. GetWorkflow and
GetWorkflowRun report the graph of trigger, job and crawler nodes.
Closes#4380
* fix(dynamodb): reject an unknown BillingMode
CreateTable, UpdateTable and ImportTable accepted any BillingMode and
treated an unknown one as PROVISIONED. AWS rejects it with a
ValidationException before looking up the table. ImportTable reports the
member as tableCreationParameters.billingMode.
* fix(dynamodb): check an import's BillingMode before its ClientToken
On AWS an ImportTable retry with the same ClientToken and an unknown
BillingMode fails with the BillingMode ValidationException, not with
ImportConflictException. The check now runs before the token lookup.
GetLogEvents and FilterLogEvents sorted every stored event in the
stream or group before applying the startTime/endTime (and, for
FilterLogEvents, the filter pattern) window. Apply the cheap per-event
filters first so only the events that survive the window get sorted;
results, ordering, and pagination tokens are unchanged.
* fix(dynamodb): size numbers by base-100 digit pairs
DynamoDB stores a number as base-100 digits paired from the decimal point.
It costs one byte per pair plus one, and one more when negative. Floci
counted the characters of the number text, so items full of numbers hit
the 400 KB limit too early or too late, and capacity was off too.
On AWS, 110 and 0.015 cost 3 bytes, 1100 and 0.0015 cost 2, 3.14159
costs 5 and 1E125 costs 2.
* fix(dynamodb): drop the sign byte at 20 pairs and survive huge exponents
On AWS a negative number of 20 base-100 pairs costs 21 bytes, the same as
a positive one. Below 20 pairs it costs one byte more.
A number whose exponent overflows BigDecimal's scale now falls back to its
text length instead of throwing, and the pair math runs in long.
* fix(dynamodb): brace the number size branch
* fix(dynamodb): charge a number set only for its members
On AWS an NS set costs the sum of its members and nothing per member.
{"NS":["1"]} costs 2 bytes like {"N":"1"}, and ["1","2","3"] costs 6.
A request carrying no Authorization header returned before any policy check, so with enforcement on an unauthenticated caller reached every emulated API by simply omitting the header.
Refuse one whose wire shape names a management operation: a JSON, CBOR or Query claim exists only for a request carrying X-Amz-Target, an rpcv2 path or an Action parameter. AWS answers a credential-less request with MissingAuthenticationToken at 403, returned here in the encoding the request used.
Operations AWS itself serves without credentials stay allowed, taken from the authtype: none trait in its service models: the Cognito user-pool and identity flows and the two web-identity and SAML AssumeRole calls. The list is keyed by service because GetUser needs no credentials on cognito-idp and requires them on iam.
REST is left alone. This filter also sees the API Gateway execute path, Lambda function URLs, CloudFront serving and the Cognito OIDC endpoints, which are unsigned by design, and a REST claim does not say which service will serve the request.
The CBOR error shape moves into CborErrorResponses, shared with the rpcv2 controller so the two cannot drift into answering the same failure differently.
EksIrsaDockerIntegrationTest set up its IAM fixtures over unsigned Query calls and so began failing: CreateRole is not an operation AWS serves without credentials. Its fixture calls now carry the root stand-in credential, which is what every other test does under enforcement. The AssumeRoleWithWebIdentity calls it actually tests stay unsigned, as AWS serves those without credentials.
tagKeyListType members are tagKeyType, so the 1-128 length and the tag
character pattern apply to TagKeys on every untag action, not only to the
keys sent when tagging. extractTagKeys only checked the count, so an untag
with an empty, overlong or malformed key succeeded. The key checks now live
in one helper shared by extractTags and extractTagKeys, and a rejected
untag removes nothing.
* fix(ecs): reconcile persisted services at boot
EcsService is ApplicationScoped, so Quarkus only creates it on the first
ECS request, and creating it is what loads the ECS stores and starts the
reconciler. After a restart every persisted service stayed without tasks,
load balancer targets or Cloud Map instances until something called the
ECS API.
EmulatorLifecycle now calls EcsService.restorePersistedRuntime() after
storage is loaded and the load balancers are restored, the way it already
restores RDS, ElastiCache and ELBv2.
* test(ecs): assert boot starts the ECS reconciler through CDI
A failed restore released the reserved proxy port and persisted the record
with port 0, so the next boot allocated the lowest free port in iteration
order and renumbered the endpoints: an old DSN then reached a different
database and failed auth. The retry path also dereferenced the nulled
endpoint.
Failed instance and cluster restores now keep their port and endpoint
reserved, as proxies already did. Persisted ports are also reserved for
their owners before any restore allocates, so a record without a port
cannot take one that a later record persisted.
Follow-up to #4411, both items raised by hectorvent in that review.
ensureReady checked the pool's reset generation before registering its
new container in the map, not after: a stopAll() landing in the gap
between that check and the registration could still run its own sweep
over the map without finding the container (it was not in the map
yet), then have the registration land afterward with nothing left to
ever stop it, the same leak the generation check was meant to close in
the first place. A second variant let a stopAll() land between the
sweep and the map clear, wiping the entry stopAll() itself never got
the chance to visit.
Registering first and only then comparing the generation, removing and
stopping locally on a mismatch rather than trusting whatever stopAll()
may have already done to the map, closes both: either stopAll()'s own
sweep finds the container because the registration already landed, or
the registration lands after the sweep and the generation check catches
it. stopAndRemove already tolerates a double-stop of the same container
(both its stop and remove calls treat "already gone" as success), so
there's no failure mode where both paths race to clean up the same one.
Also drops VerdaccioSidecarManager's class javadoc reference to the
CodeArtifactService repository-record walk that #4411 removed; it was
describing something that no longer exists.
The wiring landed in #4486 but none of the four
FLOCI_SERVICES_ECS_TASK_ROLE_CREDENTIALS_* settings were written down
anywhere, and nothing said the credentials proxy needs a user-defined
Docker network rather than the default bridge.
Adds them to the environment variable reference, the application.yml
example and the ECS service page, the last with a short section on how
the endpoint is reached and the two cases where a task does not get
credentials: one that sets its own, and one under security-group
enforcement.
Also fixes two things the same work left behind in the source. The
cleanupProtectedNetwork javadoc was orphaned when
prepareTaskRoleCredentials was inserted between it and its method, and
two config javadocs still described the wiring and the proxy as
follow-up work.
* fix(ec2): include the security group helper Dockerfile in the native image
With security group enforcement on and no helper image on the daemon, the native image failed every EC2 launch with "Floci helper Dockerfile is missing". The Dockerfile is read with getResourceAsStream, which the native image only serves for listed resources.
* fix(docker): omit DNS servers for containers that share another container's network
Docker rejects DNS servers together with container:<id> network mode, so an EC2 instance or ECS task under security group enforcement failed to launch whenever Floci ran in a container, where it injects its embedded DNS. The container already uses the resolver of the container whose network it shares, the same reason extra hosts are left out.
* fix(ec2): give the security group helper Floci's DNS and host entries
A workload under enforcement joins its helper's network namespace and uses the helper's resolver and hosts file, where DNS servers and extra hosts on the workload itself are not allowed. The helper had neither, so a workload could not resolve Floci's endpoint hostname when Floci ran in a container.
* chore(config): check that helper Dockerfiles are in the native image
LocallyBuiltHelperImage reads its Dockerfile through a method parameter, which the constant check cannot follow.
* fix(ec2): let workloads reach their DNS servers whatever their security groups allow
Docker's resolver listens on loopback but forwards from the workload's network namespace, so a security group without UDP 53 egress left the workload unable to resolve any name. On AWS, security groups never filter traffic to the VPC resolver. The firewall now always allows port 53 to the helper's DNS servers.
* chore(ec2): keep each security group helper's DNS servers with the helper
Service fields stay final, and a helper no longer takes the DNS servers of the last helper created.
* fix(ec2): read a security group helper's DNS servers from its container
Keeping them in a map leaked an entry for every helper whose task failed before registering, and a helper restored after a restart had none. The rules now take them from the helper's HostConfig, which reconcileAll already inspects.
* fix(ec2): exempt only Floci's DNS from security groups, not the fallback resolvers
On AWS the exemption covers only the Amazon DNS server in the VPC, which Floci's embedded DNS stands in for. A public resolver is ordinary internet traffic that a security group filters, so a group that denies egress now blocks 8.8.8.8 and 8.8.4.4 too.
Program static kernel routes in EKS cluster containers from emulated
VPC route tables associated with the cluster subnets or VPC.
- Implement route table resolution for cluster VPC and subnets
- Resolve EC2 instance and network interface targets to reachable IPs
- Generate idempotent routing shell commands using ip route
- Attach cluster containers to the VPC bridge network when present
- Notify active clusters on route table modifications via VpcRouteTableListener
- Add configuration flag floci.services.eks.vpc-route-programming
- Add unit and Docker integration tests for route programming
* fix(redshift): remove a stale cluster container before creating it
* fix(redshift): keep legacy-named containers when starting a cluster
* test(redshift): drop the zero-ETL cluster teardown
Reject duplicate tag keys in a single request with 400 InvalidInput, matching AWS IAM behavior:
- Users and roles treat tag keys case-insensitively for duplicate checks.
- Policies, instance profiles, OIDC and SAML providers treat tag keys case-sensitively for duplicate checks.
- User and role tag updates preserve existing tag key casing.
- UntagUser and UntagRole remove tags case-insensitively.
- Re-tagging an existing tag with alternate casing stays within the 50-tag quota.
Signed-off-by: Abdul Wali Dal <148618788+abdulwalidal@users.noreply.github.com>
* fix(iot): stabilize MQTT WebSocket bridge sessions
* chore: remove internal planning documents
* test(iot): verify all close overloads and pin MQTT 3.1.1 version in WebSocket tests
* test(iot): coordinate concurrent test cleanup and cover websocket exception path
* fix(cognito): validate PasswordPolicy MinimumLength and remove default of 8
When PasswordPolicy is supplied on CreateUserPool or UpdateUserPool, live Cognito evaluates an omitted MinimumLength as 0 and rejects it with InvalidParameterException against the constraint MinimumLength >= 6. It does not default MinimumLength to 8.
Remove the synthetic default of 8, enforce constraint validation on MinimumLength (6-99), TemporaryPasswordValidityDays (0-365), and PasswordHistorySize (0-24) when PasswordPolicy is provided, and keep documented default of 7 for TemporaryPasswordValidityDays.
Closes#4256
* fix(cognito): reject oversized password policy values
* fix(cognito): reject unparseable password policy integers
Support InstanceId and NetworkInterfaceId in CreateRoute, ReplaceRoute,
and DescribeRouteTables, automatically resolving InstanceOwnerId.
- Parse and store InstanceId and NetworkInterfaceId on Route
- Validate instance target existence and set InstanceOwnerId to caller account
- Enforce single-target mutual exclusion across all supported route targets
- Remove InstanceId and NetworkInterfaceId from UNSUPPORTED_ROUTE_TARGETS
- Render instanceId, instanceOwnerId, and networkInterfaceId in DescribeRouteTables
- Add DescribeRouteTables filter support for route.instance-id and route.network-interface-id
- Document route target support in docs/services/ec2.md
- Add integration tests in Ec2RouteTargetIntegrationTest
- Add AWS SDK compatibility tests in Ec2RouteTargetTest
* feat(ses): paginate template lists and align ListExportJobs paging
Add a namespaced Pagination.paginate overload and SesListPaging, which
holds the probed per-operation page-size bounds, default page sizes,
error messages and empty-token handling. ListTemplates (v1) and
ListEmailTemplates (v2) now page newest first and share one token
namespace, so a token from either continues the other. Without a page
size the template lists serve 10, as SES does. ListExportJobs refuses a
PageSize above 100 instead of clamping it, returns a null NextToken on
the last page, and uses SES's own error messages.
* refactor(ses): inject the template service clock and drop the paging test sleeps
* test(ses): tick the clock between template create and update
* feat(cloudmap): honor service TTL in DNS A answers
* fix(cloudmap): distinguish DNS no-data and reject case collisions
* fix(cloudmap): resolve SRV instance A hostnames
* refactor(cloudmap): simplify DNS answer states and resolver
Give DnsAnswer explicit records, noData and nxDomain factories, drop the
test-only buildAResponse overload, split Cloud Map name resolution into
service and instance-hostname lookups, and parse DnsConfig once on
CreateService.
* fix(cloudmap): lowercase DNS names independent of the default locale
* fix(route53): answer private zone DNS with the record set TTL
Port Route53DnsRecordSource to DnsAnswer after rebasing onto #4353. Answers
carry the record set TTL, a flattened CNAME chain uses the shortest TTL in
the chain, and an alias uses its target's. A name absent from the zone gets
NXDOMAIN; a name with records but no A gets NOERROR with no answers.
* fix(route53): answer empty non-terminals with no data and cap external CNAME TTL
A private zone name with records only beneath it exists in DNS, so it now
answers NOERROR with no A records instead of NXDOMAIN. A CNAME to a name
outside the private zones answers with at most 60 seconds, matching the
alias path, since the target's own TTL is not visible.
* fix(route53): stop wildcards matching at or beneath empty non-terminals
A name with records only beneath it exists, so under RFC 4592 a wildcard
from a farther ancestor must not answer for it or for names below it. The
closer-name check now counts any record sharing an ancestor with the query
name, including wildcard owners, so a closer wildcard also shadows a
parent wildcard.
Add GenerateServiceLastAccessedDetails, GetServiceLastAccessedDetails,
GetServiceLastAccessedDetailsWithEntities and ListPoliciesGrantingServiceAccess.
Floci records no service-access history, but AWS's "never used" shape keeps
the report and nulls the usage fields rather than emptying the report, so
that is what these reproduce. GetServiceLastAccessedDetails lists every
service the entity could reach through its permissions policies and leaves
LastAuthenticated and TotalAuthenticatedEntities absent for the ones never
used. GetServiceLastAccessedDetailsWithEntities lists the entities that
could have used the reported permissions: a group report yields the group's
users, a policy report the users and roles it is attached to, and a user or
role report that entity. Both lists come from permissions-policy logic,
which Floci can evaluate, so both are computed rather than stubbed; the
usage timestamps are the only part left out.
A report is produced when the job is created and stored with it, matching
AWS, where the Get operations retrieve a report that Generate produced. So
editing the policies afterwards does not change what a completed job
answers, and deleting the entity does not stop a valid JobId resolving.
Generate resolves the whole ARN first, rejecting one whose account is not
the caller's or whose path is not the resolved entity's, so it cannot fall
back to a same-named local identity; AWS-managed policy ARNs carry the
literal "aws" account and are allowed through to the global catalog. An
unknown JobId is NoSuchEntity, Granularity is validated and echoed back as
JobType, and both readers honour MaxItems and Marker.
ListPoliciesGrantingServiceAccess needs no job and no usage history, since
AWS defines it purely over permissions-policy logic. A user contributes its
own managed and inline policies plus those of every group it belongs to,
while a group or role contributes only its own; permissions boundaries are
excluded. Only Allow grants, and Allow with NotAction grants every service
the list does not carve out. It models a Marker but no MaxItems, so only the
former is applied.
Services reachable only through a wildcard or NotAction cannot be
enumerated without a catalog of IAM service namespaces, which is tracked
separately in #4487 and documented.
* fix(s3): apply AWS's CreateBucket region rules in every partition
CreateBucket follows the rules moto verified against AWS: the us-east-1 endpoint takes any LocationConstraint but its own (InvalidLocationConstraint), and every other regional endpoint requires a constraint naming exactly its region, answering IllegalLocationConstraintException otherwise. The signing region alone no longer places a bucket, so a China or GovCloud client must send the constraint, which the AWS SDKs do. GetBucketLocation still answers an empty constraint only for us-east-1, in every partition.
WAF's CLOUDFRONT scope lives in the partition's implicit global region and is refused with WAFInvalidParameterException where the partition has no CloudFront. Lightsail lists no regions outside the commercial partition. Region fallbacks read the configured default where a resolver or config is in scope, and PreSignedUrlGenerator gains an overload that signs for a given region. The region-literal category of the partition guardrail is now gated; every remaining literal carries a stated reason.
Tests that created buckets under a regional signing scope with no constraint now send one, and S3IntegrationTest's case that pinned the old signing-region placement is replaced by the rejection and its positive twin.
Part of #4272
* fix(s3,wafv2): answer a us-east-1 constraint off its endpoint as a mismatch, and gate the CLOUDFRONT scope on every operation
A CreateBucket on a regional endpoint other than us-east-1 with LocationConstraint us-east-1 is just another mismatched region, IllegalLocationConstraintException, as moto's aws_verified test_create_bucket_with_wrong_location_constraint records; InvalidLocationConstraint belongs to the us-east-1 endpoint alone (test_bucket_create_force_us_east_1). The body parse no longer rejects us-east-1 early, and bucketRegionForCreate checks the endpoint mismatch first.
WAF's CLOUDFRONT scope was refused in partitions without CloudFront only when creating a resource; validateScope, which every operation already calls, now applies the same check, so a List or Get for that scope answers the same WAFInvalidParameterException.
* fix(wafv2): check the CLOUDFRONT scope against the region each call is about
The previous change checked the scope in validateScope against the request region, but CloudFormation calls the service outside any request, where that region falls back to the deployment default: under a GovCloud default a commercial stack's CLOUDFRONT WebACL was refused on create, update and delete. WafV2Handler now checks Scope=CLOUDFRONT against the region the API request was sent to, before dispatch, so every operation still answers the same error; validateScope checks the enum only, and a create keeps its check against the region it is given where the ARN is built.
* fix(kinesisanalytics): make the savepoints volume writable by the Flink user
Docker creates the savepoints named volume root:root, while the official
apache/flink images run Flink as uid/gid 9999, so the JobManager could not
create /opt/flink/savepoints and every CreateApplicationSnapshot ended
FAILED. Initialise the volume root through
ContainerLifecycleManager.ensureSharedVolume, chowning it to 9999:9999
before the JobManager starts.
Closes#4443
* fix(core): reinitialise shared volume ownership when the volume is recreated
ensureSharedVolume memoised the one-off chown per volume name for the
whole process, so a volume removed and recreated under the same name
(DeleteApplication in memory mode, or docker volume rm) came back
root:root without being initialised again. Drop the memo whenever the
volume has just been created.
Implement DnsRecordSource SPI via Route53DnsRecordSource to decouple Route 53 resolution from EmbeddedDnsServer. Add DnsLookupHelper in core.common.dns for external IPv4 resolution via upstream forwarders with system fallback, shared by Route53DnsRecordSource for CNAME and ALIAS chasing. Discover private hosted zones via Route53Service and support in-zone chasing, built-in Floci suffixes, and EC2 internal names. Authoritatively resolve A records within private zones to prevent upstream query leakage. Wire EKS cluster containers to embedded DNS via specBuilder.withEmbeddedDns().
An MQTT publish ran every matching topic rule action on the Vert.x event loop serving the connection before fanning the message out, so a slow action stalled every client on that loop and delayed delivery to subscribers.
The broker now stores the retained message, records the publish, sends the PUBACK and fans out on the event loop, and hands topic rule evaluation to a single-thread worker executor of its own. IoT Data Publish still evaluates its rules before it returns. At most 1,000 evaluations are pending; beyond that a publish is still delivered but its rules are skipped, with one warning until the backlog drains. A state reset or a broker shutdown skips the rules still waiting, and an MQTT publish received during the reset or while the broker is stopped runs none.
* fix(elbv2): probe the target group's HealthCheckPort instead of always the traffic port
The health checker always probed each target on its traffic port, so a target
group whose HealthCheckPort names a separate port (an app serving traffic on
one port and its health endpoint on another) was marked unhealthy even though
its health endpoint answered. AWS probes HealthCheckPort when it is a port
number and the target's own port when it is traffic-port, the default.
Health state stays keyed by the traffic port either way.
* fix(elbv2): reject a HealthCheckPort that is not traffic-port or a port from 1 to 65535
* fix(cognito): fire PreTokenGeneration when the token endpoint redeems a code
Managed login and federated sign-in both mint their tokens at
POST /oauth2/token, which called generateAuthResult directly and so never
invoked the pre token generation trigger. A pool whose trigger adds claims
got them from InitiateAuth but not from a hosted-UI sign-in, so an
application that authorizes on a custom claim rejected every token a browser
obtained while the same user's tokens from InitiateAuth were accepted.
Redemption now mints through a hosted-auth path that fires the trigger with
triggerSource TokenGeneration_HostedAuth, which is what AWS uses for a
sign-in through the hosted UI, for a pool's own users and federated users
alike. The authorization request's nonce is applied after the trigger's
claims so a trigger cannot displace it; AWS likewise does not let this
trigger override nonce.
* fix(cognito): pass the requested scopes to the hosted-auth trigger
Review feedback. The authorization code stores the scopes the authorize
request asked for, but the hosted-auth trigger call sent an empty list, so a
V2 lambda that branches on requested scopes had nothing to branch on. Thread
the code's scopes through to the trigger event. The other call sites keep
sending an empty list, which is what their non-OAuth flows carry.
Also replace the em-dashes in the new comments, per AGENTS.md.
* fix(cognito): narrow the trigger's scopes to the client's allowed set
Review feedback. An authorization request names its own scopes and nothing
checks them against the client's AllowedOAuthScopes when the code is issued,
so a stored code can carry a scope the client may not use. Passing those
straight through meant a V2 trigger could grant claims, or add scopes, from a
scope the client was never entitled to request.
The hosted-auth path now narrows the requested scopes to the client's allowed
set before the trigger is told about them, dropping the rest the way AWS
ignores a scope that is not associated with the client. The narrowing lives in
the service method rather than at the call site, so every caller gets it.
* style(cognito): brace the new conditionals
Review feedback. AGENTS.md requires braces in all conditionals, and the four
early returns in the claims-merge helpers omitted them.
The trigger loop safeguard kept a chain's run count on the origin run or
crawl and reserved it for whole firings, so it skipped downstream actions
in three cases: a failed start still spent budget, an origin crawl that
aged out of history or whose crawler was deleted ended its chain, and
runs persisted before the bookkeeping existed were refused.
Keep the counts in their own bounded store keyed by origin (least
recently used forgotten past 1000 chains), claim one run per action just
before it starts and give it back if the start fails, and treat a crawl
without a recorded origin as its own origin.
Resolve the plain http:// target of a WebSocket HTTP or HTTP_PROXY
integration once, reject metadata and link-local results, and connect to
the checked InetAddress so the name cannot be re-resolved between the
check and the connection.
The pinned request and its response parsing now live in a shared
PinnedHttpClient that HTTP_PROXY uses too, so both integrations keep the
same bounds: the 10 MB payload quota on the Content-Length, chunked and
close-delimited paths, rejected negative or oversized chunk sizes, and
the CRLF check after each chunk.
The Host header carries the target host and port only, without any
credentials the integration URI holds.
* fix(bedrock-agentcore): expire remembered delete client tokens
Runtime, endpoint, and memory deletes remembered every clientToken of
a completed delete forever, so a long-running emulator would grow an
unbounded set of tokens. Replace the per-service token sets with a
shared DeletedTokenLedger that stamps each token with the time it was
recorded and treats it as absent once it is older than an 8 hour
window, matching the clientToken idempotency window AWS documents for
other control planes (for example DynamoDB's ImportTable and
SageMaker APIs) and already used in this repo's
VerifiedPermissionsService. A replay past that window now 404s like
an unknown token instead of returning the DELETING marker forever,
and expired entries are purged on the next write so the ledger cannot
grow without bound.
* perf(bedrock-agentcore): purge expired delete tokens from the front of a queue
Recording a token scanned every live token to find the expired ones, so
a run of deletes inside the 8 hour window did quadratic work. Tokens
are now also queued in the order they were recorded, and purge pops
only the expired entries at the front. A token reused while its first
record is live keeps the newer record when the older one is purged.
* fix(bedrock-agentcore): keep one ledger entry per delete token
The queue added one entry per record, so a client reusing a token for
many deletes inside the window grew the ledger with the number of
deletes rather than the number of tokens. An insertion-ordered map now
holds one entry per token; re-recording moves the token to the back, and
purge still stops at the first live entry.
* fix(bedrock-agentcore): time delete tokens from their first use
Re-recording a token restamped it, so a token reused every few hours
never expired. The window AWS documents for client tokens runs from the
first request that used the token, so record now keeps the first
timestamp with putIfAbsent. The ledger stays ordered by first use, so
purge can still stop at the first live entry.
* fix(bedrock-agentcore): restart an expired delete token the purge missed
If the wall clock steps back, an expired token can sit behind a live
one where the front purge stops, and putIfAbsent then kept its stale
timestamp on reuse, so an immediate replay 404ed. record now goes
through contains, which drops an expired entry, so reusing it starts a
fresh window.
A presigned POST was authorized against the signing principal's identity
policies alone, so a same-account caller that only the bucket policy named was
denied. The IAM filter now resolves the applicable resource policies on that
path too, letting either policy provide the grant while an explicit deny in
either still wins and cross-account access still requires both.
That resolution now also carries the global condition keys
(aws:PrincipalAccount, aws:ResourceAccount, aws:RequestedRegion) filter()
already supplies for every other enforcement path, instead of only
aws:PrincipalArn, so a conditional bucket-policy statement is judged
consistently between the two enforcement paths.
Per-action, header-derived keys (s3:RequestObjectTag/* from x-amz-tagging)
are deliberately not resolved here: a presigned POST's outer HTTP headers are
not covered by its signed policy document and do not correspond to any tag
S3Controller actually applies to the object, so trusting one would let a
caller satisfy a tag-scoped grant condition without the object ever carrying
that tag.
Closes#4243
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Add DynamoDbRuntime and a DynamoDbBackendLifecycle seam so the emulator lifecycle starts, resets and stops only the selected backend.
Native start initializes the engine before persisted stream consumers and schedules the TTL sweep, which never ran because its bean was unused.
Reset gains a checkReset preflight that runs before anything is stopped or cleared, and native reset now drops streams, item caches, idempotency tokens and forwarder queues.
Reset also pauses the TTL sweep and waits out in-flight zero-ETL writes before Floci storage is cleared.
Shutdown stops the Lambda DynamoDB poller, the Redshift zero-ETL consumer and the Kinesis forwarding drains before the final flush, and the Redshift consumer is now Resettable.
* fix(cloudformation): delete UPDATE_FAILED resources on DeleteStack
A failed update whose rollback cannot restore a resource leaves it
UPDATE_FAILED with its physical id and the stack in
UPDATE_ROLLBACK_FAILED. DeleteStack only walked CREATE_COMPLETE,
UPDATE_COMPLETE and DELETE_FAILED resources, plus UPDATE_FAILED ones
whose provisioner opted in, so every other failed resource was skipped
without an event and the stack still reached DELETE_COMPLETE, leaving
the role, log group or bucket behind.
Delete every UPDATE_FAILED resource that has a physical id. Delete a
CREATE_FAILED resource only when the provisioner marked its entity as
created by the stack, as the create rollback does, since a failed
create can name an entity that existed before.
Closes#4467
* test(cloudformation): clean up the outside log group when the test fails
* docs(cloudformation): list the resource statuses DeleteStack deletes
* fix(cloudformation): mark a failed nested stack the operation created as stack-owned
A nested stack whose child fails during creation came back CREATE_FAILED
with the child's stack id but no ownership marker, so neither the create
rollback nor DeleteStack deleted the child stack.
* test(cloudformation): clean up the stack, role and log group when the test fails
* docs(cloudformation): update the hasPendingRollbackCleanup javadoc now that DeleteStack no longer calls it
extractTags collapsed Tags.member.N into a map before any count was taken,
so a 51-member list with one repeated key slipped through as 50 tags, and
TagUser, TagRole, TagPolicy and TagOpenIDConnectProvider bounded nothing.
The request-shape rules now live in the handler, on the members as sent:
tagListType and tagKeyListType are capped at 50 for every tag and untag
action, keys must be 1-128 characters and values at most 256, both matching
IAM's tag character pattern, with errors naming the offending member index.
Users, roles, policies and OIDC providers now also enforce the 50-tag
per-resource quota (LimitExceeded, as instance and SAML providers already
did), and the tag read-modify-write runs under a lock so two requests that
each fit cannot together push a resource past it.
Closes#4407
Wires the pieces together so a task that declares a taskRoleArn actually gets
credentials. EcsContainerManager issues the task's session, stands the proxy
up on the network its containers join, publishes one relative URI to every
container in the task the way real ECS does, and gives each container its own
address in 169.254.0.0/16 so it has a connected route to the endpoint at all.
Credentials and addresses are released when the task stops, exits, or fails
part way through a launch.
EcsTaskLinkLocalAddresses owns the addresses because Docker will not: it
accepts two containers claiming the same link-local address on one network
and then which one answers depends on whose ARP reply wins. Addresses are
tracked per network, since separate networks are separate L2 segments, and
freed with the task.
ContainerBuilder.resolveDockerNetwork exposes the network a spec would land
on, which the allocator needs before the spec exists. withDockerNetwork now
calls the same method rather than keeping a second copy of the resolution.
A security-group protected task is skipped for now and says so: those
containers run in an isolated helper namespace that the proxy's address does
not reach, so issuing credentials there would hand out an endpoint the task
cannot use.
Closes#4483.
* fix(cognito): expire auth challenge sessions
InitiateAuth and RespondToAuthChallenge session tokens for SRP, custom
auth, and USER_AUTH never expired, so an abandoned challenge session
lingered in memory forever and could still be completed long after
AWS would have rejected it. Track when each session was issued and
reject expired ones with the NotAuthorizedException Cognito returns
in that case, purging expired entries whenever a new one is created.
AWS defaults AuthSessionValidity to 3 minutes (configurable 3-15 via
CreateUserPoolClient); UserPoolClient does not yet store a per-client
override, so every client uses the 3 minute default for now.
* fix(cognito): stamp custom auth tokens when they are issued
A CUSTOM_AUTH session's issue time was recorded before the
DefineAuthChallenge and CreateAuthChallenge triggers ran, so a slow
trigger shortened the session handed to the client. The issue time
also lived on the flow state shared across rounds, so minting the next
round's token refreshed the old token while it was still in the map.
Each custom auth token now carries its own issue time, stamped when it
is stored, and every issuance path (including both continuations)
purges expired tokens first.
* style(cognito): brace the custom auth session lookup
* test(cognito): use the shared MutableClock
* docs(cognito): document auth challenge session expiry
* chore: rerun CI
* chore: rerun CI
* fix(apigateway): import x-amazon-apigateway-any-method in the native image and roll back failed imports
The ANY pseudo-operation reaches the service as an untyped extension map, and it was
bound to io.swagger.v3.oas.models.Operation with Jackson bean deserialization. The
swagger model graph is not registered for reflection, so in the native image every
ImportRestApi or PutRestApi body with x-amazon-apigateway-any-method failed with
BadRequestException. Parse it with the swagger parser's own Operation reader, the one
that already builds the real verbs, which needs no reflection.
A failed import also left state behind: ImportRestApi kept a half-built API whose id the
caller never received, and PutRestApi left the API cleared and partly rebuilt. ImportRestApi
now deletes what it created and PutRestApi restores the API-scoped state it replaced.
* chore(apigateway): import swagger Json instead of qualifying it inline
A cluster-mode-disabled replication group reported a ConfigurationEndpoint
alongside NodeGroups[0].PrimaryEndpoint. AWS only returns ConfigurationEndpoint
for a cluster-mode-enabled group, and terraform-provider-aws branches on its
presence: when it is set, primary_endpoint_address and reader_endpoint_address
are left null.