* feat(redshift-serverless): validate requests against the AWS model constraints
Generate the input constraints (required members, length, pattern, enum,
number range, list size) from botocore's Redshift Serverless model with
tools/aws/regen_redshift_serverless_shapes.py and vendor them under
src/main/resources/aws, like the DynamoDB request shapes. A new
RedshiftServerlessRequestShapes check runs before dispatch and answers a
ValidationException. Pagination members are left to the services, which keep
reporting InvalidPaginationException.
Move the request parsing and error helpers that the JSON handler, the usage
limit service and the service each carried a copy of into ServerlessSupport,
so the resource families that follow share one implementation.
* fix(redshift-serverless): address review findings on request validation
- Match a model pattern against the whole value, so an unanchored pattern such
as the account id no longer accepts a value that merely contains a match.
- Count string lengths in Unicode code points, so a tag of 200 supplementary
characters is not rejected for exceeding 256 UTF-16 units.
- Validate only the actions the handler implements, so a modeled but
unsupported action keeps answering UnknownOperationException.
- Read every string member through ServerlessSupport.text and reject a tag key
or value that is not a string, so a numeric nextToken or tag member is a
ValidationException instead of being treated as absent or coerced.
- Regenerate the vendored shapes from botocore 1.43.113, the version
tools/aws/requirements.txt pins.
- Cover the rejected-request case with a state check, and add the pattern, code
point, page token and tag regressions.
* refactor(redshift-serverless): use VendoredResources, ServerlessSupport.notFound and update docs
DeleteRoute removed the local route CreateRouteTable seeds for the VPC CIDR
and reported success. Since CreateRoute answers RouteAlreadyExists for that
destination, the route table was left without intra-VPC routing and with no
way to put the route back. DeleteRoute also reported success for a
destination the table does not hold, hiding caller mistakes.
Reject the seeded local route with InvalidParameterValue and report an
unknown destination with InvalidRoute.NotFound, matching AWS. The route is
identified by its CreateRouteTable origin, so a route repointed by
ReplaceRoute stays undeletable while repointed.
The CloudFormation route restore path now tolerates the already-gone
InvalidRoute.NotFound case through CfnDeletes.safeDelete.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* feat(stepfunctions): emit execution status change events to EventBridge
STANDARD executions now publish "Step Functions Execution Status Change"
events (source aws.states) to the default EventBridge bus on RUNNING,
SUCCEEDED, FAILED, TIMED_OUT and ABORTED, so rules matching aws.states
fire as they do on AWS. EXPRESS executions emit nothing, as on AWS.
StepFunctionsEventPublisher follows the EcsEventPublisher pattern.
RUNNING is published when StartExecution creates the execution, terminal
statuses from the worker's completion callback, and ABORTED from
StopExecution only, so a stopped execution emits exactly one ABORTED.
An idempotent StartExecution and the startup sweep of executions
abandoned by a restart emit nothing.
* fix(stepfunctions): match the documented execution status change event
Address review feedback on the aws.states events:
- Always send stateMachineVersionArn and stateMachineAliasArn, null
when unused, as AWS's documented events do.
- Report redrive status as the documented examples do: FAILED and
TIMED_OUT are REDRIVABLE with "Execution is <status> and is
redrivable"; RUNNING, SUCCEEDED and ABORTED are NOT_REDRIVABLE with
"Execution is <status> and cannot be redriven".
- Name States.Timeout as the error of a TIMED_OUT event.
- Apply the 248 KiB rule: input is left out when the escaped input
and output together exceed it, output when the escaped output alone
does, and inputDetails/outputDetails.included report it.
* test(stepfunctions): check event absences without waiting on empty queues
The integration test long-polled SQS for 2 s after each case to show
nothing more arrived, so the class waited about 10 s by design. It now
asserts only the events that should arrive. The absences that matter
are checked in StepFunctionsServiceExecutionEventsTest: it captures the
completion callback from a mocked AslExecutor and verifies that an
EXPRESS execution publishes nothing and that the worker's callback
after StopExecution adds no second ABORTED.
Add StepFunctionsExecutions.waitForTerminalState to the shared testing
package and use it here; moving the other Step Functions integration
tests onto it is left for a separate PR.
* feat(cloudformation): apply AssociatedRoles on RDS clusters and instances
AWS::RDS::DBCluster and AWS::RDS::DBInstance ignored AssociatedRoles,
so a CDK DatabaseCluster with s3ImportBuckets deployed with no role on
the cluster.
The roles are now associated when the resource is created, through the
same checks as AddRoleToDBCluster and AddRoleToDBInstance; a list RDS
refuses fails the resource and deletes the new database. An update adds
the roles the template gained and removes the ones the previous
template declared and this one drops, so a role associated outside the
stack is kept. An Aurora cluster member carrying its own
AssociatedRoles is a ValidationError, as the schema calls the property
not applicable there. addRolesToNewDbCluster now also refuses a role
named twice in its own list.
Closes#5638
* fix(cloudformation): follow AWS on repeated roles, and check before changing a database
A renamed instance's predecessor was deleted before the new instance
took its roles, so a refused list left neither; the roles now go on
first. The property is resolved before it is read, so Fn::If around the
list or an entry works and AWS::NoValue leaves it out, and any other
value that is not a list is a ValidationError rather than "no roles".
Repeated roles follow AWS's handlers: an instance skips a role or
feature already associated (AWS ignores DBInstanceRoleAlreadyExists),
while a cluster's list is checked first on an update too, and a role
the template newly declares is always added, so one attached by hand
fails the update with DBClusterRoleAlreadyExists. A rolled back cluster
replacement also restores the record of which roles the stack declared.
* fix(cloudformation): undo a failed role update's own changes
An update changed roles one at a time, so when a later step was
refused the roles it had already added stayed on the database while
the stack restored its old record, and a retry failed on them with
DBClusterRoleAlreadyExists. A refused step now removes the roles the
update added and puts back the ones it removed before the error is
reported. The cluster check also takes the template's engine, now that
it checks feature names, and the roles record reader catches only the
JSON parse error.
* fix(apigateway): resolve imported request model references
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(apigateway): snapshot request model schemas for deployments
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(apigateway): match the default body validation error
Signed-off-by: Andre Kurait <akurait@amazon.com>
* test(apigateway): expect the AWS default validation message
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(apigateway): address model snapshot review findings
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(apigateway): resolve model URLs from deployment snapshots
Signed-off-by: Andre Kurait <akurait@amazon.com>
* test(apigateway): make model reference cases collectable
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(apigateway): accept canonical model URLs in every partition
Signed-off-by: Andre Kurait <akurait@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
* feat(lambdaweb): Lambda Web Functions control plane
The lambda-web service model (apiVersion 2025-03-07) signs as lambda, so
it is served under the lambda service at /2025-03-07/... with the AWS
wire shapes, state words and error wording of the 20 operations on web
functions, revisions, endpoints, tags and the resource policy.
Revisions and endpoints converge at once. They are stored Active and an
endpoint update is stored Successful, while the create and update
responses report the transitional state AWS reports, so a CLI waiter
settles on its first poll. Code comes from an S3 object that must exist.
IamAuth, the resource policy and the endpoint domain are stored but not
served yet.
Part of #5699
* fix(lambdaweb): carry the page position in the token
The nextToken of a list operation was a UUID keyed into an in-memory
anchor map that only grew and was not scoped to the account. The token
is now a core Pagination cursor that encodes the request (operation,
region, account, function, filters and page size) and the cursor of the
item the page ended on. A token reused with other parameters gets the
AWS "does not match the request" error and any other token the AWS
"invalid or has expired" error.
AWS issues UUID tokens and rejects any other shape, so Floci no longer
reproduces the pattern error for a malformed token.
* fix(iam): resolve a Lambda Web revision or endpoint named by its ARN
The route resource for IAM enforcement took the path segment after
revisions or endpoints as the id. A revision or endpoint ARN in that
position carries slashes, so the resource ARN ended in the ARN's first
segment and a policy scoped to the revision or endpoint did not apply.
The id is now the last segment of such an ARN.
* fix(lambdaweb): add the values of a repeated state filter
AWS lists a function when any state filter in the request names its
state. A later state filter replaced the earlier one, so a request with
state=Active followed by state=Failed listed nothing.
* fix(lambdaweb): refuse empty arrays in a resource policy
AWS answers an empty Action or Resource array with the policy syntax
error and an empty principal array with the invalid principal error,
which wins when all three are empty. Floci stored such a policy.
* fix(lambdaweb): judge a wildcard principal by the operator and value of its condition
A trusted condition key alone kept an Allow for every principal out of
the public check. AWS blocks the policy unless a positive operator pins
the key: StringNotEquals and the IfExists forms do not count, nor does a
wildcard in an account value or in the account field of an ARN value,
while a wildcard elsewhere in an ARN and a literal * under StringEquals
do.
Schedule release-cut.yml at 00:30 on the 15th and on days 28-31 with timezone America/Chicago, so GitHub handles DST. A gate job passes only on the 15th or on the actual last day of the month; manual dispatch is unchanged. The release-cut concurrency group moves to the release job so skipped scheduled runs never hold or replace a pending cut.
README.md, CONTRIBUTING.md and the docs/ pages now describe the new train: stable releases on the 15th and the last day of each month, cut automatically at 00:30 US Central time.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(ui): add a light and dark theme toggle to the landing page
The landing page was dark only. A button in the top bar, shown on the
dashboard and on the /_floci/ui wait view, switches between a dark and a
light theme. With no choice made the page follows the OS colour scheme,
including a change while it is open; a choice is remembered in
localStorage under floci.theme, next to the news setting, and the page
still switches for the current view when storage is blocked. The theme
is set by the head script before the stylesheet paints, so a light page
does not flash dark on load.
The dark palette is unchanged. The light one keeps the same accent
family with every text colour at 4.5:1 or better against the page
backgrounds, and the five colours that were written as literals (logo
dot, button text, code snippets, error box, the copied border) are now
variables both themes set.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(ui): name the emulator in the top bar and keep a page-view theme choice
The page will be shared by the other Floci emulators, so the top bar now
says which one serves it, floci-aws, next to the logo, and the page title
and the version pill's tooltip name it too.
A theme picked with the toggle while storage is blocked could be undone
by an OS colour-scheme change later in the same page view, because the
OS listener only checked the stored choice. The click is now remembered
in memory as well, so the OS is followed only until the user picks.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* chore(ui): pin the floci-ui console image to 0.7.0
The console image defaulted to floci/floci-ui:latest, and a cached
latest tag is never pulled again, so a machine kept whatever console it
first downloaded. The default is now the released 0.7.0 tag, in the
config default, application.yml and the three docs tables that list it.
FLOCI_SERVICES_UI_IMAGE still overrides it.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
A ${...} in a Resource pattern or a Condition value was matched as the text it
is written as, so a statement scoped to arn:aws:iam::*:user/${aws:username}
matched no user at all. AWS's own IAMUserChangePassword policy is written that
way and floci vendors it verbatim, so under enforcement it authorized nothing,
and it is not alone: 244 of the 1586 vendored managed policy documents carry a
variable, and of the 1635 occurrences in them 1443 sit in a Condition value
and 192 in a Resource. The Condition share is where the loss bites hardest,
since a variable that cannot resolve quietly drops a Deny that AWS honours.
The keys a variable resolves against arrived with #5568, which put
aws:username, aws:userid and aws:PrincipalType into the request context. This
is the other half of that work: without substitution the keys answer nobody,
and without the keys substitution has nothing to find.
Variables now resolve wherever the evaluator matches a statement, which covers
every document it reads: identity policies, resource policies, session
policies, permissions boundaries, SCPs, and the Condition of a role trust
policy, whose own Version now reaches the condition check. A trust policy is
the narrow case, since sts:AssumeRole is authorized before there is a session
to describe: that context carries aws:PrincipalArn, the account and region
keys, sts:RoleSessionName and sts:ExternalId, so a variable naming
aws:username, aws:userid or aws:PrincipalType finds nothing there, which
iam.md now says.
Two of the rules are easy to miss. Substitution is gated on "Version":
"2012-10-17", because under the older 2008-10-17, which is also the default
when the element is absent, the user guide says variables "are instead treated
as literal strings in the policy"; the version therefore rides on each parsed
statement, since statements from many documents are evaluated as one list. And
a variable with no value is not an empty string: in Resource the pattern "will
not match any resource", in NotResource that same rule excludes nothing, and
in a Condition the positive operators do not match while the inverted ones do,
which is what makes the Deny AWS documents for an unset principal tag fire.
The rest, also from the user guide: a variable resolves only in the resource
portion of an ARN, after the fifth colon; only with the string and ARN
condition operators, never Numeric, Date, Bool, IpAddress or Null; only for a
single-valued key, a multivalued one having no one value to stand in, which a
default does not rescue, since a default answers a key with no value rather
than one with several; and case-insensitively by key name, a name that holds
no space, the guide allowing one inside a quoted default and nowhere else. A
spaced name, an empty ${}, a missing brace and an unquoted default are the
forms the guide's policy checks call errors, and each stays the text it is.
${*}, ${?} and ${$} stand for a literal character, so the glob gained an
escape marker, honoured only on a pattern that came back from substitution and
stripped from whatever arrived in the policy: a document can write the marker
as a JSON escape, and reading it as one would turn a wildcard of the
document's own into a literal character and narrow the statement it sits in. A
resolved value is not escaped, matching AWS, whose policy checks warn that
variables "can be evaluated as effective wildcards".
Verified at this commit: 7442 tests across the 439 IAM, core, enforcement and
resource-policy classes the evaluator is reached from, Checkstyle and
docs-check clean. AWS's own IAMUserChangePassword document is attached to a
user and called on the request path, both of its patterns included, the second
scoping a user under a path. Each rule was probed by reverting it alone, which
is how two weak tests were found: a valueless variable beside a wildcard and
the operator restriction both needed a case whose answer flips. The escape
marker is probed from both sides, by letting the resolver keep one that
arrived in a policy and by honouring markers on every pattern rather than only
a substituted one, and each side fails a different case of the same test.
RequestCertificate answers an explicit empty SubjectAlternativeNames
array with a 400 ValidationException, as ACM does: the API requires at
least one name in the list. CloudFormation certificate resources keep
accepting an empty list and request the certificate for the domain
name alone, as before.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* feat(opensearch): allow configuring a data volume for domain containers
* fix(opensearch): isolate configured storage and prepare bind mounts
Include account and Region from the domain ARN in configured volume
names and bind paths, preserving the optional deployment namespace.
Treat missing ownership markers as FLOCI_MANAGED and remove name-based
ownership inference. Retain explicitly operator-owned storage and use
persisted volume names for managed cleanup.
Reuse the storage helper container lifecycle to prepare bind-directory
ownership and owner write access from the selected image. Leave existing
files untouched, propagate preparation failures, and release reserved
ports when storage preparation fails.
Preserve Linux daemon path syntax on Windows while keeping native
Windows paths and named volumes working.
Consolidate OpenSearchDomainManagerTest setup, add regression coverage
and a Linux Docker integration test, and update configuration comments
and documentation examples.
Fix an existing bug where opensearch container names did not include
account or region id.
* fix(partitions): source the China CloudFront suffix and GovCloud API Gateway zones
Two values listed as open questions have a published source in the China and
GovCloud user guides, so they become vendored facts in aws/region-facts.json
instead of a commercial constant.
A generated CloudFront distribution domain name ended in cloudfront.net in
every partition. The China guide's CloudFront page names the default domain
there as *.cloudfront.cn
(https://docs.amazonaws.cn/en_us/aws/latest/userguide/cloudfront.html), and
the commercial suffix is the one in the example name of the botocore
CloudFront model (Distribution$DomainName, DistributionSummary$DomainName).
floci.services.cloudfront.domain-suffix loses its cloudfront.net default and
becomes optional: unset, the suffix follows the request's partition, with the
commercial one where a partition has no CloudFront; set, it applies in every
partition as before. CloudFront distributions and streaming distributions,
Cognito and AppSync custom domains and edge-optimized API Gateway domains all
resolve it through CloudFrontEdgeDomain.domainSuffix.
A regional API Gateway custom domain reported one placeholder hosted zone id in
every region. The GovCloud guide's API Gateway page states the regional
endpoint zone for us-gov-west-1 (Z1K6XKP9SAGWDV) and us-gov-east-1
(Z3SE9ATJYCRCZJ)
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-abp.html);
those two regions now report it, and the generator resolves each region
through its description in partitions.json. No source gives the zone for any
other region, which keeps the placeholder and stays an open question.
The generator reads both sentences from either rendering of a guide page: the
page text, or the Markdown AWS serves at the same URL with .md, which escapes
the asterisk in the CloudFront sentence.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(partitions): require each sourced fact and resolve edge domains in the request's partition
The GovCloud API Gateway page parser accepted a page stating only one
region's regional hosted zone, so an edited guide would have dropped the
other zone from region-facts.json without failing. It now requires a zone
for every aws-us-gov region.
The region-facts self check validated cloudfrontDomainSuffix only when it
was present. It now requires the suffix for aws and aws-cn, and the
regional hosted zone for both GovCloud regions, as it already requires
consoleHost; a missing commercial suffix would otherwise have reached
the orElseThrow in CloudFrontEdgeDomain.domainSuffix at runtime.
CloudFrontEdgeDomain.create resolved its partition from the region alone,
falling back to the commercial one, so an AppSync or API Gateway custom
domain in a region no partition publishes (allowed under
allow-unknown-regions) took the commercial suffix and hosted zone in a
China deployment. It now takes the partition the caller's RegionResolver
resolves, which falls back to the deployment's partition, as the
CloudFront and Cognito paths already do.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Supports npm, pypi, and nuget, matching AWS's own documented restriction
for this action (not maven, Swift, generic, Ruby, or Cargo, which carry
no readme in real CodeArtifact).
Neither npm nor pypi can answer this live after the fact. A real
Verdaccio packument GET hoists readme to the top level only, for the
single most-recently-published version, and drops the per-version field
from its own response entirely, even though a real npm client's publish
envelope genuinely sends one per version (confirmed against a live
Verdaccio 6.10.4 container with a captured real npm-publish fixture).
pypiserver has no description field anywhere in its model or its RPC2
route (confirmed by reading pypiserver's own source at the pinned
version), so it never had a live path to begin with.
Both formats are therefore captured at publish/upload time instead:
npm's per-version readme field is read off the real publish envelope by
NpmPublishEnvelopeScanner and recorded after a successful forward to the
Verdaccio sidecar, and pypi's is read off the upload form's description
field the same way it already was. Both go through the same
recordPublishedPackageVersionReadme method and the same
packageVersionReadmes account-scoped store, cleaned up on
DeleteRepository and DeletePackage the same way packageOriginConfigs
already is. nuget is accepted as a valid format but always 404s, since
nothing in Floci implements the real NuGet wire protocol and no nuget
package version can ever exist here.
Refactors validatePackageToken to delegate to a new non-throwing
isValidPackageToken, reused by the readme capture path (fed raw
publish/upload input, never through the JSON API's own validation) to
guard the same escape-collision invariant escapeKeySegment depends on.
Extracts the container-backed revision synthesis already used by
GetPackageVersionAsset into a shared helper so GetPackageVersionReadme
reports a consistent revision for the same version coordinate.
A Smithy RPC v2 call names its operation in the path, /service/<service>/operation/<operation>,
not in a Query Action or an X-Amz-Target header. Enforcement found no action for it, and an
unknown action is allowed, so under enforcement any known key could run any operation of SQS, SNS,
DynamoDB, Kinesis, Step Functions, CloudWatch or Marketplace over RPC v2, explicit denies included.
Enforcement also took the call's shape from the protocol claim, which the claim filter reads before
routing, while the CBOR endpoint dispatches whatever its route matched. The two disagree in
several ways:
- An unrecognised smithy-protocol value leaves the call unclaimed. With strict claiming off, the
default, it is still served, so an unsigned call was not refused.
- An X-Amz-Target header on the call named the operation it was checked as, while the path named
the one that ran.
- A path with a prefix before /service/ is claimed as RPC v2 while another route serves it.
The filter now reads the service and operation from the route the call reached, the values the
endpoint dispatches. It authorizes that operation as the action AWS checks for it, under the
serving service's namespace, and records the call's claim, so the unsigned refusal and the CBOR
error format apply whatever its smithy-protocol header says. A call on any other route is handled
as before.
The resources and condition keys a request names in its body were read only from JSON, and a CBOR
body fell back to a wildcard resource: a deny on one queue, table or stream did not apply, a grant
on one did not match, and a ForAllValues dynamodb:LeadingKeys condition granted every key. The
body is now read as CBOR when its content type says so, on the RPC v2 path and on the
x-amz-cbor-1.1 one, which had the same gap.
Under IAM enforcement, SES published event-destination events and identity notifications to
whatever SNS topic it was configured with, through an internal call nothing checked, so a caller
refused sns:Publish could still put messages on a topic by pointing a configuration set at it. On
AWS, SES publishes as ses.amazonaws.com and the topic's policy decides: it has to allow SES, under
an aws:SourceArn naming the configuration set or identity whose configuration names the topic.
- ServiceCallAuthorizer decides a call one AWS service makes to another's resource on its own
behalf from the target's resource policy alone, read through the same providers the request
filter uses and picked by the target ARN's service. A target with no policy refuses, and with
enforcement off every call is allowed. ResourcePolicyProviders collects what the providers
supply, for the filter and the authorizer alike.
- IamConditionContextResolver.serviceCallContext builds that call's request context from the IAM
User Guide's global keys: aws:PrincipalIsAWSService, aws:PrincipalServiceName and
aws:PrincipalServiceNamesList, aws:SourceArn and aws:SourceAccount, aws:ResourceAccount and
aws:RequestedRegion, and none of the keys that describe an IAM principal. A publish to an SNS
topic from SES also carries aws:SourceOwner, which the SNS Developer Guide lists SES among the
services setting, and which the default topic policy checks.
- SnsResourcePolicyProvider supplies a topic's policy and the account in its ARN, also when the
topic does not exist. A topic with no Policy attribute gets the default a new topic has, for the
topic's own account. Topic policies so also take part in a JSON-protocol request that names a
topic, as any resource policy does.
- SesEventPublisher asks before publishing to SNS: for an event destination with the configuration
set's ARN, for an identity notification with the ARN of the identity that names the topic, the
sender's own or its domain's, both with the sending account. A refused event is dropped. A
notification SES cannot publish, because the topic is gone from its own account or its policy
refuses SES, also takes the topic out of the identity's bounce and complaint settings and turns
email feedback forwarding back on, as the SES Developer Guide describes; a delivery setting
stays. The identity's notification settings are written under the identity lock, so that
write and an API call changing them cannot lose each other.
- CreateReceiptRule and UpdateReceiptRule ask the same question of an action's TopicArn, with the
rule's ARN as aws:SourceArn, and answer InvalidSnsTopic when the topic's policy does not let SES
publish, which the SES API Reference lists as "could not publish to the topic, possibly due to
permissions issues". The rules still route no mail.
- A resource policy statement that names the caller only through its account, by its id, root ARN
or S3 canonical user ID, delegates to that account (IAM User Guide, "AWS account principals"):
across accounts it is still the owner's half of the grant, but within the account it no longer
grants on its own, and the caller's identity policies have to allow the request. Floci let such
a statement grant on its own, for bucket and function policies already, so a topic policy naming
its own account would have let every user of the account publish.
- A Deny's NotPrincipal follows the IAM User Guide ("AWS JSON policy elements: NotPrincipal"): it
spares an IAM caller only when it names the caller's account as well as the caller, since without
the account AWS "might deny access to the entire account", and never spares one with a permissions
boundary attached, which it "will always deny". CallerArns says whether a boundary is attached to
the user or to the role a session assumed. An Allow's NotPrincipal still grants everyone it does
not name, as Access Analyzer warns it can.
* fix(cognito): reject token validity outside AWS's limits
CreateUserPoolClient and UpdateUserPoolClient accepted any positive token
validity, so a client with one-minute access and ID tokens, or a
20-minute refresh token, worked locally and failed on deploy. AWS allows
access and ID tokens between 5 minutes and 1 day and refresh tokens
between 60 minutes and 3,650 days, in each token's TokenValidityUnits
unit (hours for access and ID tokens, days for refresh tokens, by
default). A client outside them now fails with InvalidParameterException
"Invalid range for token validity.", the message AWS returns.
floci.services.cognito.enforce-token-validity-limits (env
FLOCI_SERVICES_COGNITO_ENFORCE_TOKEN_VALIDITY_LIMITS, default true) turns
the check off for tests that want tokens shorter than AWS allows.
* test(scheduler): start recurring test schedules in the future
Since #5610 a rate schedule's first occurrence is its creation time, so
a schedule is due the moment it exists. The application's own dispatcher
keeps ticking every 10 seconds during @QuarkusTest and sees every
schedule, so a tick that lands between CreateSchedule and the test's own
dispatcher fires the schedule once more than the test expects.
Four tests create an enabled rate(1 minute) schedule and count exact
deliveries: recurringScheduleStartsOneExecutionPerOccurrence,
stepFunctionsDeleteScheduleStopsFutureOccurrence,
rateScheduleDeliversEachOccurrenceWithItsScheduledTime and
executionIdsDifferBetweenOccurrences. They now create the schedule
through SchedulerTestHarness.createRecurringSchedule, which sets a
StartDate a day ahead, and tick past it on their scoped dispatcher. The
application's dispatcher skips a schedule before its StartDate, and the
test profile and its tick interval stay as they are.
* test(compat): poll OpenSearch domain readiness every 250 ms against Floci
OpenSearchTest waited for the domain to finish processing in its own loop
that slept 5 s between checks and swallowed InterruptedException. Floci
flips Processing to false on its own 3 s readiness poll, so the test
could sit up to 5 s past the moment the domain was ready.
The wait now goes through TestFixtures.await, polling every 250 ms
against Floci and keeping the 5 s cadence against real AWS, with the
same 3 minute timeout.
* fix(opensearch): run domain containers under an init process so a stop ends them at once
The OpenSearch image's entrypoint is a bash script that starts the server
as its child instead of exec'ing it. Running as PID 1, that script ignores
SIGTERM, so every DeleteDomain, and every shutdown for each domain, waited
out the whole 5 s stop timeout before Docker sent SIGKILL. The server
never saw the SIGTERM either way.
Domain containers now run under Docker's init process, which takes the
SIGTERM and ends the container at once. Stopping a ready 2.11.1 container
took 5.27 s (exit 137) without it and 0.26 s (exit 143) with it, and
DeleteDomain in the compatibility OpenSearchTest took 5.3 s.
The two startDomain tests' shared setup moves into one helper, which the
new init test uses too.
* fix(cognito): keep a RefreshTokenValidity of 0 at 30 days in any unit
AWS replaces a RefreshTokenValidity of 0 with "the default value of 30
days". Floci stored the bare number 30 in the client's refresh token
unit, so a client with RefreshToken=minutes issued 30-minute refresh
tokens. With the token validity limits, any later UpdateUserPoolClient
that left the validity alone re-checked that stored 30 minutes and
failed with "Invalid range for token validity.", for a client Floci had
accepted.
A 0 now becomes 30 days in the client's refresh token unit (2592000
seconds, 43200 minutes, 720 hours or 30 days), on create and on update,
and the limits check runs on that normalized value. Also imports UUID on
a test line that spelled it out in full.
* fix(cognito): reset the settings UpdateUserPoolClient omits to their defaults
AWS: "If you don't provide a value for an attribute, Amazon Cognito sets
it to its default value." The developer guide adds that an update with
one parameter "sets all others to a default value". Floci kept the
stored value of every setting the request left out, so a client could
end up with a combination AWS never produces: an AccessTokenValidity of
60 kept from a minutes client, read in the hours of a units-only update,
was refused as out of range, where AWS resets the validity and accepts.
CreateUserPoolClient and UpdateUserPoolClient now build their settings
in one place, with a new client's default for each one the request
omits, and the update copies them onto the stored client. ClientName is
the exception: the API documents no default for it, so an update without
one keeps the name. The id, the secrets, the dates and the branding are
not settings and stay as they are. An explicitly empty list still clears
the setting.
The AuthSessionValidity tests and the boto3 compatibility test that
asserted the old keep-on-omit behaviour now expect the 3-minute default.
* test: share one self-signed and one user-cert TLS profile across the TLS integration tests
CustomDomainTlsIntegrationTest, TlsEnsureHostIntegrationTest, TlsHttp2HostRoutingIntegrationTest and EcrTlsDataPlaneDockerIntegrationTest each declared a self-signed TLS profile whose static block wrote its own CA-issued leaf before boot, and under @QuarkusTest that leaf is the one served. They now share SelfSignedTlsProfile, which writes one leaf for all four: the SANs TlsConfigSource uses by default, without 127.0.0.1, plus the API Gateway custom domain the HTTP/2 test routes to. The custom domain and ensure-host tests connect by IP and expect a name the leaf doesn't cover yet to be refused, and the JDK falls back to the peer address when the SNI name doesn't match, so a 127.0.0.1 SAN would let those handshakes through. The leaf and its metadata are written fresh every run, which also drops hostnames an earlier run learned at runtime, and the container CA bundle the ECR test relied on is written beside them.
TlsIntegrationTest and TlsUserCertIntegrationTest declared the same user-provided certificate setup apart from paths. They share UserCertTlsProfile, which keeps the certificate file carrying its private key, since TlsUserCertIntegrationTest checks /_floci/ca.pem never echoes it.
Both profiles live in the config test package, beside every class that uses them and the package-private default SAN list, and expose their paths as compile-time constants, so a test can read them without initializing the profile class and rerunning its static block under the running application.
Sharing an application also means no class may leave anything behind for the next. TlsHttp2HostRoutingIntegrationTest now removes the bucket, CloudFront public key, key group and distribution, and the REST API, domain name and base path mapping it creates. EcrTlsDataPlaneDockerIntegrationTest deletes the manifest it pushes, TlsIntegrationTest its queue and TlsUserCertIntegrationTest its parameter. CustomDomainTlsIntegrationTest and TlsEnsureHostIntegrationTest already end with a state reset, which keeps the configured names from the profile's metadata, so neither changes the leaf a later class is served.
The ECR test's registry container also outlived every run: keep-running-on-shutdown defaults to true and the test config never overrides it, and the next application to start adopted the container by name, a developer's own Floci registry included. SelfSignedTlsProfile now names it in the run's sidecar namespace, which SidecarContainersProfile exposes for this, and stops it at shutdown. The test checks for Docker through SidecarContainersProfile.requireDockerAndImage, so a registry a killed run left behind is removed like any other abandoned sidecar.
Part of #4542.
---------
Co-authored-by: Priamo <pgermosen@gmail.com>
* fix(appconfig): serve legacy deployed configuration requests
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(appconfig): keep 404 for an unknown application or profile
GetConfiguration now maps only a missing environment to
BadRequestException, as a missing or undeployed environment was
observed on AWS. An unknown application or configuration profile stays
ResourceNotFoundException (404), as the API reference lists.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(appconfig): note GetConfiguration error codes
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* feat(rds): refuse role feature names the engine does not support
AddRoleToDBInstance, AddRoleToDBCluster and CreateDBCluster
AssociatedRoles stored any FeatureName, so Lambda on a MySQL instance
was accepted although MySQL supports no role features.
A FeatureName now has to be one the engine lists in
SupportedFeatureNames, matched without regard to case, or the call is
InvalidParameterValue; CreateDBCluster refuses before any cluster
exists. A cluster role with no feature, and an engine the catalogue
does not list, are left alone. Aurora PostgreSQL also lists Bedrock,
which the Aurora user guide offers next to Comprehend and SageMaker.
Closes#5631
* refactor(rds): keep the two-argument cluster role check
Callers that check an AssociatedRoles list without knowing the engine,
such as the CloudFormation provisioner in #5656, keep the signature they
compile against; it runs the same checks without the feature check.
* fix(rds): match feature names without regard to case in every role check
The supported-feature check matched without regard to case, but the
instance duplicate check and both removal lookups compared exactly, so
an instance could take s3Import and then s3import as two roles. All of
them now match the same way. The two-argument cluster role check, which
nothing here calls, is removed.
* feat(dynamodb): add typed time-to-live operations to the table access
DynamoDbTableAccess gains timeToLive and updateTimeToLive next to the
stream operations. The native engine reads the TTL flag and attribute
from the table definition and calls DynamoDbService.updateTimeToLive
under the scope's account; the Local engine sends DescribeTimeToLive
and UpdateTimeToLive.
* fix(cloudformation): apply TimeToLiveSpecification on DynamoDB tables
An AWS::DynamoDB::Table declaring TimeToLiveSpecification reached
CREATE_COMPLETE while DescribeTimeToLive answered DISABLED, because the
provisioner never read the property.
The provisioner now reconciles TTL against what the table reports, so
UpdateTimeToLive is called only when the setting differs: enabled turns
it on, Enabled false or a block removed on an update turns it off with
the current attribute name, and renaming an enabled attribute fails with
the DynamoDB ValidationException before anything changes. Enabled with
no AttributeName fails with ValidationError before the table is created.
An in-place table update now records the tags, stream and TTL setting
it replaces, and rollbackUpdate puts all three back, so a stack whose
update fails on a later resource ends UPDATE_ROLLBACK_COMPLETE instead
of UPDATE_ROLLBACK_FAILED. A restore that throws keeps the snapshot.
* fix(cloudformation): roll back and clean up failed DynamoDB table provisions
A table's in-place update that failed after its snapshot, for example on
UpdateTimeToLive after the tags and the stream had changed, lost the
snapshot: the engine put the previous resource back and reported
UPDATE_ROLLBACK_COMPLETE with the changes still live. The provisioner
now retains a failed attempt that carries its snapshot, so the engine
hands it to rollbackUpdate. A failure before the snapshot changed
nothing and still uses the engine's restore.
A provision that failed after createTable left the new table behind,
on create and on a replacing update alike. The provisioner now deletes
a table this attempt created, tolerating ResourceNotFoundException, and
never one it adopted or updates in place. A delete that fails is logged
and leaves the physical id and the rollback ownership marker, so the
stack's create rollback retries it. A table recreated because the
update target was gone takes no snapshot, since it has no prior state.
* fix(cloudformation): match the AWS status reasons for invalid TimeToLiveSpecification
Renaming an enabled TTL attribute and enabling TTL without an
AttributeName now fail with the handler message AWS CloudFormation
reports, as measured in eu-west-1, and with its InvalidRequest handler
error code. The resource status reason is the AWS inner text exactly;
the type and logical id prefix are gone, since AWS does not include them.
* fix(cloudformation): scope DynamoDB table TTL to the stack and validate Enabled
- An update leaves TTL alone when neither the template nor the previous
one declared TimeToLiveSpecification, so TTL enabled outside the stack
survives, as on AWS.
- A TimeToLiveSpecification without Enabled, or with a non-Boolean one,
fails model validation before the table is created.
- A replacing update whose created table cannot be deleted reports a
rollback failure naming the table instead of leaving it untracked.
* fix(rds): list Aurora engines in DescribeOrderableDBInstanceOptions
DescribeOrderableDBInstanceOptions returned nothing for aurora-mysql or
aurora-postgresql, so clients that pick an instance class from the
orderable list could not create Aurora cluster instances. Add the
default Aurora MySQL (8.0.mysql_aurora.3.05.2) and Aurora PostgreSQL
(16.3) versions with db.t3.medium, db.t4g.medium, db.r5.large and
db.r6g.large.
* fix(ec2): honour block-device-mapping.volume-type in DescribeImages
The filter fell through to the default case and matched every image.
Registered images now match on any block device mapping's EBS volume
type, mirroring block-device-mapping.snapshot-id. Catalog images model
no block devices, so an optional rootVolumeType catalog field carries
the type where the AMI name states it (gp2 for the Amazon Linux 2
image, gp3 for the hvm-ssd-gp3 Ubuntu images); images without it match
no value. DescribeImages output is unchanged.
* fix(rds): report general-public-license for aurora-mysql orderable options
* fix(ec2): carry catalog root volume type into the image's EBS mapping
* fix(ec2,rds): address review on catalog AMI mappings and Aurora default version
- Catalog AMI root mappings no longer advertise an invented SnapshotId that
DescribeSnapshots cannot resolve (EbsBlockDevice.SnapshotId is optional);
a copy or capture still mints a real root snapshot.
- RunInstances sizes the root volume type from the AMI's root mapping,
falling back to gp3, so the gp2 catalog AMI launches a gp2 root.
- aurora-mysql defaults to 8.0.mysql_aurora.3.05.2, the version
DescribeOrderableDBInstanceOptions lists.
* test(ec2): assert the volume-type filter, not a single gp2 volume
Instances launched earlier in the class now get gp2 roots from the gp2
catalog AMI, so filtering on gp2 returns several volumes. Check every
result is gp2 and the created volume is among them.
* test(rds): read EngineVersion with XmlPath, import RequestSpecification
* fix(ec2): honour a RunInstances root BlockDeviceMapping volume type
A request BlockDeviceMapping naming the AMI's root device overrides the
AMI's root VolumeType, as on AWS; previously the launch always took the
AMI mapping, so a gp3 root on the gp2 Amazon Linux 2 AMI came out gp2.
* test: explicit RequestSpecification type in Ec2IntegrationTest (NoVar checkstyle rule)
* refactor(ec2): fold RunInstances BlockDeviceMappings into the placement overload
Adds the mappings parameter to the existing hostId/tenancy overload
instead of a new one, and updates the two callers that named that
signature: Ec2RunInstancesPublicIpParamTest's stub/verify (whose
unmatched stub returned null and NPE'd the handler) and the
dedicated-host race test.
* fix(ec2): apply launch template block device mappings and capture the real root type
RunInstances and CreateFleet now layer the request's BlockDeviceMappings
over the launch template's (a request entry for a device replaces the
template's), so a template asking for a gp3 root is honoured instead of
the AMI's gp2. CreateImage records the instance's actual root volume type
on the new AMI's root mapping rather than the source AMI's.
A mapping naming a VolumeType outside the model's enum (standard, io1,
io2, gp2, sc1, st1, gp3) is rejected with the same InvalidParameterValue
ModifyVolume returns, through one shared check.
The RunInstances-only parser is gone: request mappings are read by the
launch template parser, which already treats every member as optional.
* test(rds): fold the Aurora default-version orderable check into RdsCatalogueReadIntegrationTest
* fix(autoscaling): launch group instances with the template's block device mappings
Auto Scaling scale-out now hands the launch template's BlockDeviceMappings
to runInstances, as RunInstances and CreateFleet do, so a group launched
from a template that asks for a gp3 root gets a gp3 root instead of the
AMI's type. Mixed-instances templates take the same path; launch
configurations pass none.
* test(ec2): template devices the request does not name still apply
Covers a launch whose request maps only a data device: the template's
root mapping still sets the root volume type. Also covers a template
naming an unknown VolumeType, which CreateLaunchTemplate stores and the
launch rejects; the EC2 docs paragraph now says so and is rewrapped to
the file's width.
* fix(ec2): merge launch template block device mappings field by field
EC2 documents template block device overrides per member: a request entry
for a DeviceName the template maps changes only what it sets, and every
other member keeps the template's value. The merge replaced the whole
entry, so a request that only resized the root dropped a template's gp3.
The merged entry is now built from a copy of the template's, overlaid
member by member, leaving the stored template untouched.
* fix(accessanalyzer): route GetAnalyzer through GET /analyzer/<name>
Adds getAnalyzer service method and GET /analyzer/{analyzerName} endpoint
in AccessAnalyzerController to return analyzer details. Returns
ResourceNotFoundException (404) when analyzer does not exist. Adds
integration tests for retrieval and not found cases.
Fixes#5353
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* docs(accessanalyzer): sync the action table for GetAnalyzer
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(accessanalyzer): share not-found helper and align docs/service matrix
Extract a shared analyzerNotFound helper that returns ResourceNotFoundException
with resourceId/resourceType (analyzer) for both get/delete. Remove trailing
blank lines from the controller. Update docs/services/index.md to list 4
operations. Run make docs-sync to keep action tables in sync.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(accessanalyzer): reuse getAnalyzer in deleteAnalyzer and assert not-found fields
deleteAnalyzer repeated getAnalyzer's validate-and-lookup; it now calls
getAnalyzer before deleting, so the lookup and the not-found error live in
one place. The 404 test now checks the resourceId and resourceType the
shared helper adds, and the stray blank line before the class's closing
brace is gone.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): implement GetRequestedServiceQuotaChange
RequestServiceQuotaIncrease now persists the requested change so
GetRequestedServiceQuotaChange can read it back by id. An unknown request
id returns NoSuchResourceException, matching AWS.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): unique id, region-scoped storage, history reads store; tests and docs
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): update consumer test for UUID ids and distinct requests
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(servicequotas): refuse a second open increase request per quota
AWS allows only one open service quota increase request per quota, so a
repeat for the same quota in the same region must return
ResourceAlreadyExistsException. Since every request stays PENDING, the
duplicate check and the store are now one atomic unit under a lock, closed
over the per-region store.
Tests that asserted distinct ids now assert the exception, and the two
@QuarkusTest classes reset emulator state before each test so an open
request left by one test cannot refuse the next.
Move the service test's private in-memory StorageFactory into
io.github.hectorvent.floci.testing as a shared helper; migrating the other
copies is a follow-up.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(rds): inherit cluster IAM settings for new members
* fix(rds): keep new member authentication in step with cluster changes
* fix(rds): allow metadata reads during member creation
* fix(rds): keep member creation consistent with lifecycle changes
* fix(rds): preserve metadata access during instance reboot
* fix(rds): use one cluster state for member creation
* test(rds): check IAM authentication consistently
* fix(ses): delete by id and filter by source in /_aws/ses
The inspection endpoint follows LocalStack's contract, as
docs/services/ses.md says, but differed from it in two ways. LocalStack
documents that "The query parameter id can be used to delete only a
specific message", and that "Query parameters id and email can be used
to filter by message ID and message source respectively".
- DELETE /_aws/ses?id=<id> cleared every message. It now deletes only
that message, in whichever region it was sent. An unknown id deletes
nothing.
- GET /_aws/ses?email=<address> matched the address against each
message's ToAddresses. It now matches the message's Source, as
LocalStack does.
GET also listed messages in storage hash order. It now lists them
oldest first by Timestamp, the order LocalStack keeps them in.
Floci's own tests read Cognito codes and other mail with
?email=<recipient>. They now list the mailbox and pick the recipient's
messages out of it, through a new SesMailbox test helper in src/test and
the same filtering in the Java and Node compatibility tests. A raw
send's mailbox entry shows RawData without its recipients, so the test
for recipients read from a raw message's headers checks the stored
record.
* fix(codeartifact): run the pypiserver sidecar under an init process so a stop ends it at once
The pypiserver image's entrypoint execs pypi-server, which installs no SIGTERM handler. The kernel
gives PID 1 no default signal actions, so the container ignored every stop request and went only
when Docker sent SIGKILL at the end of the 5-second timeout: each reset, repository delete and
shutdown waited that long for every pypi repository's container, one after another.
ContainerBuilder gains withInit(), carried on ContainerSpec as init and passed to Docker as
HostConfig.Init (docker run --init), and PypiserverSidecarManager uses it. Docker's init runs as
PID 1 and forwards the SIGTERM, so a stop now returns in a fraction of a second. Verdaccio already
handles the signal itself and is unchanged.
* fix(firehose): check buffers every second so delivery follows the buffering interval
AWS delivers a Firehose buffer once the first buffer condition is met. Floci checked for elapsed
buffering intervals on a 10-second tick, so a buffer was delivered up to 10 seconds after its
IntervalInSeconds ended: a 5-second interval landed anywhere from 5 to 15 seconds after the first
record. The default tick is now one second; the check is a scan of the in-memory buffers.
FirehoseFlushIntegrationTest's profile only set the same one-second tick, so it is removed and the
class shares the default test application. The compat tests that wait for a delivery checked S3
every 2 or 5 seconds; against Floci they now check every 250 ms, and keep their cadence against
real AWS.
* test: make subclass mocks the default so mocking stays cheap in a loaded test JVM
Mockito's default inline mock maker redefines every class it mocks in the running JVM. A
redefinition gets slow once the test JVM has loaded the Quarkus applications of the classes that
ran before, which in CI is most of the run: a unit class's first test spent seconds building its
mocks, and EmulatorLifecycleTest, which mocks some fifty types, spent 22 seconds. Subclass mocks
generate a subclass instead and redefine nothing. After twelve Quarkus applications in one JVM, the
fourteen Mockito classes whose first test was slowest in CI take 20.5 seconds instead of 41.9, and
their first tests 6.9 seconds instead of 27.8.
mockito-extensions/org.mockito.plugins.MockMaker makes the subclass mock maker the default. A
subclass cannot extend a final class, record or enum, so those mocks go through
InlineMocks.inlineMock and inlineSpy, or @Mock(mockMaker = MockMakers.INLINE), and
EmulatorLifecycleTest's static mock of Quarkus asks for the inline maker. The ContainerSpec mocks
a mocked ContainerBuilder.Builder returned were opaque values, so they are real specs now.
* fix(cloudformation): leave the last rollback's failed delete to ContinueUpdateRollback
#4949 refuses an update over UPDATE_ROLLBACK_FAILED until ContinueUpdateRollback finishes the
rollback, as AWS does. #4834, merged minutes earlier, had seven tests that update over that
status, and main has failed them since c4a809f47.
Six are in CloudFormationSchedulerScheduleIntegrationTest. They now reach their next update the
way AWS requires: ContinueUpdateRollback, which retries the schedule's own rollback, or, where the
replacement's delete has to keep failing, a skip of the schedule. The two whose update was meant to
be blocked by the pending rollback now check that the update is refused.
The seventh shows a real clash. #4949 made a second ReplacementCleanup.rollback retry the delete
the first one could not make, which is ContinueUpdateRollback's job. The Scheduler provisioner also
calls rollbackUpdate inside an update, to undo its own failed call, so after a skip a failed group
move deleted the earlier orphan there and then, and a failure of that delete would have failed the
move's restore. An update now ends that retry as it starts, through
ReplacementCleanup.endRollbackRetry, so the orphan stays owed for the next committed update or the
stack delete, as both changes document.
Three more provisioners roll an update back before ReplacementCleanup.record has cleared the retry,
and each returns as soon as the retry ran, skipping its own restore. CloudWatchDashboard and
IotAuthorizer unwind a failed in-place update that way, and CognitoResourceServer's failed attempt
is rolled back the same way, so after a skip the update's snapshot was never put back while the
resource was reported restored. They end the retry as an update starts too.
---------
Co-authored-by: Priamo <pgermosen@gmail.com>
* fix(cloudwatch): route public Query GET requests correctly
Reuse Query dispatch and IAM classification for supported CloudWatch GET requests while preserving S3 and presigned URL routing.
* test(cloudwatch): verify Query header name casing
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): match signed Query GET errors and add SDK coverage
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(test): isolate TLS fixtures and escape invitation passwords
Signed-off-by: Andre Kurait <akurait@amazon.com>
* chore: declare directly used dependency APIs
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): enforce Query GET authentication and IAM policies
Signed-off-by: Andre Kurait <akurait@amazon.com>
* chore: follow existing framework dependency declarations
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): simplify signed Query GET routing
Reuse the existing presigned credential resolver and let the signing scope select CloudWatch before browser or target headers. Match the current and legacy API versions observed in AWS, and cover header/presigned IAM checks. Remove unrelated CI fixture changes from this PR; they remain on the ASG branch.
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cloudwatch): isolate Query GET routing and authentication
Signed-off-by: Andre Kurait <akurait@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(cognito): refuse user pool custom domains in GovCloud
The AWS GovCloud (US) User Guide lists "Custom domains for user pools are
not available" among the Cognito differences
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-cog.html),
but CreateUserPoolDomain and UpdateUserPoolDomain treated a
CustomDomainConfig the same in every partition. In a GovCloud region the
request only failed later, on the us-east-1 certificate check, with a
message about the certificate rather than about the feature.
Both operations now refuse a CustomDomainConfig when the request region is
in aws-us-gov, before the certificate is looked at, with an
InvalidParameterException, which the cognito-idp model declares for both.
No source shows AWS's message, so the wording is Floci's own, as for the
API Gateway EDGE gate. Prefix domains keep working in GovCloud. EUSC is
left as it is because no source covers it, and China and the ISO
partitions have no user pools.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(cognito): refuse user pool custom domains in EUSC too
The European Sovereign Cloud guide lists user pool custom domains as not
available, in the same words as the GovCloud guide, so a
CustomDomainConfig in eusc-de-east-1 is now refused with
InvalidParameterException instead of falling through to the us-east-1
certificate check.
The issued-certificate ACM stub the user pool domain unit tests each
carried a copy of moves to one helper, CognitoCertificateStubs.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
The AWS GovCloud (US) User Guide lists "AWS Lambda Function URLs is not
available"
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-lambda.html)
and the China guide "Amazon Lambda Function URLs is not available in the
China Regions"
(https://docs.amazonaws.cn/en_us/aws/latest/userguide/lambda.html), but
CreateFunctionUrlConfig created one in every partition, on a host no
source publishes for either of them.
CreateFunctionUrlConfig now refuses a request whose region is in
aws-us-gov or aws-cn with an InvalidParameterValueException, which the
lambda model declares for the operation. No source shows AWS's message,
so the wording is Floci's own, as for the API Gateway EDGE gate. The
AWS::Lambda::Url provisioner creates through the same service method, so
a stack in those partitions fails with that error. Get, Update and Delete
act on an existing config and are unchanged. The ISO and EUSC partitions
are left as they are because no source covers them, and the open
question about the function URL host now names only those two.
The Java compat suite skips LambdaFunctionUrlTest in those two partitions,
so the China partition nightly stays green.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Under enforcement a request naming its operation, in a Query Action or an
X-Amz-Target header, was authorized as <namespace>:<Operation>, the operation's
own name. AWS authorizes some operations as an action of another name: SQS
SendMessageBatch, DeleteMessageBatch and ChangeMessageVisibilityBatch as
sqs:SendMessage, sqs:DeleteMessage and sqs:ChangeMessageVisibility, and SNS
PublishBatch as sns:Publish. None of the batch names is an IAM action, so a policy
AWS honours for a batch call was denied, and a policy naming the batch operation
granted something AWS does not check.
AWS publishes the mapping in the Operations of each Service Reference file.
tools/aws/regen_iam_authorized_actions.py vendors the operations authorized by
exactly one action of their own namespace under another name, 235 over 33
namespaces, into src/main/resources/aws/iam-authorized-actions.json. Everything else
keeps its own name. The generator leaves out operations that list:
- several actions, whose extras apply only when tags or a role are passed;
- no action, which is missing data;
- an action of another namespace;
- another action while one of the operation's own name exists;
- a tagging action alone;
- the same action for several SDK clients, which AWS can authorize differently,
as S3 and S3 Control's GetPublicAccessBlock;
or whose name is listed again with another answer. A record of the wrong shape
fails the run instead of being skipped.
make iam-authorized-actions-check gates the file's shape on pull requests that touch it, and
iam-authorized-actions-verify, run by the IAM Data Drift workflow, checks every
entry against AWS.
IamAuthorizedActions reads the file through the new core.common
VendoredResources, rather than adding one more copy of the read-or-fail block a
dozen catalogs carry, and the Query and X-Amz-Target paths ask it for the action.
DynamoDB TransactGetItems, which AWS authorizes as dynamodb:GetItem, keeps its own
name: the transaction check recognizes the call by it and checks every Get as
dynamodb:GetItem on its own table, with its own dynamodb:LeadingKeys. Renamed, the
call would skip that check and be authorized as one GetItem whose body has no
top-level Key, which a ForAllValues condition accepts, so a fine-grained policy
would grant every key.
The check for operations AWS serves without credentials reads the Query action
directly, rather than through resolve with a placeholder scope, now that resolve
returns the authorized action. A Query request naming no action is not one of them.
An SDK compatibility test covers SendMessageBatch and PublishBatch, granted by
the single-item action and refused under the batch name, with enforcement on.
Under IAM enforcement, a Lambda task naming a function in another account was refused outright,
because Floci evaluated no Lambda function policy when #5079 added the check, and a task on a
function in the state machine's own account was not checked at all. Function policies now take
part in authorization (#5476), so a task is decided the way Lambda decides the Invoke call the
execution role makes (Step Functions Developer Guide, "I can't invoke a Lambda function from
another account"): within one account the role's policies or the function's policy can allow it,
and across accounts both have to (IAM User Guide, cross-account policy evaluation logic).
- LambdaTaskAuthorizer evaluates the role's policies, its permissions boundary and its account's
SCPs together with the function policy LambdaResourcePolicyProvider supplies. The role ARN has
to name an existing role, path included, matched as STS AssumeRole matches one
(IamService.roleArnMatches), and the role is evaluated under the ARN IAM holds for it.
- The task is authorized against the function ARN LambdaArnUtils.functionArn gives for its
reference: a full ARN as written, a name or partial ARN completed in the state machine's
partition, Region and account, with the version or alias it names, as Lambda authorizes an
invoke.
- A task whose Credentials name a role invokes the function as that role, once the execution role
has assumed it (Developer Guide, Task state "Credentials"). The role's trust policy has to allow
the execution role, with the state machine's ARN as sts:ExternalId, which the cross-account
tutorial's trust policy checks. The execution role's own policies have to allow sts:AssumeRole
on the role too when it is in another account, or when the trust policy names only the execution
role's account, since an account principal delegates to the account (IAM User Guide, "AWS
account principals"); AssumeRolePolicyEvaluator.decide tells the two grants apart. RoleArn is
read the way the task's Parameters or Arguments are. A role the execution role cannot assume
fails the task with States.Permissions, the Developer Guide's error for a task without the
privileges to run.
- A refusal to invoke fails the task with Lambda.AccessDeniedException. The cause names the role's
session as the Step Functions Developer Guide shows it
(arn:aws:sts::<account>:assumed-role/<role>) and ends in the IAM User Guide's context for the
policy type that refused it, explicit denials first, each in AWS's evaluation order: service
control policies, the resource-based policy or role trust policy, identity-based policies, the
permissions boundary.