mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
4afa7d8e9f5c716c4bf16af2eb0291f495ebc708
1208
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4afa7d8e9f |
feat(opensearch): serve the legacy Elasticsearch Service 2015-01-01 API (#5357)
* feat(opensearch): serve the legacy Elasticsearch Service 2015-01-01 API `aws es` and Terraform's aws_elasticsearch_domain call the 2015-01-01 API, which Floci did not route, so every call got UnknownOperationException. ElasticsearchController serves the domain lifecycle, ListDomainNames and the tag operations on that path by delegating to OpenSearchController, renaming only the members the legacy model spells differently: ElasticsearchVersion (bare "7.10", stored as "Elasticsearch_7.10") and ElasticsearchClusterConfig. A legacy create without a version gets Elasticsearch 7.10 rather than the OpenSearch default. * fix(opensearch): reject blank legacy ElasticsearchVersion, report legacy instance types ElasticsearchVersionString's pattern matches no blank or non-string value, so CreateElasticsearchDomain now returns ValidationException instead of storing an empty engine version. ESPartitionInstanceType lists only *.elasticsearch types, so the legacy responses rewrite the store's *.search spelling (including the m5.large.search default). The legacy test methods get distinct @Order values. * fix(opensearch): store legacy .elasticsearch instance types as .search, accept OS_X.Y The legacy API now respells ElasticsearchClusterConfig.InstanceType from *.elasticsearch to *.search on create and update, so the 2021 API reports t3.small.search and the legacy API maps it back. ElasticsearchVersion's OS_X.Y form is stored as OpenSearch_X.Y instead of Elasticsearch_OS_X.Y. Replaces the jakarta.ws.rs wildcard import with explicit imports. |
||
|
|
ec5692dfa2 |
fix(ec2): remove the volume helper container on shutdown (#5551)
* fix(ec2): remove the volume helper container on shutdown The privileged helper that manages loop devices for EBS volumes was started on the first volume operation and never stopped or removed, so it kept running after Floci exited and stayed in the container list. Ec2VolumeBlockDeviceManager now implements ContainerTeardown. On shutdown and on a state reset it looks the helper up by name, detaches the loop devices behind the backing files and removes the container. It never creates a helper only to remove it, and it also collects one left behind by an earlier process. Backing files stay in storage and the next volume operation recreates the helper. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): leave no volume helper after a reset and report failed loop detaches A state reset removed the helper in the container teardown and then started it again to delete the backing files, so the reset ended with a running helper. clear() now removes the helper once the files are gone. The script that releases loop devices before the helper is removed discarded every losetup failure, so the warning that follows could only fire when the exec itself failed. It now records each loop device that would not detach and exits non-zero, while still trying every device and still removing the helper. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
5ea632cc13 |
feat(iam): change the calling user's console password (#5546)
ChangePassword was the last IAM operation held back for a reason that turned out not to hold. It was tracked as blocked on disambiguating a shared Query action name by Version, because Cognito publishes the name too. In fact IAM sits second in inferServiceFromAction's chain and Cognito ninth, and Cognito's form path answers UnsupportedOperation to every request, so adding the name to IAM_ACTIONS routes it to IAM and costs Cognito nothing. A request carrying a credential scope never reaches that chain at all. The operation takes no UserName. The API reference says it changes the password of the IAM user who is calling, and the CLI reference adds that it "can be called by IAM users only. If this command is called using AWS account (root) credentials, the command returns an InvalidUserType error", so a signing key with no stored user behind it, which is Floci's stand-in for that caller, answers InvalidUserType rather than reporting the key as missing. The resource the request is evaluated against needed nothing new: ResourceArnBuilder already resolves the signing user for an action whose UserName is absent, and the vendored action map already authorizes ChangePassword against a user. OldPassword is checked against the stored login profile before the new password is held to the account password policy, so a caller who cannot prove the current password learns nothing about what that policy requires. A mismatch is the one refusal the reference leaves unnamed: every error it publishes for this operation describes something else, so this answers InvalidParameterValue, the common error type AWS publishes for a parameter value a service cannot accept. A successful change clears PasswordResetRequired, which is what lets a user whose password an administrator reset restore their own console access programmatically, and it moves the password_last_changed the credential report reads. The passwordType shape check is now shared and names the member that failed, because this operation has two password members and a caller told that 'password' failed would have to guess which. An absent member and an empty one stay different answers. Two things the login profile needed before a self-service change could be trusted. The comparison and the write are one step under a new loginProfileLock, which every login-profile writer takes: read apart from the write, two requests presenting the same valid old password both pass the comparison and both are told they set the password, while only the later write survives, and a guard one writer skipped would leave a racing UpdateLoginProfile free to overwrite a password a ChangePassword had just promised. And PasswordReusePrevention is now enforced, on UpdateLoginProfile as well, the two sharing one bounded history per profile: the reference defines the value as "the number of previous passwords that IAM users are prevented from reusing" and makes no window mean no prevention. The password the profile holds is refused alongside the superseded ones, which the reference leaves open; read the other way the smallest window the policy accepts would allow setting a password to the value it already has, and would not refuse the change away and straight back that the setting is for. Twelve unit tests, one concurrency test and six integration tests, with each guard probed by reverting it alone: dropping the old-password comparison, the reset-flag clear, the policy check or the check order is caught by the test written for it, and dropping the routing entry leaves the unsigned request answered by Cognito, which is what the routing parity test says too. Dropping the lock leaves five of twenty-four racing requests all told they succeeded with one password stored, neutering the reuse check leaves both refusals silent, and widening the window by one lets it reach a password that has left it. 1668 tests across all 98 IAM and query-routing classes pass at this commit. docs/services/iam.md documents the operation, the judgements, and the one thing Floci still does not model. AllowUsersToChangePassword is accepted and reported but grants nothing: the user guide says the option gives all users in the account access to iam:ChangePassword for only their user and to iam:GetAccountPasswordPolicy, applied at the account level rather than by attaching a policy, while Floci authorizes both from identity policies alone, so under enforcement a caller needs a policy naming their own user however the flag is set. The matrix row moves 166 to 167. |
||
|
|
6b0d0bc378 |
feat(codeartifact): compute DescribeDomain's assetSizeBytes for every format (#5484)
Was hardcoded to 0L unconditionally. Generic-format bytes are summed live from the still-existing PublishPackageVersion records (packageVersions), the same lazily-computed-not-cached pattern repositoryCount already uses. Scoped per still-live repository rather than one scan over the whole domain, matching every other read path's own per-repository prefix. Maven, npm, and pypi have no such record to sum: their publishes go straight to their own sidecar (Reposilite/Verdaccio/pypiserver) and never create one. Each proxy now reports its own successfully-written byte count directly through a new recordContainerBackedAssetBytes, keyed exactly like packageOriginConfigs (region/domain/repository/format/namespace/package, no version), only once it has already decided, in its own terms, that a real write just happened: - Maven: ReposiliteSidecarClient.deployArtifact now returns a DeployOutcome (status plus whether it actually wrote new content), so the idempotent-match short-circuit and a genuine redeployment:false conflict both correctly add nothing. CodeArtifactMavenController parses the GAV path into namespace/package name, including a group/artifact-level maven-metadata.xml upload, which it attributes correctly once the metadata filename itself (not the segment count) tells it apart from a real versioned asset. - npm: NpmPublishEnvelopeScanner's attachment digest loop now also counts the real decoded byte count alongside its SHA-512, so a multi-attachment publish is sized by its actual tarball bytes, not the base64-and-JSON envelope. Recorded only after Verdaccio's own response confirms a 200/201, off the event loop (vertx.executeBlocking, on principle, even though the call itself is cheap); the confirmed-republish short-circuit and a native Verdaccio rejection both add nothing. A native npm unpublish (Verdaccio's unpublish:$all, bypassing this service entirely) is detected separately and cleaned up the same way DeletePackage would have. - pypi: recorded after a real forwarded upload succeeds, under pypiserver's own PEP 503 normalized name so an upload and a later delete spelled differently still address the same count; the byte-identical idempotent short-circuit and the different-content 409 both add nothing. DeleteRepository and DeletePackage both clean up every format's own records (packageVersions and its asset content included) by the same name-based prefix/key, so a repository or package recreated under the same name never inherits a predecessor's bytes. A per-package deletion fence, bumped only by an actual delete (DeletePackage, or a native npm unpublish), replaces a sidecar existence re-check for the race between an in-flight publish's own accounting and a concurrent delete: comparing a snapshot taken before the real write against the fence's current value catches "deleted" and "deleted and republished under the same name" alike, with no network round trip needed to do it, so nothing here holds the service-wide lock across a sidecar call. containerBackedAssetBytes itself is kept in memory only, like the fence, not through StorageFactory: the sidecar content it counts does not survive a Floci restart either, so neither does the count. Verified against real Reposilite, Verdaccio, and pypiserver containers (not just mocks): each Docker-gated integration suite asserts assetSizeBytes increases by exactly the real published/uploaded byte count, stays unchanged across an idempotent retry, and drops back down after a real delete, native unpublish included. Known limitations documented: a maven-metadata.xml for a versioned snapshot is attributed to its version string rather than its real artifact name (still counted correctly in the domain total, just under a misnamed bucket nothing else looks up by name); unpublishing a single version of a multi-version npm package is not detected (this accounting is per-package, not per-version, so there is no narrower count to subtract from regardless). Addresses hectorvent's review on the PR: rebased to pick up #5102's Digests.sha256Hex (the tests were merging clean but failing to compile against current main), stopped containerBackedAssetBytes from surviving a restart the content it counts does not, and closed the native-npm-unpublish gap in the fence's own soundness argument. |
||
|
|
ebae2ba0e0 |
feat(cloudformation): provision Cognito resource servers (#4832)
* feat(cloudformation): provision Cognito resource servers * fix(cloudformation): align rollback tests with deletion cleanup * fix(cloudformation): abandon exhausted Cognito replacement cleanup * fix(cloudformation): verify Cognito resource server ownership * test(cognito): use switch expression for ownership writers * fix(cloudformation): share optional resolution and delete cleanup hooks * fix(cognito): use resource server API addresses for stack lifecycle * fix(cloudformation): avoid repeated Cognito cleanup on stack deletion * fix(cloudformation): keep consumed resource server cleanup removed * fix(cloudformation): abandon exhausted Cognito cleanup * test(cloudformation): cover Cognito resource servers with AWS SDK * fix(cloudformation): validate Cognito scopes and replace missing servers * refactor(cloudformation): keep Cognito resource server change scoped |
||
|
|
0edb6993ce |
fix(ses): require a verified sender to send email (#5156)
SendEmail, SendRawEmail and SendTemplatedEmail (v1) and SendEmail (v2)
accepted any Source or FromEmailAddress, so a send from an address that
was never verified succeeded and landed in /_aws/ses. The SendEmail API
Reference says "The message must be sent from a verified email address
or domain", and AWS rejects anything else with MessageRejected.
The send path now checks every address the developer guide names for
this error ("This error could apply to the "From", "Source", "Sender",
or "Return-Path" address"): the Source or FromEmailAddress, the
ReturnPath or FeedbackForwardingEmailAddress and, on a raw message,
every mailbox of its From header, its Sender and its Return-Path
header. A v2 raw send reads the From header only in place of a missing
FromEmailAddress and accepts any From header when one is given
(probe-confirmed), so the header is checked only then. An address
counts as verified when the address itself, its domain or a parent
domain is a verified identity ("if you create and verify an identity
for example.com, you don't need to create separate identities for
a.example.com, a.b.example.com, user@example.com, user@a.example.com").
The error matches AWS: one MessageRejected, "Email address is not
verified. The following identities failed the check in region
US-EAST-1: <address>, <address>", and nothing is captured or relayed.
The check runs after the request's own validation, so the existing
error order is unchanged.
A delegate sender names the owner's identity with SourceArn, FromArn
and ReturnPathArn, their X-SES-SOURCE-ARN, X-SES-FROM-ARN and
X-SES-RETURN-PATH-ARN headers, or v2 FromEmailAddressIdentityArn and
FeedbackForwardingEmailAddressIdentityArn. These are now read (a
parameter wins over its header, and only the first instance of a header
counts), and an address covered by another account's identity ARN is
not checked against the caller's identities. Floci does not evaluate
sending-authorization policies, so it lets such a send through, as it
did before. On a raw send the source ARN also covers the From and
return-path addresses that have no ARN of their own, as SendRawEmail
describes.
Cognito's verification codes and invitations go through SES too, from
Cognito's own no-reply@verificationemail.com or a pool's
EmailConfiguration sender that Cognito has already found verified. They
now use a separate entry point, sendServiceEmail, that skips the check.
Tests and compatibility tests that sent from an unverified address now
verify it first; where a test sent from an address under a domain
identity, the domain is verified by publishing its DKIM records, since
Floci keeps a domain Pending until they exist. SesDomainIdentityTestHelper
does that, and the two copies of the same setup in the configuration-set
tests and the one in SesV2IntegrationTest now use it.
Closes #5141
|
||
|
|
bcda5958e0 |
fix(signin): complete aws login --remote against an endpoint override (#5552)
The AWS CLI builds the cross-device redirect from the Sign-In endpoint it resolved, so with --endpoint-url it sends Floci's own address plus /v1/sessions/confirmation. Floci accepted only an https AWS sign-in host there and served no confirmation page, so the authorize request was refused and the remote login could not finish. A cross-device redirect is now also accepted on the scheme, host and port the authorize request arrived on, and GET /v1/sessions/confirmation shows the verification code in the form the CLI decodes. Any other origin is still refused. Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
ee274b9229 |
fix(elbv2): keep a refused ModifyListener from moving the listener (#5491)
The certificate check on ModifyListener runs twice: once outside IAM's certificate lock, where it keeps the error precedence AWS has, and once under the lock, where it is atomic with the write. The second one sat behind the port, protocol and SSL policy setters, so a DeleteServerCertificate landing between the two answered CertificateNotFound on a listener that had already moved to its new port. The comment above the first check says no refusal leaves the listener changed, which only held for the check it sits on. Every setter now runs inside the guard, behind the re-check, so a refusal either lands before anything is written or does not land at all. The guard is still taken for the certificates the request records, which are the only ones a delete can race: one the listener already holds is a reference DeleteServerCertificate finds, and it refuses to delete it. The re-check covers the effective list, which is what a protocol flip putting the stored certificates into service needs, so that path is checked under the lock too rather than once on the way in. The restartDataPlane local is gone, because a lambda cannot assign a local and portChanges already says the same thing at the one place it was read. Two unit tests, both of which fail without the change: a refused modify leaves the port, protocol, policy and certificates alone and does not restart the data plane, and a protocol flip refused the same way leaves the protocol alone. The resolver they wire finds the certificate once and not again, which is what a delete landing between the two checks looks like from inside the call. docs/services/elb.md records the guarantee next to the lock it comes from. Follow-up to the review note on #5474. |
||
|
|
f50437efba |
feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory (#5226)
* feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory The AgentCore control plane is emulated but had no CloudFormation provisioner, so the three types fell through to the generic stub that exposes only Arn and a template using Fn::GetAtt [Memory, MemoryArn] in an IAM policy failed the stack. BedrockAgentCoreCfnProvisioner maps every template property the services can store onto CreateAgentRuntime / CreateAgentRuntimeEndpoint / CreateMemory, publishes Ref as the registry schema's primaryIdentifier and Fn::GetAtt for every read-only property, updates in place when the create-only properties are unchanged and replaces otherwise, and deletes on stack teardown. Properties the emulated services have no model for are logged once at warn and listed in the docs. * fix(cloudformation): make AgentCore updates rollback-aware and authoritative Reachable through CfnProvisionerFixture (two-service inference arm). In-place updates snapshot the prior runtime, endpoint and memory configuration and tags, restore them on rollback, and delete a created entity when a later step of the same provision fails. The template is authoritative: UpdateAgentRuntime replaces the full configuration as AWS's PUT does (omitted authorizer, protocol and environment are cleared on the SDK path too), and the partial-update Memory and Endpoint calls get a replace-omitted overload for the provisioner. Nested AWS::NoValue members are omitted rather than stored blank, and the control service validates networkMode and serverProtocol with the API's ValidationException wording. * fix(cloudformation): accept AGUI runtimes and share the guarded provision helper The protocol check left out AGUI, which the AgentCore API and the Runtime schema allow, so an AG-UI runtime was refused through the API and in a stack. Ec2NetworkCfnProvisioner and BedrockAgentCoreCfnProvisioner carried the same guarded helper; it now lives on CfnRollback, taking the provisioner's in-place undo as a callback, and both use it. |
||
|
|
d1fe27cb92 |
fix(mq): route DescribeSharedResources (#5356)
* fix(mq): route DescribeSharedResources
GET /v1/brokers/{broker-id}/shared-resources was unrouted and fell through
to S3 (NoSuchBucket). Return an empty sharedResources list for an existing
broker, NotFoundException for an unknown one.
* docs(mq): say why DescribeSharedResources is always empty
Floci does have resource shares (RAM); what keeps the list empty is
that a share reaches a broker only through UpdateBroker's
resourceShareArns, and Floci has no UpdateBroker.
|
||
|
|
ae75a653d6 |
feat(redshift-data): add async execution and statement status events (#5383)
* feat(redshift-data): add async execution and statement status events
* fix(redshift-data): address review findings on async Data API
- Mark a statement FAILED when its worker dies unexpectedly instead of leaving it active
- Let unexpected publisher errors propagate; the delivery pool logs them at error level
- Run CREATE/DROP INDEX CONCURRENTLY, REINDEX CONCURRENTLY, ALTER SYSTEM and tablespace DDL outside a transaction
- Drop WaitTimeSeconds from Scheduler targets so the shared dispatcher thread never blocks
- Share result rows and column metadata between snapshots; ListStatements no longer copies results
- Replace the global monitor with a ReentrantReadWriteLock for status writes and reset
* fix(redshift-data): reject CancelStatement on terminal statements
- Throw ValidationException ("Could not cancel a query that is already in <STATE> state.") instead of returning Status false, as AWS does
- Use WaitTimeSeconds instead of 30 s polling in the Serverless compatibility test and the Spectrum integration test
* fix(redshift-data): match AWS CancelStatement message and tidy test signature
- Append "with ID: <id>" to the terminal-state ValidationException message
- Drop the unused throws InterruptedException from workgroupLifecycleUsesAwsSdk
|
||
|
|
641bf980d0 |
fix(cognito): send the AdminCreateUser invitation with a temporary password (#5155)
AdminCreateUser without TemporaryPassword created a CONFIRMED user with no
password and sent nothing. It now follows the AdminCreateUser reference:
- Without TemporaryPassword a password meeting the pool's policy is
generated and the user starts in FORCE_CHANGE_PASSWORD. A pool offering
EMAIL_OTP or SMS_OTP (above Lite) creates a CONFIRMED user without one,
which needs an email or phone_number for an offered factor and every
attribute the schema marks as required.
- Without MessageAction the invitation goes to each of
DesiredDeliveryMediums (default SMS) the user can be reached on, through
the dispatcher's SES/SNS path and the pool's EmailConfiguration sender.
The text comes from the CustomMessage_AdminCreateUser trigger, the pool's
InviteMessageTemplate, or AWS's default. A message without {####} is not
delivered to a user with a password.
- SUPPRESS sends nothing. RESEND sets a new temporary password, the
requested one or a generated one, and sends the invitation again.
- The invitation is sent before anything is stored, so a failed delivery
(CodeDeliveryFailureException) creates no user, keeps a resent user's
previous password and leaves a ForceAliasCreation alias in place.
- MessageAction and DesiredDeliveryMediums outside their enums are refused
with InvalidParameterException.
- AWS::Cognito::UserPoolUser passes DesiredDeliveryMediums, ValidationData
and ClientMetadata through.
Closes #5144
|
||
|
|
aff6f0eec4 |
fix(cloudformation): expand a SAM function's EventInvokeConfig (#5524)
* fix(cloudformation): expand a SAM function's EventInvokeConfig SAM's EventInvokeConfig was dropped, so a function declaring retries, a maximum event age or invoke destinations deployed with Lambda's defaults and no destination at all. It now expands as AWS's SAM translator expands it: an AWS::Lambda::EventInvokeConfig on $LATEST or the AutoPublishAlias alias, the inline role policy for each destination, the SQS queue or SNS topic SAM creates for a destination given only its Type, and SAM's conditions and error messages. The function's Condition, DeletionPolicy and UpdateReplacePolicy now reach every resource generated for it, as SAM passes them through. A condition naming another with anything but a string is rejected as CloudFormation rejects it, which also fails the template SAM produces for a conditional function with a conditional destination, as on AWS. * fix(cloudformation): resolve SSM parameters for the SAM transform and omit NoValue destinations CloudFormation resolves an AWS::SSM::Parameter::Value<String> parameter before it runs the SAM transform, so a destination Type taken from one is the stored value. The transform now gets the given parameter values over each Default, with SSM-typed parameters read from Parameter Store, wherever it runs. A Destination of AWS::NoValue passes through SAM unchanged and leaves its side without an ARN, which CloudFormation's validation rejects. The event invoke config provisioner resolved it to an empty string and stored that; it now omits AWS::NoValue, so the destination fails as the schema requires. * refactor: share SHA-1 as Digests.sha1 The SAM transform's generated condition names, EC2 key pair fingerprints and the SAML assertion name qualifier each made their own one-shot SHA-1 digest. They now share Digests.sha1 beside sha256. Also moves samTransformParameters above resolveSsmParameters' Javadoc, which it had been inserted beneath. |
||
|
|
ce3d826fc7 |
fix(bedrock-runtime): stop abandoned calls and omit error-body logs (#5526)
* fix(bedrock-runtime): cancel abandoned calls and omit error-body logs Closes #5522. Tie upstream transport lifetime to the Bedrock caller, clean up interrupted streaming bodies, and retain HTTP-error status diagnostics without backend response content. * fix(bedrock-runtime): bound stalled upstream error-body reads Enforce a one-second diagnostic-read deadline with the existing disconnect monitor. Close short stalled error bodies and retain the known ModelErrorException. Regressions cover empty bodies and one or 50 short lines, caller latency, upstream closure, and payload-free warnings. * fix(bedrock-runtime): share cancellation monitoring and split error-read deadline Use one monitor accepting a cancellation condition and action for both Converse paths. Move error-read deadline implementation, regressions, and documentation to a separate follow-up at the maintainer request. |
||
|
|
8565ad837a |
fix(lambda): expose the executing version on cold launches (#5523)
* fix(lambda): expose the executing version on cold launches Signed-off-by: Andre Kurait <akurait@amazon.com> * fix(lambda): propagate executing version to Kubernetes pods Signed-off-by: Andre Kurait <akurait@amazon.com> --------- Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
431748f740 | fix(ecs): launch service tasks through capacity provider strategies (#5500) | ||
|
|
d0c7bd1f6f |
fix(bedrock-runtime): preserve structured output and reasoning effort (#5512)
* fix(bedrock-runtime): preserve structured output and reasoning effort * docs(bedrock-runtime): explain output configuration translation * docs(bedrock-runtime): shorten output translation developer note * fix(bedrock-runtime): reject unsupported tool results without validation logs |
||
|
|
2d7ebcb51c |
feat(cognito): accept the refresh_token grant on the OAuth token endpoint (#4948)
POST /cognito-idp/oauth2/token, and /oauth2/token on a custom domain, now renew a session with grant_type=refresh_token through the refresh that GetTokensFromRefreshToken uses, answering as AWS does. As on AWS, the grant requires neither ALLOW_REFRESH_TOKEN_AUTH nor any OAuth setting on the client. The client is checked before the token: a Basic header names it whatever the body says. A public client's Basic credentials are refused, and its body client_secret is ignored. Errors are 400 without WWW-Authenticate: invalid_client for a missing or unknown client, a public client's Basic credentials with an empty secret, or another pool's client on a custom domain; invalid_client with invalid_client_secret for a missing or wrong secret, or a public client's Basic credentials with a secret; invalid_request with invalid_refresh_token for an empty or absent token; and invalid_grant for a token that is not valid, expired, revoked, or another client's. The answer has access_token, expires_in, token_type, and an id_token exactly when the original sign-in issued one, and no refresh_token, as rotation is not implemented. A request without grant_type is now invalid_request with no description, as on AWS. A code grant's refresh token now carries its granted scopes, base64url encoded in a field after the family id, so a refresh keeps them instead of falling back to aws.cognito.signin.user.admin, and the pre token generation trigger is told them. API sign-ins and tokens minted before this change have no such field and refresh as before. A refresh keeps the sign-in's auth_time and origin_jti. InitiateAuth REFRESH_TOKEN_AUTH and GetTokensFromRefreshToken mint the same tokens as the token endpoint. As on AWS, a refresh of a grant holding a scope the client no longer allows is refused rather than narrowed: invalid_grant on the token endpoint, and NotAuthorizedException "Client is not allowed to request these scopes" on both APIs. The refresh token is parsed from both ends, so a username holding a pipe refreshes too. GetTokensFromRefreshToken and InitiateAuth REFRESH_TOKEN_AUTH now refuse a refresh token issued to another client with NotAuthorizedException "Refresh Token has different Client". |
||
|
|
991bf3ab9e |
fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics (#5513)
* fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics DescribeAutoScalingGroups dropped several members of the AutoScalingGroup shape that CreateAutoScalingGroup and UpdateAutoScalingGroup accept, so a client that set them read them back as absent and saw a permanent diff. - AsgOptionalFields gains ServiceLinkedRoleARN, InstanceMaintenancePolicy, AvailabilityZoneDistribution and CapacityReservationSpecification with its CapacityReservationTarget. The four-argument constructor stays, so existing call sites are unchanged. - MixedInstancesPolicy launch template overrides carry WeightedCapacity. - EnableMetricsCollection and DisableMetricsCollection are implemented, and DescribeAutoScalingGroups reports EnabledMetrics. - Validation follows the botocore model. MinHealthyPercentage 0 to 100 and MaxHealthyPercentage 100 to 200, both required, at most 100 apart, and -1 on both clears the policy. CapacityDistributionStrategy and CapacityReservationPreference enums. No target with preference none. CapacityReservationIds 1 to 255 characters matching [A-Za-z0-9-_/] and resource group ARNs 1 to 1600. ServiceLinkedRoleARN 1 to 1600 characters. WeightedCapacity 1 to 999 in at most 32 characters, set on every override or none. Granularity required and 1Minute. Known metric names only. - The AWS::AutoScaling::AutoScalingGroup provisioner passes the new properties and MetricsCollection through, and its update rollback snapshot restores them. It requires CapacityReservationPreference and each entry's Granularity as the resource schema does, and rejects an unknown metric before creating the group. - The Java SDK compatibility suite gains a round-trip case that sets every new member, reads it back through DescribeAutoScalingGroups, then clears the maintenance policy and the enabled metrics. * fix(autoscaling): route the metrics collection actions and close the review gaps EnableMetricsCollection and DisableMetricsCollection now route to Auto Scaling when a request carries no credential scope. Both hold the group lock, so concurrent calls keep each other's changes and a call racing a delete cannot write the group back. A failed stack update now clears the service-linked role, AZ distribution and capacity reservation when the group had none before. A blank ServiceLinkedRoleARN or WeightedCapacity in a template reaches the service's validation instead of reading as unset. The provisioner reuses the service's granularity rule and message. |
||
|
|
72a4cc5515 |
fix(iam): page ListRoles and ListPolicies through MaxItems and Marker (#5515)
Both actions returned every match in one response with IsTruncated false. They now use the existing paginate helper, so an omitted MaxItems returns 100 items, a MaxItems outside 1 to 1000 is a ValidationError, and Marker appears only on a truncated page. PathPrefix and Scope filter first. Roles and customer managed policies are listed in name order so a marker keeps pointing at the same place between calls. |
||
|
|
5092713a6e |
feat(cognito): support passkeys (WebAuthn) registration and sign-in (#5102)
* feat(cognito): register passkeys and sign in with WEB_AUTHN * test(cognito): cover passkeys with the Java SDK * docs(cognito): document passkey registration and sign-in * fix(cognito): check passkey counters under the user lock and tighten passkey origins * fix(cognito): turn passkey MFA on per user and page passkeys with a cursor * fix(cognito): verify passkeys without webauthn4j and gate passkey MFA on tier Drops the webauthn4j dependency and its native-image entries. Cognito recognizes only ES256 and RS256 passkeys and does not enforce attestation, so jackson-dataformat-cbor decodes the attestation object, the authenticator data and the COSE key, and java.security checks the signature. The attestation statement is no longer verified. The helpers the verifier needs live in core.common, and the existing copies across main and test code now call them: - PublicKeys builds a public key from its raw components, for the JWT verifiers of API Gateway and Verified Permissions, SshPublicKeys, and the CloudFront and SES curve lookups. - Digests.sha256 and Digests.sha256Hex replace every one-shot SHA-256 digest and the private hex helpers built on one, including the two public sha256Hex methods on SigV4RequestValidator; incremental and streaming digests keep MessageDigest. - Base64Url.encode, for bytes or the UTF-8 bytes of a string, replaces every unpadded base64url encode and the private helpers wrapping it. - DomainNames.isWithin replaces the same-domain-or-subdomain check in SES, ACM, Route 53, the embedded DNS server, the TLS certificate manager and the Cognito message dispatcher. Every replacement produces the same bytes as the code it replaces. Turning passkey MFA on now also needs a pool in the Essentials tier or higher, and in an optional-MFA pool a user with software-token MFA keeps WEB_AUTHN when passkey MFA is on, as the AWS MFA table describes. --------- Co-authored-by: Priamo <pgermosen@gmail.com> |
||
|
|
255ad96168 |
fix(dynamodb): validate legacy Expected operands without rejecting Value (#5508)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
017901a030 |
test(autoscaling): preserve AWS subnet whitespace normalization (#5509)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
86b32584f3 |
feat(cloudformation): provision ElastiCache users and user groups (#5422)
* feat(cloudformation): provision ElastiCache users and user groups Add AWS::ElastiCache::User and AWS::ElastiCache::UserGroup provisioners with authentication mode handling, create-only UserName, membership deltas, engine changes and replacement on rename. * fix(cloudformation): address review findings for ElastiCache users and user groups - Require Engine property when provisioning AWS::ElastiCache::User - Reject invalid and conflicting AuthenticationMode combinations - Add setUserGroupMembers to atomically update group membership under lock - Require UserIds property when provisioning AWS::ElastiCache::UserGroup - Snapshot and restore User and UserGroup on stack update rollback - Tighten replaced subnet group deletion assertion in integration test * refactor(elasticache): share user authentication and user group update logic Move the AuthenticationMode / Passwords / NoPasswordRequired decision into UserAuthentication so the query handler and the CloudFormation provisioner no longer duplicate it. Make modifyUserGroup and setUserGroupMembers share one locked update path, and drop the concurrency test that passed without the lock. |
||
|
|
3bdb07deac |
fix(bedrock-runtime): preserve images sent through the proxy (#4681)
* fix(bedrock-runtime): preserve inline images in proxy requests * fix(bedrock-runtime): bound image validation allocations |
||
|
|
2cade5cd21 |
fix(cloudformation): apply Tags, DNS attributes and InstanceTenancy on AWS::EC2::VPC (#5224)
* fix(cloudformation): apply Tags, DNS attributes and InstanceTenancy on AWS::EC2::VPC Ec2VpcCfnProvisioner read only CidrBlock, so a VPC from a template had no tags and DescribeVpcs with a tag:Name filter (CDK Vpc.from_lookup) never found it. EnableDnsSupport, EnableDnsHostnames and InstanceTenancy were dropped as well. Tags are now reconciled through Ec2Tags on create and on update (keys removed from the template are deleted), the DNS attributes are applied with the AWS defaults when omitted, and InstanceTenancy is passed to CreateVpc, with the dedicated-to-default change applied in place through a new modifyVpcTenancy and any other change treated as a replacement. CreateVpc on the EC2 Query API now honours InstanceTenancy too so the two paths agree. Fn::GetAtt gains CidrBlockAssociations, DefaultNetworkAcl and Ipv6CidrBlocks. * fix(cloudformation): validate VPC tenancy and treat blank DNS properties as omitted EnableDnsSupport/EnableDnsHostnames resolving blank (Fn::If with AWS::NoValue) now take the AWS default instead of false. CreateVpc rejects an InstanceTenancy outside default/dedicated/host with InvalidParameterValue, and ModifyVpcTenancy requires the VPC to be dedicated, as on AWS; the provisioner replaces on any other tenancy change. The integration test reads outputs with XmlPath, and the query-handler test stub follows the new createVpc overload. * style(cloudformation): no final on the VPC local; compare tag sets unordered in the test * fix(ec2): CreateVpc accepts default or dedicated tenancy only * fix(ec2): share the enumerated-parameter check for VPC tenancy and cover it on the Query API requireMetadataOptionValue becomes requireParameterValue and requireVpcTenancy uses it, so the InvalidParameterValue wording lives in one place. A Query API test sends InstanceTenancy to CreateVpc and reads it back from DescribeVpcs, the provisioner test no longer turns DNS hostnames on with DNS support off, and the CreateVpc docs row names the accepted tenancies. * fix(ec2): only an absent InstanceTenancy defaults; order the test static imports |
||
|
|
e8a300f4d5 |
fix(cloudformation): roll back a changed custom resource (#4941)
When a stack update sent a custom resource's handler an Update and the update then failed, Floci never told the handler. If a later resource failed, the rollback recorded "Rollback is not implemented for Custom::..." and the stack ended UPDATE_ROLLBACK_FAILED with the handler's change still applied. If the handler failed its own Update, Floci put the previous resource back in silence. In both cases CloudFormation sends the handler a second Update with the previous properties so it can undo the change. CustomResourceCfnProvisioner now snapshots the resource before an Update reaches its handler: the prior physical id, the old and the attempted properties, the region and the Data attributes, under the new CUSTOM_RESOURCE_UPDATE_SNAPSHOT_ATTR. A stale snapshot from an earlier update is dropped first, so an update that sends nothing needs no rollback. The ServiceToken is checked as Lambda's Invoke checks it before the snapshot is written, so an Update rejected before it reaches any handler is restored as before and sends no rollback request. While the snapshot is held, retainsFailedUpdateState answers true, so an Update the handler failed keeps its copy for the rollback walker instead of being restored over. Its rollbackUpdate spends the snapshot: - the physical id was kept: report UPDATE_IN_PROGRESS and send Update with the old properties as ResourceProperties and the attempted ones as OldResourceProperties, under the same physical id and stack id. On SUCCESS the Data attributes are replaced by the response's. A response naming another id is taken, and the id that was sent gets a best effort Delete with the attempted properties at once, since Floci has no rollback cleanup phase. - the handler replaced the resource: send a best effort Delete for the new id with the attempted properties and point the resource back at the old id and attributes, with no Update. CloudFormation sends this Delete in its cleanup phase; Floci sends it during the rollback. The old properties become the resource's own before the handler is called, as on AWS, which treats the rollback target as the resource's properties even when the handler fails it: a later DeleteStack sends them in its Delete and the next update sends them as OldResourceProperties. A FAILED answer throws with the handler's Reason, so the resource is UPDATE_FAILED and the stack UPDATE_ROLLBACK_FAILED, as on AWS, and the snapshot stays so a retry sends the same Update again. |
||
|
|
85e0061a6f |
feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping (#5038)
* refactor(apigateway): move the v2 domain and API mapping rules into the service CreateDomainName and CreateApiMapping on /v2/domainnames kept their rules in ApiGatewayController: the one-configuration check, the refusal of inputs Floci does not emulate, the flattening onto the shared custom-domain store, the API and stage existence check, the mapping key conflict check, the API type the mapping is routed as, and the mapping id. A CloudFormation provisioner cannot reach a controller, so it would have had to copy them. They now live in ApiGatewayService. createV2DomainName validates the body and creates the domain; createApiMapping checks the API and stage, refuses a key that is taken and routes the mapping as the API's protocol type; getApiMapping, deleteApiMapping and apiMappingId follow. ApiGatewayService takes ApiGatewayV2Service for the API and stage lookup, so the whole rule sits in one place and a caller needs one service. Nothing on the v2 side depends on the v1 service, so this adds no cycle. Leaving the lookup in ApiGatewayV2Service was tried first, but then every caller had to resolve the API before calling into ApiGatewayService, and the rule was split across two classes again. The code is moved, not rewritten: messages, error codes, the order of the checks and the id scheme are unchanged, and the controller delegates. * feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping Both types were left to the stub arm. A stack reported CREATE_COMPLETE, but no domain or mapping existed, Fn::GetAtt on the domain resolved to literals such as DomainResource.RegionalDomainName (so a Route 53 alias built from it pointed nowhere), and with allow-stub-unsupported-resource-types off the stack rolled back. ApiGatewayV2DomainCfnProvisioner creates them through the v2 rules in ApiGatewayService and injects only that service. Ref on a domain is its name and Fn::GetAtt returns DomainNameArn, RegionalDomainName and RegionalHostedZoneId as GetDomainName reports them. Ref on a mapping is its ApiMappingId, which is also its only attribute. Updates follow AWS. DomainName is the only createOnly property of either type, and everything else changes in place: the domain's configuration is replaced as a whole, as DomainNameConfigurations is on AWS, and a mapping's ApiId, Stage and ApiMappingKey change without a new id. To keep the id across a key change, a mapping now stores the apiMappingId it was given instead of deriving it from its key on every read. A record persisted before is still read under the derived id, and a new mapping gets the id it always had unless another mapping holds it. Deriving the id and documenting the difference was the first version; it was dropped because Ref changed where AWS keeps it, and the change set already reported the key change as an update. A replacement creates the new entity and leaves the displaced one to ReplacementCleanup, so it is deleted in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS, kept under UpdateReplacePolicy: Retain, and put back when a later resource fails the update. The first version deleted the old domain inside provision, as the v1 provisioner does, and a failed rename then ended in UPDATE_ROLLBACK_FAILED with the original domain and its mappings already gone. A mapping moved to another domain gets an id the displaced mapping does not hold, since two mappings under one physical id cannot be told apart, and the domain of each displaced id is recorded beside the cleanup. An in-place update snapshots what it changes, so a failed stack update restores it instead of ending in UPDATE_ROLLBACK_FAILED. CDK templates needed the v2 rules to match AWS in two more places. apigateway.DomainName with a multi-level basePath maps a REST API through AWS::ApiGatewayV2::ApiMapping, so a mapping now accepts a REST API stage. And the restrictions AWS documents for API mappings are enforced, in the API and in templates alike: no v2 call on an edge-optimized domain, with AWS's message; TLS_1_2 for an HTTP API or a multi-level key, which also keeps such a domain on TLS_1_2; no WebSocket API beside an HTTP or REST API; and AWS's key characters and length. The id-only delete accepts <ApiMappingId>|<DomainName>, the type's primary identifier, which is how Cloud Control names a mapping; a bare id still answers NotFoundException, so Cloud Control cannot report a delete that did not happen. The integration test deploys two templates aws-cdk-lib 2.272.0 synthesized, checked in with the app that produced them, and compat-cdk deploys the same shapes. * fix(apigateway): answer v2 domain and API mapping calls as API Gateway does The review of this PR found four places where Floci answered differently from API Gateway. Each was measured against API Gateway in eu-west-1 on 2026-10-04, with an imported certificate on a throwaway domain. An HTTP API custom domain is regional. CreateDomainName and UpdateDomainName with an endpoint type of PRIVATE, or one API Gateway does not know, give a REGIONAL domain, where Floci refused the first and stored the type on an update. EDGE is refused with "EDGE endpoint type is not supported for APIGatewayV2 domainName", not the message for v2 calls on an existing edge-optimized domain. API mapping keys are checked as API Gateway checks them, with its messages: a key does not end with '/', does not start with '/' or hold '//', holds letters, digits and $-_.+!*'(), between its levels, and is at most 300 characters. No key, an empty one, or on a create one of whitespace only, is the root; an update refuses whitespace only. Floci took "/" for the root and had its own message for the characters, without the comma. UpdateApiMapping and UpdateDomainName answer over the v2 HTTP API, not only from CloudFormation. What an UpdateApiMapping leaves out keeps its value. Cloud Control identifies an AWS::ApiGatewayV2::ApiMapping by the type's primary identifier, <ApiMappingId>|<DomainName>, while CloudFormation's Ref stays the bare id: CloudControlService derives the identifier from the desired state, as it already names primary identifier fields by type, and the provisioner deletes by it with the create-time attributes too. * fix(apigateway): refuse a v2 update of an edge domain, and recover a compound identifier whole The second review pass found three gaps in the previous commit. UpdateDomainName through the v2 API converted a v1-created edge-optimized domain to REGIONAL. The v2 API does not manage an edge-optimized domain, so the update is refused with the message every other v2 call on one gets, and the CloudFormation in-place update goes through the same check. A v2 UpdateDomainName without a configuration returned the domain unchanged without looking at the rest of the body, so a mutual TLS request was silently dropped. ApiGatewayService.updateV2DomainName now refuses what Floci does not emulate, and the edge-optimized domain, either way. Cloud Control's recovery of a create that finished just before a restart took the identifier after the last '|' of its key, which for an API mapping's <ApiMappingId>|<DomainName> left only the domain. It now takes everything after the key's third separator. A later review pass found four more points. UpdateApiMapping fills in what its body leaves out under the lock the update takes, so two partial updates of one mapping cannot write back each other's old values. A v2 domain's certificate is stored as the v1 API's regional certificate, which is what a regional domain reports through both APIs; a domain the v2 API wrote before still reports the one it holds until its configuration is replaced. The domain ARN both APIs and both CloudFormation provisioners build comes from ApiGatewayService.domainNameArn, the Cloud Control test waits with the awaitSuccess helper main has since gained, and requireMappingAllowed's javadoc is back on it. |
||
|
|
e61b66fb22 |
fix(rds): load the token role's ALTER ROLE defaults into IAM sessions (#5344)
* fix(rds): load the token role's ALTER ROLE defaults into IAM sessions * fix(rds): open IAM sessions with the role's defaults as startup options so RESET keeps them |
||
|
|
ea8da22226 |
fix(iam): match absent context keys with ForAllValues (#5482)
* fix(iam): match absent context keys with ForAllValues * fix(iam): preserve condition guards for missing keys * fix(iam): reject unsupported condition shortcuts * docs(iam): clarify supported IfExists conditions * fix(iam): enforce requested keys in set conditions * docs(iam): clarify unresolved attribute conditions * fix(iam): enforce requested S3 object tag keys * fix(iam): scope object tag keys to the authorized action |
||
|
|
1aabc8b4fe |
fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS (#5486)
* fix(efs): report the zone id EC2 reports for the same zone EFS derived its own availability-zone id (use1-az1) by splitting the region on hyphens, while EC2 publishes <region>-az<n> for subnets and zones, so a mount target and its subnet disagreed. The abbreviation also only worked for three-part regions: us-gov-west-1a and eusc-de-east-1a kept the whole region. EFS now takes the id from the helper EC2 and VPC flow logs use. Also drops an allowlist pattern for flow-log region abbreviations that matches no source line since flow logs moved to the same helper. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS EC2 published <region>-az<n> as a zone id and EFS its own abbreviation, so a mount target and its subnet disagreed and neither matched AWS in every region. AvailabilityZoneIds in core.common now derives the id for all three: AWS's short region prefix and -az<n> (use1-az1, apne1-az1, usgw1-az1, cnn1-az1). The prefix rule is attested for the commercial, China and GovCloud regions; AWS publishes no zone id for an ISO or EUSC region, so those keep the whole region as the prefix instead of a guessed one. Zone a is still az1, b az2, and so on: AWS maps names to ids per account, which Floci does not model. CreateSubnet resolves AvailabilityZoneId in the new shape and refuses the old one. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
03a0dfefdd |
fix(rds): honor restore IAM flags and reject malformed booleans (#5473)
* fix(rds): reject malformed restore flags * fix(rds): disable IAM authentication by default on restore * fix(rds): honor IAM settings on instance snapshot restore |
||
|
|
cc129007e4 |
perf(docker): cut healthy wait from 5 s to 0.1 s (#5447)
* perf(docker): cut healthy wait from 5 s to 0.1 s * fix(docker): wait up to 5 s for ready hooks before reporting healthy * fix(docker): build without pulling a Dockerfile frontend from Docker Hub |
||
|
|
4e769484df |
feat(iam): generate and read the Organizations access report (#5467)
GenerateOrganizationsAccessReport and GetOrganizationsAccessReport answered
UnsupportedOperation, which is not a reply any SDK models. They are the Access
Advisor job shape over a different question, and everything the question needs
was already here: an Organizations tree with roots, OUs, accounts and SCPs, a
policy evaluator, and a job model whose report is fixed at generation time.
The report is the services the service control policies along an entity path
leave reachable. The path names the organization, its root, and the OUs or
account below it, and the SCPs attached to each of those are read from
Organizations and evaluated. Only SCP logic applies, which the reference is
explicit about: identity policies, resource policies, ACLs, permissions
boundaries and trust policies play no part in this data.
Attached SCPs are a union within one level and the levels are intersected, so a
service survives only where every level allows it. That cannot be answered a
namespace at a time, because a service is reachable only while some action in it
survives the whole chain: two levels allowing single disjoint actions,
s3:GetObject under s3:PutObject, leave no S3 action at all, and a Deny on the one
action a level allows leaves none either. What a namespace-wide reading got right
stays right. An SCP denying s3:DeleteBucket alone keeps S3 on the list, because
every other S3 action is still reachable, and a Deny carrying a Condition or
naming particular resources closes nothing: the region guardrail on * that most
organizations carry, and a deny scoped to one bucket, both leave the service
reachable by every request they do not cover, and reading them as total denials
would report an organization that reaches nothing.
This is still not the existing scpAllows asked once per namespace. That question
needs a concrete action, and a request action of s3:* would not match a statement
naming s3:GetObject, a pattern globbing against a request value and never the
other way round. The survivors are found by probing instead, with the actions the
policies themselves name and one stand-in action per wildcard, which decides the
patterns policies are written with exactly: a deny on s3:GetObject leaves the
service reachable where a deny on s3:Get* does not. A wildcard that is not a
trailing one is the limit of it, since the stand-in for s3:*Object misses the
s3:GetObject that s3:Get* would allow; such a pattern leaves the service on the
list rather than off it, which is the side the namespace reading was already on.
The management account is not limited by SCPs, so its report lists every service
and an OrganizationsPolicyId passed with it is ignored, both as documented.
Passing that ID otherwise narrows the report to the one SCP named, and it has to
name one: Organizations keeps tag, backup, chatbot and opt-out policies in the
same ID space, none of them carries statements, and evaluating one as a ceiling
would read as a level that constrains nothing and report every service there is.
The entity path has to be a path the organization actually has. The segments
below the root name a chain of parent and child, so the path is held to the one
Organizations reports for its last node rather than each segment being resolved
on its own. Resolving them one at a time accepts a path assembled from two
branches, or one that skips an OU, and reports the policies of a chain the
organization does not have; it also lets a path whose last segment is the
management account take the unlimited answer with an OU above it that does not
exist.
Floci records no service access, so every service in a report is one principals
are allowed but never reached. The reference's own example gives such a service
as a namespace and a zero count with no region, entity path or last-authenticated
time, so that is the shape here and NumberOfServicesNotAccessed equals
NumberOfServicesAccessible. ServiceName carries a display name Floci has no
mapping for, so the namespace stands in for it as it does on the last-accessed
reader. SortKey is validated against its four values: the namespace keys sort
the list and the time keys leave it in namespace order, since ordering on a
timestamp no entry carries would be ordering on nothing.
A caller who is not the management account gets AccessDenied 403. Neither
operation models a code for that, but a per-action error list is additive: the
reference's common error types "that this AWS service may return" apply to every
action and include the 403 permission denial, and the user guide names the code
for a denied IAM action outright in its AddRoleToInstanceProfile entry. That page
spells it AccessDeniedException where the user guide and the rest of this
service's surface spell it AccessDenied; the latter is used, so a caller sees one
spelling across IAM and STS.
Three things are inferences, and they are the same inference three times. The
docs say so. The generator models no error for an entity path that is well-formed
but resolves to nothing, nor for the prerequisite the reference states, that SCPs
be enabled for the organization root, nor for an OrganizationsPolicyId naming a
policy of some other type, so each produces a FAILED job carrying ErrorDetails:
InvalidEntityPath or the Organizations code for the entity in the first case,
PolicyTypeNotEnabled in the second, Organizations' InvalidInputException in the
third. That is read off the shape of the API rather than off a sentence: AWS
publishes both fields on this reader for failures the generator does not report
synchronously. The alternatives are worse. Letting Organizations' own error
escape unchanged puts another service's code on an IAM operation, a COMPLETED job
with an empty list cannot be told apart from an organization that reaches no
services, and ValidationError is for a shape violation, which a well-formed path,
a disabled policy type and an existing policy of the wrong type are not.
ReportGenerationLimitExceeded, the generator's only modeled error, reports
concurrent generations and stays unreachable: a job completes the moment it is
created, so two never overlap.
The generator also carries the access-report resource type, so it leaves
UNRESOLVED_TYPES and resolves from the request. The reference spells the type as
access-report/${EntityPath}, so the entity path goes into the ARN whole: its
slashes are the organization's tree, not an IAM path, which is why it does not
go through the minting the creates use.
Both actions join AwsQueryController.IAM_ACTIONS as well as the handler, without
which inferService would never route them. That list and the handler now hold
166 each, still exactly in step.
Validation runs before the lookup, as AWS rejects a request shape whether or not
the job exists: a SortKey outside the enum answers ValidationError even for a
job ID nothing holds, where validating it afterwards would answer NoSuchEntity.
A member the request carries is held to its shape whatever it carries, an empty
value included, since SortKey= and OrganizationsPolicyId= are a malformed enum
and a malformed id rather than a way of leaving an optional member out. The
entity path reports the constraint that failed rather than the regular
expression for every case, so a path over the maximum length reads as a length
violation, which is what every other validated IAM member does.
Only the one Organizations answer that means something about the caller becomes
AccessDenied. A read that fails for any other reason keeps its own error, rather
than reaching the caller as a permission problem they do not have.
Two things are shared rather than copied. The job registry both report
generators keep, an account-scoped store keyed by job ID that answers
NoSuchEntity for an ID it does not hold, moves into IamJobStore and
ServiceLastAccessedService reads it from there; the two had the same three
methods and the same message. The report's timestamps come from the injected
Clock, which IamService already takes, rather than from Instant.now(), so they
agree with every other time IAM decides. IamQueryHandlerTest builds the handler
itself rather than through injection, so it passes the new service along with
the dependencies it already does not use.
Fourteen unit tests cover the chain semantics, including the allow-list idiom of
allowing everything and denying all but one namespace, levels allowing disjoint
single actions, a deny on the only action allowed and on a pattern wider than it,
a conditional deny, a deny scoped to one bucket, a level with an unreadable
document, and a level with none. Twenty-one integration tests drive the pair over
an organization built through the Organizations API, on a management account of
their own so they never contend with the existing Organizations suites for one.
Two of them are the ones that hold the walk honest: the OU path, where the root
leaves S3 and DynamoDB and the OU leaves DynamoDB and IAM, so only a report
reading both levels answers DynamoDB alone, and the management account path,
which reports every service and ignores the policy ID passed with it even with a
ceiling attached to the root above it. With the tree read deliberately broken the
first SCP test returns all 456 namespaces instead of the one, and it is the only
test that notices. Two more tests mock the Organizations read, which is the one
failure a real organization cannot be made to produce.
|
||
|
|
6d2aaba6a6 |
fix(s3): reject a PutObject or UploadPart over 5 GiB (#5469)
S3 takes at most 5 GB in one PutObject and 5 GiB in one part (User Guide, "Uploading objects" and the multipart upload limits table), but Floci only enforced that for UploadPartCopy. Since PutObject and UploadPart stream to disk, the only cap was FLOCI_PROTOCOLS_MAX_REQUEST_SIZE, so raising it past 5120 MB, as docs/services/s3.md says to for 5 GiB uploads, let a single request store any size up to the new limit. A request that declares more than 5 GiB of data, in Content-Length or, for an aws-chunked body, x-amz-decoded-content-length (its Content-Length also counts the framing), now fails with EntityTooLarge before any of its body is read. A body that declares no size, or less than it sends, fails the same way once it passes 5 GiB: the stream that digests a body on its way to disk counts it against the limit, while memory mode already stops at about 2 GiB. PutObject's "5 GB" is taken as 5 GiB, as CopyObject's is. The error is now the one S3 sends, as S3's answer to an oversized UploadPart logged in aws/aws-cli#5420 and an AWS-validated LocalStack capture record it: the message "Your proposed upload exceeds the maximum allowed size", not the error table's description, and the ProposedSize and MaxSizeAllowed fields, ProposedSize left out when a body passes the limit as it is read, since its whole size is then not known. It is built in one place and shared with UploadPartCopy and the memory-mode cap, which sent the table's wording and named neither size; the memory-mode cap names the most memory mode can hold. A client that sent Expect: 100-continue never sends a body it was not told to continue with, so answering it before reading the body left the connection waiting for that body and reading the client's next request as it (#5291). Such an answer now says Connection: close and the connection is closed after it, which covers this rejection as well as NoSuchBucket or a failed precondition. An aws-chunked body sent without a streaming x-amz-content-sha256 or an x-amz-trailer is read whole to be decoded. That read now fails with EntityTooLarge once it passes what one array holds, through the bounded read memory mode uses, instead of running the heap out of memory. Telling an aws-chunked body from its Content-Encoding is now one helper, which the four places that repeated the check use too. |
||
|
|
233253334d |
fix(elbv2): reject a listener certificate the account does not have (#5474)
A listener stored whatever certificate ARN it was given. CreateListener, ModifyListener and AddListenerCertificates each model CertificateNotFound, and all three took an ARN naming nothing and answered 200, so a listener could be left serving a certificate that was never uploaded. Only the other direction worked: ELBv2 reports its references to IAM, so DeleteServerCertificate already refused with DeleteConflict while a listener held one. The error is the one AWS publishes on those three operations and no others: botocore gives CertificateNotFoundException the code CertificateNotFound, 400, senderFault, and the API reference lists it under AddListenerCertificates, CreateListener and ModifyListener with one sentence, "The specified certificate does not exist." That sentence is the message rather than one naming the ARN, because it is the one the reference publishes. The check covers the listener types the member belongs to and no more. The reference marks Certificates "[HTTPS and TLS listeners]" on CreateListener and ModifyListener, and describes AddListenerCertificates as adding to the list "for the specified HTTPS or TLS listener", so a certificate on a listener of any other protocol is a configuration it does not describe. What AWS answers there is not CertificateNotFound on any evidence to hand, so such a request keeps the behaviour it had rather than being refused with a code read off the wrong case. A test pins each side of that line. The line follows the protocol the listener ends the call with, not the one it started with: ModifyListener takes a protocol without taking certificates, so when none arrive the certificates checked are the ones already on file. An HTTP listener holding an ARN that resolves to nothing is left alone, and the request that turns it into an HTTPS one, which is where those certificates start being served, is refused. A blank entry is refused the same way, rather than skipped. Certificates is the list of certificates the listener serves, an empty value in it names one no better than a value that is no ARN at all, and the Query parser turns an empty CertificateArn parameter into exactly that entry, so skipping it stored a certificate the listener cannot serve. ELB Classic already answered this question in full, resolving an ARN to an IAM server certificate or an ACM one and holding IAM's certificate lock across the write. This is the second caller, so the three private methods it kept, certificateExists, iamServerCertificate and acmCertificateExists, move to CertificateReferenceResolver in core.common and Classic reads them from there. Neither referrer owns the lookup: IAM holds server certificates, ACM holds the rest, and a listener carries only the ARN. Classic's public constructors are untouched, so its unit tests still build it the same way. The check alone is not enough, which is why the lock moves with it. A certificate can be deleted between the check and the write, and the delete walks the reference providers under IAM's own lock, so every write that records an IAM certificate runs inside that lock and re-checks there, while the fail-fast check outside it keeps the error precedence. That covers CreateListener as much as the two writes to a listener already published: until the new listener is in the map, nothing the delete walks can see that it holds the certificate. A race test drives each of them against DeleteServerCertificate over the wire, and with the lock removed they leave a listener holding a deleted certificate in 1 of 30 trials for AddListenerCertificates and 4 of 30 for CreateListener, so the guarantee is measured rather than asserted. Where the check sits in ModifyListener is part of the fix. The listener it modifies is the stored object, and the port, protocol and SSL policy were set before anything could refuse the request, so a refusal answered 400 over a listener already moved to the new port: no later read put it back, and the data plane was never restarted to match. Every refusal now lands before the first setter. An absent resolver leaves the old behaviour in place. ElbV2Service is wired by hand in its unit tests, with no IAM and no ACM, and a listener write there is the write it was before any certificate existed to check. The dependency is a field rather than a constructor parameter because that is how this class takes all six of its others, and converting it would be a refactor this change does not need. docs/services/elb.md said listener certificate ARNs are not validated when they are added, which was true and is the behaviour this removes, so it now documents the three operations, the protocols they cover, the empty value, the protocol change, the error and the lock, as the Classic page already does. Sixteen integration tests cover a missing IAM certificate, a missing ACM one, a blank entry, a value that is no ARN at all and an ARN of a service that serves no certificates, an uploaded certificate and an ACM certificate being accepted, a listener carrying no certificate, a TLS listener held to the same check as an HTTPS one and a listener of a protocol with no certificates left alone, a protocol change refused over the certificate it already held and allowed over one that exists, a second certificate being added, a refused change leaving the port and protocol as they were, and the two writes that must refuse without changing what the listener already serves. Every certificate and load balancer they make is registered for cleanup: the account's certificate quota is 20 and the Quarkus instance is shared, so one left behind fails an unrelated class's upload instead of anything here. Three things the reference states about these operations stay open, each wanting an error code no source here gives: CreateListener and ModifyListener take "exactly one certificate" and AddListenerCertificates "one certificate per call", where Floci accepts a list; TooManyCertificates is modeled on all three and no quota is enforced; and DescribeListenerCertificates is documented to report the default certificate alongside the list, with IsDefault telling them apart, which Floci does not model. Driven through the standard hashicorp/aws provider against a local instance as well, which is how the change was checked against a real client rather than only against the suite: an aws_iam_server_certificate and an aws_lb_listener serving it apply clean, and a listener naming a certificate nobody uploaded fails with CertificateNotFound and the reference's sentence. That failure arrives at the end of the provider's create timeout rather than at once, because the provider retries this error on all three calls, the AddListenerCertificates one against a constant named iamPropagationTimeout: real AWS is eventually consistent about a certificate just imported, so a client waits it out. Floci's storage is immediately consistent and nothing here models a propagation delay, so the retry simply ends in the refusal. The same contract is pinned at the SDK boundary too, as eight boto3 tests in compatibility-tests: the refusal on each of the three operations, the accepted cases, and both protocol edges. They run in under a second, where driving the same thing through Terraform in CI costs about a minute for the accepted case and nearly two for the refusal, almost all of it the provider's waiter and the retry above rather than anything Floci does. The suite had no ELB coverage at all before this. Each test takes its load balancer back out before its certificates, which is the order that frees them, and test_acm.py's private certificate builder moves to a conftest fixture taking the common name rather than being copied, since the new file needs the same pair. |
||
|
|
6d7d85f0f8 |
fix(lambda): enforce function policies on cross-account calls (#5476)
Under IAM enforcement, a caller whose own policy allowed lambda:InvokeFunction could invoke another account's function by ARN even when that function's policy granted nothing, and RotateSecret could be pointed at another account's function the same way. Three things combined: there was no resource-policy provider for Lambda, so the call was judged as same-account; the function name was cut at its first colon, so an ARN was evaluated as function:arn in the caller's account, where no Allow or Deny written for the function could match; and the invoke followed the account in the ARN. - LambdaResourcePolicyProvider supplies a function's policy statements and the account its ARN names, also when the function has no policy, so a call to another account's function needs that function's policy to allow the caller as well as the caller's own policy. It is keyed on the ARN, so RotateSecret's check on its rotation function, made under the secretsmanager scope, sees it too. - ResourceArnBuilder evaluates each call against the function it acts on. An invoke runs in the account and Region a full or partial ARN names, as the version or alias it names in the function name or in Qualifier, since Lambda authorizes a qualified call against the qualified ARN. GetFunction, GetFunctionConfiguration and ListDurableExecutionsByFunction read a qualified full ARN in the account it names, so they are evaluated there too, and a read of another account's function needs its policy as on AWS. Every other route acts on the caller's own function of that name, so it is evaluated against that function, unqualified because not all of their handlers act on the qualifier. - An invoke by partial ARN runs in the account it names, as one by full ARN already did. - RotateSecret looks its function up where the rotation runs it: in the ARN's account, and as the version or alias the ARN names. |
||
|
|
eb3c14d414 | fix(rds): reject malformed event subscription flags (#5481) | ||
|
|
1e92b7e17b | fix(rds): reject malformed cluster snapshot copy flags (#5472) | ||
|
|
1a0afce7ec |
feat(cognito): serve the OAuth token revocation endpoint (#4936)
POST /cognito-idp/oauth2/revoke, and /oauth2/revoke on a custom domain, revoke a refresh token through RevokeToken and answer as AWS's revocation endpoint does, as measured: 200 with no body for a revoked, already revoked or invalid token; 400 invalid_request for a missing token or a client with revocation disabled; 400 unsupported_token_type for an access or ID token; and 401 invalid_client with WWW-Authenticate: Basic for missing or bad client credentials, a client of another pool, or a token issued to another client. Unlike the token endpoint, a client secret is taken only from the Basic header. On a custom domain, the Cognito filter now answers a path under /oauth2/ that Cognito does not serve with AWS's JSON 404, and a served path called with another method with an empty 405, so neither reaches S3 as a key of a bucket named cognito-idp. |
||
|
|
b86268e459 |
fix(ec2): preserve original Spot instance user data (#5468)
* fix(ec2): preserve original Spot instance user data * fix(ec2): omit whitespace-only Spot user data * docs(ec2): clarify Spot user-data encoding * refactor(ec2): simplify Spot user-data handling |
||
|
|
4fd8df2b00 | fix(rds): reject malformed parameter reset flags (#5454) | ||
|
|
bfa9c2fbcc |
feat(cloudformation): provision Application Auto Scaling targets and policies (#5407)
* feat(cloudformation): provision Application Auto Scaling targets and policies AWS::ApplicationAutoScaling::ScalableTarget and ::ScalingPolicy had no provisioner, so a template that scales an ECS service failed on those two resources although the Application Auto Scaling service behind them, including the ECS capacity adjuster, was already there. This wires the two together. A scalable target has no name of its own: it is keyed by the triple of service namespace, resource id and scalable dimension, and CloudFormation's Ref is those three joined by a pipe. That composite is the physical id, which is also what a policy's ScalingTargetId carries when a template points one at the other with Ref, so the provisioner splits it back into the triple. A policy's Ref is its ARN rather than its name, so deleting one resolves the ARN through findPolicyByArn to recover the name and triple the service deletes by. Because the target's id is derived from the triple, changing any part of it replaces the target rather than updating it, so both types go through ReplacementCleanup to deregister what they displaced. Deletes tolerate only ObjectNotFoundException through CfnDeletes.safeDelete: a target takes its own policies with it, so a stack teardown reaches an already-deleted policy by ordinary ordering, while any other failure still surfaces as DELETE_FAILED. The properties each schema marks required are enforced rather than defaulted. MinCapacity and MaxCapacity on a target, and PolicyName and PolicyType on a policy, would otherwise register a target that never scales or accept a template CloudFormation itself rejects. The two scaling configuration blocks are parsed by the same code the PutScalingPolicy API path uses, extracted to ScalingConfigurationParser, since CloudFormation spells their members exactly as the API does. One parser means a template and an API call cannot disagree about what a policy means. ScheduledActions on a target is logged rather than dropped silently: Floci does not run scheduled scaling, and a template that scales on a clock should not look fully provisioned when nothing is scheduled. * fix(cloudformation): resolve intrinsics inside the scaling configuration blocks Review on #5407: the two scaling configuration blocks and SuspendedState reached the parser as raw template JSON, so an intrinsic inside one was never resolved. That is worse than it sounds, because an intrinsic is still a non-null node: hasNonNull passes and the value is read with asDouble, asText or asBoolean, which answer 0, "" and false. A policy written as TargetValue: !Ref TargetCpu registered as a policy targeting 0 percent rather than failing, a ResourceLabel built with Fn::Join arrived empty, and a flag behind Fn::If read false. Each block now goes through ctx.engine().resolveNode first, which is what AutoScalingScalingPolicyCfnProvisioner already does with its own block. Only nested objects were affected: the top-level properties were already read through ctx.resolveOptional, which resolves. A target's Tags were dropped as well, passed to the service as an empty map rather than read with ctx.resolveTags. ScheduledActions now carries a note in the generated resource-type table rather than only a warning in the log, so the gap is visible before someone wonders why their clock-based scaling never fires. * test(cloudformation): make the SuspendedState intrinsic test fail without its fix Review on #5407: anIntrinsicInsideSuspendedStateIsResolvedToo passed against the previous commit too. REFS had no Suspend entry, so the flag resolved to an empty string and read false either way, and assertNotNull held regardless because the raw block was already an object. The test pinned nothing. REFS now maps Suspend to true and the assertion is on isDynamicScalingInSuspended(), so it fails with expected: <true> but was: <false> when SuspendedState is read without resolveNode. The redundant copy of the properties node is gone. |
||
|
|
af3672ed0c | fix(rds): reject malformed proxy boolean flags (#5453) | ||
|
|
09a2d5c005 |
fix(s3): answer GetObject Range requests as S3 does (#5436)
GetObject answered 416 InvalidRange to any Range that was not one valid byte range: several ranges, a last byte before the first, or a malformed value such as bytes=-, bytes=-1- or bytes=0--1. S3 answers those as a GetObject without a Range, with the whole object and 200, as LocalStack's AWS-validated capture of GetObject over a dozen ranges (test_get_object_range) records it. Only a range that starts past the end of the object, or bytes=-0, gets 416. HeadObject and a CloudFront S3 origin already answered them with the whole object. Since every caller now treats a Range that is not one valid range as no Range at all, ByteRange.resolve reports it as WHOLE, and the separate INVALID outcome is gone. The same capture shows a 206 for a range covering the whole object (bytes=-15 and bytes=0-100 of 10 bytes) carrying the object's checksum, which Floci left out of every ranged response. The User Guide's "Checking object integrity" has GetObject and HeadObject return a part's checksum for "a part number or byte range that aligns with a single part", and an object stored in one request, or completed from one part, is that part. Such a range now gets the stored checksum, from GetObject and HeadObject, when the request asks for checksums and the checksum is a full-object one. A composite checksum is not that of any one part, nor is a checksum of an object of several parts, so their ranges still get none. |
||
|
|
013a9214b5 |
fix(s3): answer an expired session with ExpiredToken when verifying signatures (#5435)
When S3 verified a signature, it answered a request signed with temporary credentials past their expiry as if the key did not exist: 403 InvalidAccessKeyId for a header-signed request, and 403 SignatureDoesNotMatch for a presigned POST and, under validate-signatures alone, for a presigned URL. S3's error list has 400 ExpiredToken, "The provided token has expired.", for an expired token, and IAM enforcement already answers S3 with it. The secret-key lookup finds nothing for an expired session, so when it comes back empty the three placements (header, presigned URL, presigned POST) now ask IamService whether the key and token belong to a session that has expired on its clock and is still stored, and answer 400 ExpiredToken if so. The token has to match. Sent with another token or none, an expired session is still answered as a key that is not registered, so a caller that does not hold the credential learns nothing about it. Once Floci has removed an expired session it no longer knows the key, as with enforcement. IamServiceTest moves a session past its expiry and checks that the new lookup answers only to the session's own token, and the boundary test now holds it to the same instant as the other lookups. S3ValidateSignaturesIntegrationTest signs with Sign-In credentials through a header, a presigned URL and a presigned POST: each is accepted until the clock passes their expiry, then answered 400 ExpiredToken. An expired session sent with another token still gets InvalidAccessKeyId. Each placement's test fails without its part of the change, and the token tests fail when the token is not checked. S3RequestSigner can now write a presigned URL's query string, so the presigned URL test signs the way an SDK presigner does. |
||
|
|
d884d55c26 |
fix(iam): evaluate every IAM action against the resource it acts on (#5404)
Under enforcement, almost every IAM action reached the policy evaluator with
* as its resource, because ResourceArnBuilder named only the server-certificate
operations and everything else fell through to the wildcard. A statement naming
an IAM resource was therefore ignored, and wrongly in both directions, because
the evaluator globs the statement's pattern against the request's resource and
a resource of * is matched as that literal string. So a Deny on
arn:aws:iam::000000000000:user/bob did not stop DeleteUser for bob, while an
Allow scoped to that same user did not permit DeleteUser on anyone at all: a
least-privilege policy naming the resource it meant to grant refused the call.
Measured both ways by reverting this resolver to the wildcard, which turns the
permitted call in aResourceScopedAllowGrantsThatUserOnly into a 403 and the
refused call in aDenyNamingOneUserLeavesTheOthersAlone into a 200. Nothing
failed and nothing warned, which is the dangerous shape for an emulator people
test policies against.
The resource type each action is evaluated against now comes from AWS's own
authorization metadata for IAM, action by action. That is not the parameter an
action happens to take: AddUserToGroup and RemoveUserFromGroup are evaluated
against the group, AddRoleToInstanceProfile and RemoveRoleFromInstanceProfile
against the instance profile, and EnableMFADevice, DeactivateMFADevice and
ResyncMFADevice against the user rather than the device they name. Mapping those
from the request's parameters would have scoped them to the wrong resource and
let a deny on the right one pass.
An action acting on a resource that exists is checked against that resource's
stored ARN. The reference gives the formats as user/${UserNameWithPath},
group/${GroupNameWithPath} and so on, so the path is part of the ARN a policy
names, and only the store knows it; the stored ARN also carries the partition
the resource was created in, which re-minting from the caller's signing region
would get wrong. A create has nothing stored, so its ARN is minted from the
request's own Path: reading a stored path there would authorize a create into
/team/ against the root path.
A policy, MFA device, SAML provider, OIDC provider or principal is named by an
ARN the request already carries, so that is passed through rather than rebuilt
from parts. Only an ARN is: a hardware MFA device's SerialNumber is a bare
serial, and naming the request after it would produce a resource no policy could
be written against.
That table is read before the one keyed by resource type, so an action in both
would silently take its ARN parameter and the mistake would look like a resource
that never matches rather than like a bug. An attach is the case that makes it
worth pinning down: it carries both a user and a policy ARN, and the reference
gives it the user alone, so it stays out of that table and
iamNamesTheUserRatherThanThePolicyOnAnAttach is what holds it there.
UpdateUser and UpdateGroup join UpdateServerCertificate in naming both the old
resource and the one the request would produce. Both are documented, which the
certificate case was not: UpdateUser's reference says the requester "must have
appropriate permissions on both the source object and the target object", and
UpdateGroup's that a principal allowed to update the old group but not the new
one has the update fail.
Two actions name their role indirectly and are derived rather than looked up.
CreateServiceLinkedRole does not name the role it creates, so the check reads
the same ServiceLinkedRoles table the create reads and cannot name a different
role. GetServiceLinkedRoleDeletionStatus carries only a DeletionTaskId, and its
reference publishes that identifier's format as
task/aws-service-role/<service-principal-name>/<role-name>/<task-uuid>, which is
the role's own path and name with a prefix in front and a uuid behind; the role
is already deleted by the time the status is asked for, so there is no stored ARN
left to read either way. The /aws-service-role/ path moved to that class, so there is one copy of
it rather than a second in the builder. GetAccessKeyLastUsed names only a key,
and is evaluated against a user: the User Guide's own iam:*AccessKey* example
scopes exactly that set to user/${aws:username}, so the owner is resolved from
the key.
That covers all 130 of the IAM actions this emulator dispatches that AWS gives a
resource type, out of 164 in total. The remaining 34 have no resource type in the
reference, such as ListUsers, GetAccountSummary and SimulateCustomPolicy, so *
is the right answer for them. An action that names its target only by defaulting
to the calling user, such as GetUser or ChangePassword with no UserName, is
resolved from the credential instead, which the last paragraph here sets out.
Nine enforcement tests drive the whole path rather than the ARN the builder
returns, since the defect was invisible: a scoped statement was ignored, not
rejected. They cover a deny that must bind to one user and leave another alone,
the stored path being part of the ARN, the group and the instance profile being
the resource where two entities are named, a managed policy named by ARN, a
create authorized against the path it asks for, a rename refused on its
destination alone, and a scoped Allow granting one user only. Reverting the
mapping to the wildcard fails all nine.
The map is vendored rather than written out here, because a hand-written copy of
AWS's metadata is exactly what tools/aws exists to prevent.
regen_iam_action_resources.py generates src/main/resources/aws/iam-action-resources.json
from the same reference, 190 actions with the resource types each is authorized
against plus the ARN format of all 15 resource types, and it gates the file the
way regen_service_namespaces.py gates the namespace list: --check offline for
shape, --verify online against AWS. A type the file claims and AWS does not fails,
since that would authorize against a resource AWS does not use, which is the one
outcome worse than the wildcard. A type or an action AWS has added is reported
without failing, because being behind leaves that action on * and failing there
would break this build for someone else's launch. make
iam-action-resources-check runs per pull request beside the namespace check, and
make iam-action-resources-verify weekly in the drift workflow. Its unit tests need
no step of their own: make aws-data-test in that same job already runs every
generator's.
So no list of actions is written down here. What stays in code is the half that is
Floci's rather than AWS's: the parameter each resource type arrives in, the nine
creates and the name each spells, the actions whose request carries an ARN, the
three resolved from something other than a name, and the three resource types
that belong only to actions the handler does not dispatch. IamActionResourcesTest
checks the code against the data: every resource type AWS uses must be resolved
or declared unresolved, every create must have exactly one type to mint, and
every minted prefix must match the ARN format AWS publishes for that type. A
regeneration that brings in a new resource type then fails a test naming the
type, rather than quietly putting that action back on *, which is the permissive
answer and a silent one. The create check reads the resolver's own map rather
than restating it, so a create added there is checked too, and the minting falls
back to the wildcard instead of indexing an empty list: a create AWS authorizes
against no single type has no ARN to build, and a request should not fail on
what is a defect in this class.
The reason each declared-unresolved type gives is a claim about the handler, not
about the builder, so nothing inside the builder can check it, and getting it
wrong is silent and fail-open: dispatching such an action without teaching the
resolver its type leaves it evaluated against *, which is the gap this closes.
UnresolvedResourceTypesIntegrationTest therefore sends every action carrying one
of those types and holds it to answering UnsupportedOperation, naming the action
and what to do if it no longer does. No other vendored-data loader validates at class init
either, so the checks read the data the way AwsPartitions and
AwsServiceNamespaces do: parse, and let the gate and the tests have the opinion.
The nineteen user actions whose UserName the model marks optional act on the
user who signed the request, so that user is the resource they resolve to. The
access key id in the credential names the identity, which is the same lookup
GetAccessKeyLastUsed already makes on a key passed as a parameter, and the
stored ARN carries the path and partition as everywhere else here. The wildcard
still stands when the signer is not an IAM user, an account's root stand-in and
a session credential having no user record to name.
What stays at the wildcard is what AWS gives no resource type, 34 of the 164.
Closes #4979
The online gate verifies the ARN formats as well as the action mapping. A format
drifts invisibly otherwise: the offline check only asks whether it still looks
like an IAM ARN, and a changed one does, while the minting reads that string to
place the resource type. So a right-looking file could build a wrong ARN.
The resource types this class covers are worked out from its own tables rather
than restated in the test, so a type cannot be waved through by adding it to a
list in the test file. That is the check the earlier startup guard made.
The three actions whose resource the request carries in some other form hold
their own resolver, rather than being listed in one place and routed by name in
another. A list cannot then say an action is handled while the dispatch has
nothing for it, since adding a key means supplying the resolver that goes with
it.
The enforcement suite removes what it creates. The emulator is shared, so a user,
group, role, profile, policy or provider left behind turns up in the next class
to list one, and the shared fixture helper grew the prerequisites IAM enforces
before a delete: group memberships and attached policies for a user, inline and
managed policies for a role and a group. A rename leaves its destination name
behind rather than the name that was created, and the create test goes through
the enforced path, so both register their own removal.
The drift workflow stays one check, and make iam-data-verify is what keeps that
honest. Two sequential steps stop at the first failure: while the namespace list
was stale, the action resource check this change adds never ran at all, so the
gate arrived unexercised in CI. The target runs both regardless of the first
result and then fails, naming the file that drifted rather than leaving a reader
to guess from one message. The workflow file is renamed to match what it covers,
and the IAM targets it uses join .PHONY, which they should have done when they
were added.
That namespace check was red because AWS retired evidently and iotevents, and
the vendored list still claimed both. Regenerating it drops those two, picks up
end-user-messaging and startups, and leaves the count at 456. A retired
namespace only narrows wildcard expansion; a policy naming one literally is
still reported, since a namespace written out is kept whether or not the catalog
knows it.
|
||
|
|
9a7ec1c9d0 |
fix(dynamodb): mark time-to-live deletions on the stream as AWS does (#4930)
AWS writes a TTL deletion to the table's stream as a REMOVE record whose
userIdentity names the DynamoDB service. A DeleteItem removal has none.
The member names depend on where the record is read:
- The DynamoDB Streams API (GetRecords) capitalises them, as the SDK's
Identity shape expects:
{"PrincipalId": "dynamodb.amazonaws.com", "Type": "Service"}.
- The Lambda and EventBridge Pipes event record and the Kinesis Data
Streams destination payload use lowercase names,
{"type": "Service", "principalId": "dynamodb.amazonaws.com"}, the
shape the developer guide's TTL filter pattern matches.
With the DynamoDB Local engine, Floci passed Local's record through as
is: eventName UNKNOWN_TO_SDK_VERSION and no userIdentity.
DynamoDbLocalBackend now rewrites such records in a successful Streams
GetRecords reply to REMOVE with the Streams API identity, the one place
the public API, the Lambda poller, Pipes and the Redshift zero-ETL
consumer all read through.
The native engine wrote REMOVE but no identity, so a TTL deletion could
not be told from a DeleteItem. The sweep now marks its stream records
(a new in-memory DynamoDbStreamRecord flag) and its Kinesis CDC records.
GetRecords writes the Streams API identity, and the Kinesis record the
lowercase one.
The Lambda event source mapping poller and the Pipes poller rename the
Streams API identity to the event record shape before filtering and
delivery. DynamoDbTtlIdentity.Shape holds the member names of every
output. DeleteItem removals are unchanged.
|
||
|
|
04621d8444 |
fix(apigatewayv2): honor payload format 1.0 (#5338)
* fix(apigatewayv2): honor payload format 1.0 * fix(apigatewayv2): preserve v1 stage variables * fix(apigatewayv2): preserve v1 authorization header * docs(apigateway): document v1 IAM identity context |
||
|
|
80e8b7465d |
fix(ec2): preserve endpoint IP types across updates and templates (#5438)
* fix(ec2): preserve endpoint IP types across updates and templates * fix(ec2): honor omitted endpoint address types in templates |