mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
8921ca11182ffd1fb8ac4ddb13cb855a24a008a7
1623
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8921ca1118 |
feat(ec2): answer MonitorInstances and UnmonitorInstances (#3319)
* feat(ec2): answer MonitorInstances and UnmonitorInstances
Both actions returned UnsupportedOperation. Detailed monitoring is a CloudWatch
billing switch with no behaviour an emulator can meaningfully model, which is
presumably why it was left out -- but declining the call is more costly than
answering it, because one unsupported action fails an entire deployment regardless
of how much of the rest of it succeeded. An aws_instance declared with
monitoring = true
calls MonitorInstances immediately after RunInstances, so the whole configuration
is discarded over a flag with no state behind it.
Acknowledge the requested state and echo every instance the caller named. Nothing
is stored: there is no monitoring data to serve, and DescribeInstances does not
report a monitoring state today, so persisting one would only create a second
place for it to be wrong.
Reference: the MonitorInstances response shape -- instancesSet of
InstanceMonitoring, each with instanceId and monitoring.state, plus requestId --
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_MonitorInstances.html
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_UnmonitorInstances.html
One deliberate deviation: AWS reports state "pending" because the change is applied
asynchronously, then settles on "enabled". The emulator has nothing to settle, so it
reports the terminal state directly. Reporting "pending" for a transition that would
never complete would be worse for any client that polls.
* fix(ec2): reject monitoring for an instance that does not exist, and store the state
Two problems, both of which made the action answer confidently about something it
had not done.
The handler echoed every InstanceId back with a 200 without resolving it, and did
not even take a region to resolve it with. Naming an instance that does not exist
got a success response saying its monitoring was enabled. Every other instance
operation raises InvalidInstanceID.NotFound; this now does too, by delegating to
the service and resolving each id through getRequiredInstance, which is the same
shape stopInstances and the rest already use.
The state was also never stored. Instance already carries a monitoring member and
DescribeInstances already emits it, so MonitorInstances reported "enabled" while
every subsequent read still said "disabled". The state now persists, so the round
trip agrees with itself.
The previous tests asserted the old behaviour: they passed a made-up instance id and
expected 200. They are rewritten to launch a real instance, and two cases are added
for the not-found path plus one that reads the state back through DescribeInstances.
* test(ec2): name the monitoring suite for what it is, an integration test
It is a @QuarkusTest driving the HTTP endpoint, and the repository's dominant
convention for those is *IntegrationTest: 607 of the 736 @QuarkusTest classes on
main follow it. Renaming rather than arguing, since the evidence here points at
the convention.
* test(ec2): cover monitoring through the SDK path, not only the Query wire
AGENTS.md asks for management APIs to be validated with SDK clients and "not only
handcrafted HTTP requests". The Java test drives the Query endpoint with RestAssured,
which is right for pinning exact XML but does not exercise the path aws_instance
actually takes: monitoring = true calls MonitorInstances through the SDK, which parses
the response rather than reading whatever XML we happen to emit.
Three cases in the awscli suite, which is where EC2 SDK coverage already lives:
enable and read back through DescribeInstances, disable and read back, and reject an
instance that does not exist. The read-backs are the point rather than padding: the
bug this guards against was the handler answering "enabled" while every later read
still said "disabled", which asserting on the mutating call's own response cannot see.
Verified as far as this machine allows. run-instances, the teardown and the harness
plumbing all work against a local emulator; the three assertions themselves cannot
pass here because the released 2.0.1 image predates MonitorInstances, which is the
gap this PR closes. They run against the branch build in CI.
|
||
|
|
2d5a8f705b |
fix(amazonmq): add configuration for AMQP and console host port ranges (#3315)
Signed-off-by: Matheus André <matheusandr2@gmail.com> |
||
|
|
8180d4b3b8 | feat(acm): enhance email validation to report approval mailboxes and omit DNS records (#3290) | ||
|
|
66ca9dc4a6 |
fix(dynamodb): bind every PartiQL parameter type and reject unordered operands (#3288)
* fix(dynamodb): bind every PartiQL parameter type and reject unordered operands PartiQL parameters only bound S, N, BOOL and NULL. Every other type was rejected with "Unsupported parameter type in parameters array", so a statement could not compare against B, SS, NS, BS, L or M. Keep those parameters as their wire node and pass them through unchanged. Binding them makes the ordering operators reachable for types that have no ordering, so <, <=, >, >= and BETWEEN now reject any operand outside S, N and B. The message names the operator as it was written. Takes tier2/partiql in the dynamodb-conformance suite from 70 to 113 of 186, with no regression elsewhere in the suite. * fix(dynamodb): validate PartiQL parameters as AttributeValues before they run A parameter was bound on the first type key it carried. A value with zero or several type keys was accepted, and a binary that is not base64 reached the comparison and failed with a 500. Check every parameter the way AWS reads a request. Base64 is checked first and fails with SerializationException. Then each value must carry exactly one type key, down through lists and maps, or it is a ValidationException with the AWS wording. The binary comparison in ExpressionEvaluator now decodes through the guarded path, so a FilterExpression against a binary that is not base64 is a 400 as well. Checked against real DynamoDB in ap-northeast-1 on 2026-09-10. |
||
|
|
dde11aeb6a |
fix(cloudformation): keep unchanged VPCs and security groups on stack update (#3033)
* fix(cloudformation): keep unchanged VPCs and security groups on stack update provision() re-runs for every resource on every UpdateStack, changed or not. Ec2VpcCfnProvisioner called createVpc() and provisionSecurityGroup() called createSecurityGroup() unconditionally, so an untouched VPC or security group was re-created under a fresh id on every update - silently orphaning every subnet, route table and group that referenced the old one. The security group case hid behind the VPC one: because the VPC id changed too, the (name, vpcId) duplicate check never fired, so the stack still reported UPDATE_COMPLETE while leaking a second group. Both now reuse the resource the stack already points at. A changed CidrBlock (VPC) or a changed GroupName (security group) is still treated as a replacement, and a resource deleted out of band still falls back to create. Adds CfnUnchangedResourceUpdateIntegrationTest, which asserts physical-id retention across an update for VPC, security group, S3 bucket, SQS, SNS, log group, ECR, KMS alias and Kinesis. Asserting UPDATE_COMPLETE alone is not enough - a re-created resource passes that while breaking every reference to it. * fix(cloudformation): reconcile a reused security group's inline rules Reusing an unchanged security group instead of re-creating it exposed a second bug in the same arm: authorizeSecurityGroupIngress/Egress append without a duplicate check, and the inline SecurityGroupIngress/SecurityGroupEgress loops run on every provision pass. A reused group therefore accumulated another copy of every inline rule on each UpdateStack. Re-creating the group had masked this, since each update authorized onto a brand new group. Clear the rule sets the template declares before re-authorizing, which also drops rules the template no longer lists. A set the template does not declare is left alone, so a group keeps its default egress. Also narrows reuse: GroupName, GroupDescription and VpcId are immutable on a security group, so a template that changes one wants a new group rather than an edit to this one. Only the GroupName check was exercised before. Adds securityGroupInlineRulesAreNotDuplicatedByAnUpdate, which asserts the group still describes each inline rule exactly once after an update. Verified non-vacuous: without the revoke it fails with the rule present twice. * test(cloudformation): focused provisioner coverage for AWS::EC2::VPC Mirrors S3CfnProvisionerTest: mocks only Ec2Service and pins the create path's Fn::GetAtt keys (VpcId, CidrBlock, DefaultSecurityGroup) alongside the three update outcomes - reuse when nothing changed, replacement on a changed CidrBlock, and a fresh create when the VPC is gone from the backend. The integration test asserts physical-id retention end to end but cannot show which service call was made; this pins that createVpc is not called at all on an unchanged update. * fix(cloudformation): authorize only the inline rules a group is missing Clearing the declared rule sets before re-authorizing fixed the duplication but introduced a worse defect: a group can also carry rules from standalone AWS::EC2::SecurityGroupIngress/Egress resources, and the revoke took those with it, so an unrelated stack update silently closed ports another resource owns. A rule rejected mid-authorize also left the prior set already deleted, with nothing to restore it. Reconciliation is now additive. Each declared rule is authorized only when the group does not already carry it, compared on a canonical key since IpPermission and its range types define no equals. Nothing is revoked, so neither failure mode is reachable. The trade-off is explicit: a rule dropped from the template is no longer revoked. Doing that safely needs the provisioner to record which rules it authorized, which this arm cannot do while it lives in the legacy monolith. Also compares the VpcId a template would actually resolve to rather than the raw property. createSecurityGroup resolves an omitted VpcId to the region's default VPC, so the stored group always has one - comparing against a null property let a template that drops VpcId keep a group in the VPC it had named. Adds anUpdateLeavesRulesOwnedByStandaloneResourcesAlone. Verified non-vacuous: restoring the revoke fails it with the standalone rule gone. * fix(cloudformation): branch AWS::EC2::VPC on the context's prior id provision() serves create and update, and assigns the new physical id onto the resource as it runs, so deciding create-vs-update by reading that id back flips mid-method. AGENTS.md step 4 asks for ctx.isUpdate()/ctx.priorPhysicalId() instead, and the Scheduler provisioner shed the same pattern in #2985. The two agree on today's call path, since the engine seeds both from the same existing id, so this is the convention rather than a live defect. The test was the part that had it wrong: it built a create-path context and set the prior id only on the resource, so it passed either way. Pinned by anIdOnTheResourceAloneDoesNotCountAsAnUpdate, which provisions a resource carrying an id under a create context and fails when the VPC is looked up for reuse instead of created. * fix(cloudformation): match a security group rule that names its peer A rule naming its peer through SourceSecurityGroupName was re-authorized on every update. Ec2Service.resolveGroupReferences fills in groupId on the pair as it records the rule, the declaration toIpPermission hands back on the next pass carries only the name, and the duplicate key preferred the id whenever one was present, so the two forms never matched and the group accumulated another copy of the rule each time. Both sides now resolve a bare name to its group id before keying, the same lookup the service performs, confined to the group's own VPC because names are unique per VPC. A name matching nothing there stays a name, which is also what the service does, so an unresolvable peer still compares equal to itself. Pinned by aRuleNamingItsPeerByNameIsNotDuplicatedByAnUpdate, which reports the rule twice when the resolution is dropped. Its DependsOn is load-bearing: the peer has to exist when the rule is first authorized, or the stored pair keeps the unresolved name and both sides agree for the wrong reason. Also moves a doc comment back onto the test it describes. * test(cloudformation): parse the describe body with XmlParser The physical-id helper pulled LogicalResourceId/PhysicalResourceId pairs out of the DescribeStackResources response with a regex, which the repo rules forbid for XML. extractGroups on "member" gives the same pairs as a map per resource, so the member is picked by its logical id rather than by matching across tags. |
||
|
|
cf1aabce39 |
feat(ec2): back each VPC with a real Docker network in RFC 1918 space (#3272)
* feat(ec2): back each VPC with a real Docker network in RFC 1918 space An instance's private IP was a plausible-looking number nothing could connect to. Every VPC now gets its own Docker network, created lazily on the first launch into it, with the VPC CIDR as the network's IPAM pool and each subnet allocating static addresses from its own slice. The address Floci reports is one the container actually holds, and instances in different VPCs sit on different bridges. One network per VPC, not per subnet: subnets inside a VPC route to each other in AWS, so a network per subnet would manufacture a partition AWS does not have and break the two-tier app/database topologies this corpus is full of. The declared CIDR is used verbatim wherever it can be. It cannot be when it is absent, malformed, outside RFC 1918, or already claimed on the Docker daemon, which includes another Floci VPC: two VPCs may legally declare the same CIDR in AWS but one daemon cannot route two identical ranges. Only then is an equivalent block drawn from the configured fallback pool, and the substitution is logged at WARN. A reported private IP that does not mean what the caller declared is either true or it is in the log. Leases are given back on every exit: a launch that never attaches, a launch that fails, and terminate. Detach precedes release, because Docker holds the address while the endpoint stands and would refuse the next launch handed the same one. Startup reconciles this emulator's own orphaned networks first (scoped by API port, so instances sharing a daemon never touch each other's), then re-declares the plan from persisted VPCs and subnets and re-reserves the addresses restored instances still hold. Between-VPC isolation is the Docker daemon's, not Floci's, and OrbStack does not enforce it. On such a host the VPC boundary is an addressing boundary only. docs/services/ec2.md says so. Off with FLOCI_SERVICES_EC2_VPC_NETWORKS_ENABLED=false, and off whenever ec2 mock is on. * fix(ec2): do not adopt a leftover VPC network that routes another range materialise() treated any network under the VPC's own name as its own: a successful inspect set created=true and returned. A network left by a previous run that declared a different CIDR was therefore adopted, after which addresses were handed out of vpc.effective while the bridge routed something else entirely. Compare the leftover's IPAM subnet to vpc.effective. A match is adopted as before. A mismatch is removed and recreated on the planned range rather than re-planned onto the leftover's subnet: by the time materialise runs, addresses have already been allocated from vpc.effective, and after a restart some are leases held by live containers, so the plan cannot move under them. The network name carries this emulator's own port and region, so recreating it cannot destroy a user's network. If the removal fails the instance stays on the shared bridge, which is a documented degradation, instead of holding an address nothing routes. Also make small blocks work or refuse out loud. FIRST_HOST_OFFSET was a flat 10, so a /29 (eight addresses) and a /30 (four) allocated nothing at all and said nothing about it, and fallback-prefix-length had no upper bound to stop a /30 being configured. The offset now scales down to 2 for blocks that cannot spare ten addresses, a block with no room for a host is refused at plan time with a WARN, and the fallback prefix is clamped into the range that can serve hosts. * fix(ec2): keep the IMDS source address current across start and restore Ec2MetadataServer resolves an instance from the source address of the request, and a container's default route is the bridge, so a VPC-attached instance's metadata requests arrive from its bridge address rather than from the VPC address Floci reports. launch() registered both. start() and restoreMetadataRegistration() registered only the address getContainerBridgeIp returns, which for a VPC-attached container is the VPC address: neither refreshed imdsSourceIp nor registered the bridge. Docker hands out a fresh bridge address when a stopped container starts again, and an emulator restart rebuilds the registration map empty, so after either the instance's IMDS requests arrived from an address nothing knew about, while the address from the previous run stayed registered. Both paths now unregister the stale source address and register the current one. A bridge-only instance is unaffected: its reported address and its bridge address are the same, so there is no second registration. * fix(ec2): keep the IMDS source registration when inspect fails bridgeNetworkIp swallowed every inspect failure and returned null, the same answer it gives for a container that genuinely has no bridge address. refreshImdsSourceRegistration acts on that null by unregistering the instance's recorded IMDS source address, so one transient Docker hiccup permanently dropped a healthy instance's registration and put nothing in its place: its metadata requests stopped resolving until some later start or restore happened to succeed. Split the two answers apart. bridgeNetworkIp now lets the exception propagate, so null means only "no bridge address"; refreshImdsSourceRegistration catches it and returns early, leaving the existing registration exactly as it was. * docs(ec2): drop the em dashes this branch added AGENTS.md forbids em dashes in all content. The enforcing check runs with --diff-filter=A, so it only scans files a PR adds and stayed green on these, but a check that cannot see a violation is not a licence for it. Six of them are in lines this branch adds: four in docs/services/ec2.md, one in an Ec2ContainerManager javadoc, one in an Instance javadoc. Replaced with colons and commas. Wording is otherwise unchanged, and the em dashes already present in these files are left alone: they predate this branch, and rewriting them here would bury the actual change in unrelated churn. |
||
|
|
4cb9314a2d |
fix(dynamodb): read every attribute through an ALL-projection index in PartiQL (#3309)
A PartiQL read qualified with a secondary index trimmed each item to the attributes the index projects, but projectedAttributeNames returns only key attributes for an ALL projection, because "all attributes" cannot be enumerated from a schemaless table. Query, Scan and the selection validator each guard that case with "ALL".equals(projectionType); the PartiQL read path did not. Against an index that stores the whole item, a qualified SELECT * therefore dropped every non-key attribute, and naming one explicitly was rejected with "does not project". Both are wrong data rather than an error, and both disappear on the same statement against the base table. The existing coverage used only INCLUDE and KEYS_ONLY indexes, so neither case surfaced. The integration test adds an ALL-projection index and asserts SELECT *, an explicit non-key column, and Query over the same index agreeing; the INCLUDE and KEYS_ONLY expectations are unchanged. |
||
|
|
2fbe2b7c64 |
fix(ec2): generate real key material in CreateKeyPair and fingerprint imported keys (#3307)
* fix(ec2): generate real key material in CreateKeyPair
CreateKeyPair returned a fixed string literal as KeyMaterial:
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA0Z3VS5JJcds3xHn/ygWep4Ib/ue7YiKbCIZgYpYDe0+FAKE
-----END RSA PRIVATE KEY-----
That is a 63-character body -- a placeholder, not a truncated key. It does
not parse:
$ ssh-keygen -y -f key.pem
Load key "key.pem": invalid format
and it was byte-identical for every key pair in every region. No public
half was stored either, so Ec2ContainerManager.injectSshKey() had nothing
to write to authorized_keys for a created key.
The AWS API reference for CreateKeyPair describes the response as "an
unencrypted PEM encoded RSA or ED25519 private key", with KeyFingerprint
being "the SHA-1 digest of the DER encoded private key" for a key pair AWS
created. This is the only call that ever discloses the private key, and
callers are expected to use it directly: the Packer amazon-ebs builder
creates a temporary key pair, writes the returned material to a file, and
SSHes in with it. A placeholder cannot serve that, so no Packer build --
and no test that SSHes into an instance -- could work.
Generates a real 2048-bit RSA key pair (the size and type AWS uses for the
default KeyType=rsa), returns it as a PKCS#1 "BEGIN RSA PRIVATE KEY" PEM to
match AWS's encoding rather than Java's native PKCS#8, stores the matching
OpenSSH public key so injection has something to inject, and reports a real
SHA-1 fingerprint. KeyPairGenerator is already used this way in KmsService,
CognitoService and EksOidcService, and bcpkix is already a dependency.
ImportKeyPair reported the same constant fingerprint for every key. It now
reports the MD5 of the DER public key, which is what AWS reports for
imported keys. Only ssh-rsa is decoded back to a SubjectPublicKeyInfo; for
other key types the digest is taken over the wire-format blob, which is
stable and distinct per key but not byte-identical to AWS. Material that
does not parse yields no fingerprint rather than a digest of garbage, and
the caller falls back to the old placeholder.
Tests parse and use the material rather than pattern-matching it -- the
original literal would satisfy any shape check, which is how it survived.
They assert the PEM parses as a 2048-bit RSA key, that the emitted public
key is genuinely the other half of the returned private key, that distinct
calls yield distinct keys, that the OpenSSH length-prefix framing round
trips, and that an imported key's fingerprint ignores the trailing comment.
Related: the SSH path is also blocked by sshd never starting; see the
companion fix for Ec2ContainerManager.startSshd().
* test(ec2): cover the CreateKeyPair and ImportKeyPair wiring
Ec2KeyMaterialTest exercises the generator directly, so reverting the Ec2Service
side of the change left the whole EC2 suite green: 821 tests passed with
createKeyPair still handing out the placeholder literal. The production wiring
was the part with no coverage.
These two go through Ec2Service. The first parses what createKeyPair returns
rather than matching its shape, since the placeholder was a well formed PEM
envelope around 63 bytes and satisfied any pattern check, and asserts the public
half is stored, because that is what RunInstances injects into authorized_keys.
The second asserts two imported keys get different fingerprints, which the old
constant could not.
With the Ec2Service change reverted these fail as
"malformed PEM data: unable to decode base64 string: Index 63 out of bounds for
length 63" and "expected: not equal but was:
<00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00>".
* fix(ec2): bound imported key blob fields and fingerprint ed25519 as AWS does
Two problems in the ImportKeyPair path, both reachable with caller supplied
PublicKeyMaterial.
SshReader.readBytes allocated an array sized by a length read straight out of
the blob, and only then checked that the bytes were there. An eleven byte
request could declare a two gigabyte field, and the resulting OutOfMemoryError
is an Error, so the catch inside fingerprintOf did not contain it. The declared
length is now rejected before it is allocated when it is negative, larger than
what remains in the buffer, or over an absolute ceiling of 64 KiB. Bounding by
the remainder ties the allocation to the size of the request that carried it.
ed25519 imports were fingerprinted with MD5 over the wire blob. EC2 reports the
base64 encoded SHA-256 digest for ed25519 key pairs however they were created,
which is the ssh-keygen value without its SHA256: prefix and with the base64
padding kept.
The RSA import path is unchanged and was already right: AWS documents the check
as "openssl rsa -pubout -outform DER | openssl md5 -c", which is MD5 over the
DER SubjectPublicKeyInfo rather than over the SSH blob, and that is what
RSAPublicKey.getEncoded produces.
The existing fingerprint tests asserted digest shape, or compared the service
against the same helper it calls, so neither could see a wrong scheme. The new
ones pin both key types to values derived outside this codebase from fixed
throwaway keys, and assert the RSA value is not the MD5 of the SSH blob, which
is the scheme it could plausibly be confused with.
Refs: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/verify-keys.html
|
||
|
|
a339f3ae70 |
docs(lambda): correct the FunctionName charset claim in CodeStore (#3310)
The Javadoc on getVersionsPath, and the matching comment in CodeStoreTest, say floci "does not restrict the character set of FunctionName today, only that it is non-blank". That is wrong. LambdaArnUtils.validateName has validated the name since #450, against [a-zA-Z0-9-_.]+ with a 256 character ceiling. The conclusion both comments draw is unaffected: a dot is an accepted character, so "foo.v1" really is a function a user can create, and it really would have collided with a "<name>.v<n>" sibling directory. Only the stated reason was wrong, and it misdescribes the validation a reader would go on to look for. Both now name the actual pattern and point at #3238, which tracks the divergence from the live service. Comments only. No behaviour change. Refs #3238 |
||
|
|
b988dc5d1a |
feat(athena): support ListTagsForResource for workgroups (#3242)
* feat(athena): support ListTagsForResource for workgroups Fixes #2791. terraform-provider-aws's read/refresh for aws_athena_workgroup calls ListTagsForResource unconditionally, even when no tags are set, and floci's Athena handler had no support for the action: Error: listing tags for Athena WorkGroup ...: InvalidAction: Action ListTagsForResource is not supported Parses the workgroup name out of the ResourceARN (using the existing AwsArnUtils helper) and returns the tags already captured on CreateWorkGroup. The primary workgroup always answers with an empty list, matching a live account, since CreateWorkGroup already rejects "primary" and it can never carry real tags. An ARN for an unsupported resource type, or naming a workgroup that doesn't exist, faults with InvalidRequestException like the rest of this handler's not-found cases. * docs(athena): sync the supported-actions table for ListTagsForResource * fix(athena): reject ListTagsForResource ARNs naming a different service pgermosen (review): listTagsForResource only checked that the ARN's resource path started with workgroup/, never the service, so an ARN naming a completely different service with a coincidentally matching region and workgroup name resolved instead of being rejected the way real AWS rejects a ResourceARN naming the wrong service. Adds the explicit arn.service() == "athena" check, plus a RestAssured test proving a workgroup-shaped ARN under a different service is rejected even when a same-named workgroup genuinely exists. Verified by disabling the check and confirming the new test fails with the exact expected 400-vs-200 mismatch before restoring it. Also adds an SDK-client test (AthenaTest, compat suite) round-tripping ListTagsForResource through the real AthenaClient, per review request to validate request/response shapes the way other management API PRs do. |
||
|
|
d466ffe099 |
fix(s3): preserve SSE-KMS key ID metadata (#2145)
* fix(s3): preserve SSE-KMS key ID metadata * fix(s3): validate and copy SSE-KMS key metadata * fix(s3): return SSE headers on CopyObject and UploadPartCopy responses Both handleCopyObject and handleUploadPartCopy stored the destination's server-side-encryption settings correctly but never echoed x-amz-server-side-encryption / x-amz-server-side-encryption-aws-kms-key-id on their own response — only a follow-up GET/HEAD on the copy revealed it, which is why the existing SSE tests (checking only via HEAD) never caught this. Real S3 returns both headers on CopyObjectResult and CopyPartResult. UploadPartCopy required threading the KMS key id through CreateMultipartUpload too: MultipartUpload had no field for it, so a part's destination upload had nowhere to read it back from. * fix(s3): drop em dashes from merged UploadPartCopy comments AGENTS.md rules out em dashes anywhere in content. The two comments moved during the origin/main downmerge (handleUploadPartCopy's SSE-settings note and the relocated uploadPartCopyPreservesDestinationServerSideEncryption test) carried one each. Reworded to a period and a comma respectively. --------- Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> |
||
|
|
42bc0d934f |
fix(ecs): reconcile services in every account, not just the default one (#3297)
* fix(ecs): reconcile services in every account, not just the default one The reconciler is scheduled on a plain ScheduledExecutorService, so its thread has no active request scope. Every account-aware storage read inside it therefore resolves to the default account: AccountAwareStorageBackend falls back to defaultAccountId when it catches ContextNotActiveException. reconcileServices() iterates services.entrySet(), so it only ever saw the default account's services, and the services.put write-back in reconcileService landed in the default account too. A service created in any other account stayed at runningCount 0 forever with nothing logged, while the same service in the default account converged in about ten seconds. IaC hangs rather than fails on this, because aws_ecs_service with wait_for_steady_state polls until runningCount reaches desiredCount. Enumerate the accounts that own a service through AccountAwareStorageBackend.scanAllAccountEntries, then run each tick inside RequestScopes.runAs for that account. That helper exists for this case and its javadoc says so, and CurEmissionScheduler, AslExecutor and CloudFormationService already use it. The default account is always included, so single-account behaviour is unchanged, and the existing reconcile logic is reused as is. Each account's work is also guarded. scheduleAtFixedRate silently stops every future execution if the task throws, so one account's failure must not kill reconciliation for the rest or for the process. Fixes #3296. Verified: 1. EcsReconcilerMultiAccountTest moves a service to a non-default account and asserts the reconciler still places its task. It fails without the change (expected 1, was 0). EcsReconcileTickResilienceTest covers the guard. Full ECS suite green, 191 tests. 2. End to end against the real pulumi-aws v5 provider. An aws_ecs_service with wait_for_steady_state in account 000000000001 hung for the full 600s timeout before the change and reaches steady state in 16s after it. * fix(ecs): attribute each reconciled task to the account in its ARN reconcileTasks iterates taskHandles, which is a single in-memory map shared by every account, so running it inside the per-account loop reconciled every task once per account. Whichever account ticked first could claim a task whose containers had exited, leaving the owning account's runningTasksCount stale and emitting the STOPPED event on the wrong bus. Reconcile tasks once and scope each task to the account in its own ARN; only service reconciliation loops over accounts now. * fix(ecs): log task ARNs the reconciler cannot attribute to an account |
||
|
|
35159c5aaa |
fix(stepfunctions): persist execution history across restarts (#3291)
* fix(stepfunctions): persist execution history across restarts * fix(stepfunctions): preserve persisted execution history * fix(stepfunctions): preserve running execution snapshot during restart test Keep the in-flight worker alive until the persisted snapshot is reloaded, then wait for cleanup so the test cannot rewrite or retain its temporary state. * fix(stepfunctions): checkpoint persisted execution history |
||
|
|
d3530d90c9 |
fix(cloudtrail): bound log flush memory (#3293)
* fix(cloudtrail): bound log flush memory Drain pending records in bounded batches and stream JSON directly into gzip while preserving event order on retries. * fix(cloudtrail): drain flush backlogs safely (#3293) * fix(cloudtrail): clean up flush locks (#3293) * chore: retrigger CI * fix(iot): tolerate closed clients during shutdown |
||
|
|
47d96f619f | fix(appconfigdata): return empty payload on repeat polls (#3295) | ||
|
|
520568ef93 |
fix(sqs): bound message move task history (#3292)
* fix(sqs): bound message move task history * test(cloudtrail): isolate scheduled flush in integration test |
||
|
|
4d199b144e |
fix(dynamodb): add missing request validation (#3287)
* fix(dynamodb): add missing request validation for AWS parity - CreateTable rejects PAY_PER_REQUEST with ProvisionedThroughput - an INCLUDE projection without NonKeyAttributes on a GSI or LSI - a non INCLUDE projection carrying NonKeyAttributes - a StreamSpecification with StreamEnabled false plus a StreamViewType - Scan rejects TotalSegments above 1000000 - UpdateItem rejects ExpressionAttributeNames or Values supplied with no expression - a SET through a missing intermediate map path. * fix(dynamodb): validate GSI projection on UpdateTable create UpdateTable accepted an INCLUDE projection without NonKeyAttributes and a non INCLUDE projection carrying NonKeyAttributes. Real DynamoDB rejects both with the same message as CreateTable, and it does so before the table lookup. * fix(dynamodb): reject an empty NonKeyAttributes list on index projections An empty NonKeyAttributes array was accepted on CreateTable and UpdateTable index projections. Real DynamoDB rejects it with a length constraint on the 1-based member path, before the projection type check, and treats a null NonKeyAttributes as not specified. |
||
|
|
9fa36e9741 |
fix(sfn): apply state input and output paths (#3289)
* fix(sfn): apply state input and output paths Fixes #3258 Signed-off-by: 7487 <1042653432@qq.com> * test(sfn): cover default and parallel output paths Signed-off-by: 7487 <1042653432@qq.com> --------- Signed-off-by: 7487 <1042653432@qq.com> |
||
|
|
895adce214 |
fix(cloudformation): provision CloudFront policies and origin access controls (#3228)
* fix(cloudformation): provision CloudFront policies and origin access controls AWS::CloudFront::ResponseHeadersPolicy, CachePolicy, OriginRequestPolicy and OriginAccessControl had no provisioner, so the dispatcher's stub arm reported CREATE_COMPLETE with a synthetic id and a distribution that referenced it failed with "The specified response headers policy does not exist." A new CloudFrontCfnProvisioner creates each type through CloudFrontService: the physical id is the service id, Fn::GetAtt exposes Id and LastModifiedTime (Id only for the origin access control, per the registry schemas), updates go through the service's etag-guarded update, and deletes tolerate only the type's own not-found code so an in-use policy fails the stack delete as on AWS. The response headers configuration is reshaped into the flattened form the service's codec stores through the new ResponseHeadersPolicyConfigCodec.fromItemsTree. Closes #2441 * fix(cloudfront): reject deleting a cache or origin request policy in use DeleteCachePolicy declares CachePolicyInUse and DeleteOriginRequestPolicy declares OriginRequestPolicyInUse, both 409 sender faults, and both are documented as refusing the delete while the policy is attached to a cache behavior. Floci checked only two of the four policy-shaped types: deleteResponseHeadersPolicy and deleteOriginAccessControl raised their in-use errors, while these two deleted unconditionally once the etag matched. A policy still referenced by a distribution could be removed, leaving that distribution pointing at something that no longer existed. Both now raise the modeled error after the etag check, matching the ordering the other two deletes already use. Cache, origin request and response headers policies all hang off the same two places, a distribution's default cache behavior and its ordered ones, so the three near-identical scans collapse into one helper that differs only in which id it reads. The per-distribution association count keeps its own entry point, since it asks about one config at a time and can be handed a distribution with none. Found while reviewing the CloudFormation provisioner in this PR, which was already written for this: its delete tolerates only NoSuch<Type>, so it fails the stack correctly now that the service raises the in-use error. The CloudFormation integration test covers that end to end: it attaches both policies to a distribution and still deletes the stack cleanly, because CloudFormation removes the distribution before the policies it references. Four tests: a cache policy attached to a default behavior and to an ordered one, an origin request policy in use, and an unattached policy still deleting. * test(cloudformation): parse stack outputs with XmlParser The CloudFront policies integration test pulled Outputs out of the DescribeStacks response with two regular expressions over <member> and <OutputValue> blocks. XmlParser.extractPairs already does exactly this, and seventeen sibling CloudFormation integration tests define the same one-line helper over it, so the twelve-line version was reinventing a shared utility. It also matches the repo's rule against parsing XML with regex. Behaviour is unchanged, including the failure message that names the missing key. * fix(cloudformation): roll back a recreated CloudFront policy on a failed update When an update finds the prior policy or origin access control already deleted out of band, the provisioner recreates it under a new physical id. If a later resource then failed the stack update, the rollback left that new object behind: the engine only deletes resources the update ADDED, inside the previous == null branch of rollbackUpdatedResources, so an existing resource that merely acquired a new physical id fell through to the "Rollback is not implemented" arm, which deletes nothing. ReplacementCleanup already models exactly this, and CognitoCfnProvisioner wires it for the same situation, so the provisioner records the displaced entity after each provision and delegates the cleanup hooks and rollbackUpdate to it. A rollback now names the prior id again with the attributes it carried and deletes the object the failed update created. The physical id changes here only when the prior object was already gone, since prior() returns the entity whenever the service still knows it, so the recorded displaced entity is always one that no longer exists and its cleanup delete is a no-op tolerated by the type's not-found code. The hooks are still needed, or a recorded entity would stay owed a delete forever. An in-place update keeps its physical id, so nothing is recorded and rollbackUpdate answers false: putting a committed in-place change back needs a configuration snapshot this provisioner does not keep, the same limitation AWS::Cognito::UserPool has. A test pins that so it stays a decision. Raised by the review on this PR. My first reply argued the finding did not hold, generalising from the create path; that was wrong for this one, and the correction is on the thread. |
||
|
|
3218d2404e |
refactor(cloudformation): move the Events types into EventsCfnProvisioner (#3286)
* refactor(cloudformation): move the Events types into a per-service provisioner AWS::Events::Rule, EventBus and EventBusPolicy move out of the legacy monolith into EventsCfnProvisioner, continuing the decomposition. The block was already contiguous and self-contained: 18 methods and five constants, none of them referenced from outside, and EventBridgeService was the monolith's only user, so the field, its constructor parameter and both imports go too. Behaviour preserving. The event bus arm in particular already carried real logic worth keeping intact: rollback ownership, the created-time check that refuses to delete a bus recreated out of band, managed tag and policy tracking, and the rejection of an unsupported mutable update. All of it moves unchanged. Rule and EventBus were listed in DELETE_NEEDS_STACK_RESOURCE because deleting them needs stored attributes rather than the physical id alone: a rule remembers the custom bus it lives on, and a bus remembers the creation time proving the stack still owns it. That logic moves into the provisioner's delete(StackResource, String) override and both entries leave the set, which is what CfnDeletePrecedenceTest gates. EventBusPolicy keeps the id-only form, its composite busName|statementId id being enough. The four existing Events test classes needed no changes: they build the provisioner through CfnProvisionerFixture, so wiring the new provisioner there is all it took for them to exercise it. 40 tests across them still pass, and the schema-coverage gate finds no new attribute gaps. Monolith 6,457 to 5,954 lines, legacy types 47 to 44. * fix(cloudformation): keep an Events rule's identity and targets across an update provision runs again on every UpdateStack, and the rule arm got both halves of that wrong. An unnamed rule generated a fresh physical name each time, so the second update created a second rule and left the first behind, still matching events and still delivering to its targets. Name is createOnly and a rule's physical id is its name, so ctx.stablePhysicalName applies directly here, unlike the Batch types whose physical id is an ARN and which need the name read from a stored attribute. Targets were never driven to the template's desired state. PutTargets upserts by id and removes nothing, so a target dropped from the template stayed on the rule and kept receiving events indefinitely. The desired set is now reconciled after the put, which also covers a template that declares no Targets at all: that means no targets, so the sweep runs either way. The Targets property is checked for being an array before it is iterated. Five unit tests: an unnamed rule keeping its name, an explicit name still winning, a dropped target being removed, a cleared Targets list removing all of them, and an unchanged set removing nothing. * fix(cloudformation): surface a failed Events policy removal instead of hiding it Deleting an AWS::Events::EventBusPolicy wrapped the whole removal in a bare catch (Exception) that logged at debug and returned. Every failure was hidden: the statement stayed on the bus while the stack reported DELETE_COMPLETE, which is the outcome AGENTS.md rules out for deletes, since a real failure has to reach the stack as DELETE_FAILED. RemovePermission distinguishes its failures, unlike the Batch services where a single ClientException covers everything. It raises ResourceNotFoundException both when the bus is gone and when the statement is not on it, and those are the two cases that genuinely mean "already deleted". So the removal now goes through the shared CfnDeletes.safeDelete tolerating only that code, and anything else, a malformed statement id for instance, propagates. Two unit tests: an already-gone statement counting as deleted, and a ValidationException reaching the caller rather than being swallowed. * fix(cloudformation): drop the em dash from the moved Events javadoc The javadoc came across from CloudFormationResourceProvisioner verbatim. That file holds 30 em dashes but is an existing file, and the doc-style gate only scans the files a PR adds, so moving the prose into a new file is what surfaced a violation that was always there. * fix(cloudformation): read the prior event bus id from the provision context provision serves create and update, and it assigns the new physical id as it runs, so a resource-derived identity check can flip mid-method. The moved code read the prior bus name off the resource. It was captured before the assignment so the behaviour was right, but the convention exists precisely so the next edit cannot quietly break it. * fix(cloudformation): validate the Events policy StatementId The registry schema for AWS::Events::EventBusPolicy and the botocore model agree that StatementId is [a-zA-Z0-9-_]+, 1 to 64 characters, but nothing checked it, so an AWS-invalid value was accepted. It also made the physical id ambiguous. This provisioner keys a policy statement as "<bus name>|<statement id>" and the delete splits on the last separator. Neither the modeled bus-name pattern nor the statement-id one admits a pipe, so holding the value to the model closes that at source rather than by guessing at the split. * fix(cloudformation): restore rule targets when a stack update rolls back The reconciliation sweep this branch added can delete a live target, which nothing could put back: without a rollbackUpdate hook the resource fell to "Rollback is not implemented for AWS::Events::Rule", so a failed stack update left the rule no longer delivering to it and the stack reported UPDATE_ROLLBACK_FAILED. Before the sweep, targets were only ever upserted and there was nothing to restore. Snapshot the rule's targets before the first target call of an update and put them back on failure, following PipesCfnProvisioner: the snapshot is spent by whichever end the update reaches, restoring inside provision when this rule's own reconciliation failed and through rollbackUpdate when a later resource did. The restore is exact rather than additive, so a target the failed update added does not survive it. A restore that fails itself is recorded on the resource instead of thrown, so the stack reports the original failure. The snapshot carries the rule name, its bus and the region because the rollback hook is handed the stack resource alone, and a rule on a custom bus is keyed by that bus. This restores targets, not the rule's own properties, which putRule overwrites on the same path. That gap predates this branch. * refactor(cloudformation): hold the Events provisioner to a single injected service AGENTS.md requires a CloudFormation provisioner to inject only the service it wraps. This one also took an ObjectMapper, carried over from PipesCfnProvisioner when its rollback snapshot was modelled on that class. The package already has a second convention for exactly this job, and it is the one that satisfies the rule: LambdaEventInvokeConfigCfnProvisioner, the other snapshot-based rollback provisioner, holds a private static mapper and injects only its service, as do LambdaEventSourceMappingCfnProvisioner, Ec2NetworkCfnProvisioner and ReplacementCleanup. The configured mapper adds a 100 MB string limit and lenient empty-bean serialization. Neither reaches this code: EventBridge caps a bus policy near 10 KB and a target's Input at 8192 characters, both far under Jackson's default, and every type serialized here has real properties. No behaviour changes, so the existing tests are what prove the swap is inert. |
||
|
|
c4027bbf54 |
feat(iot): MQTT over WebSocket at /mqtt (#3150)
* test(iot): MQTT over WebSocket at /mqtt, failing * feat(http): echo MQTT WebSocket subprotocols * feat(iot): MQTT over WebSocket at /mqtt Bridges a WebSocket upgrade on /mqtt (HTTP and HTTPS) onto the broker's plaintext listener, so wss://host:443/mqtt works on the 443:4566 mapping with the same certificate as HTTPS and no extra listener or config. * docs(iot): MQTT over WebSocket at /mqtt * feat(iot): do not queue the /mqtt handshake behind ordered blocking tasks * fix(iot): forward only binary WebSocket frames to the broker One frame handler decides per frame: text closes with 1003, binary and continuation frames are written to the broker socket, control frames are left to Vert.x. Nothing else reads the frames, so a text payload can never reach the MQTT stream. * test(iot): AWS contract and framing tests for MQTT over WebSocket Handshake: only GET upgrades (405), unsupported version is 426, each MQTT subprotocol name is echoed and the first supported offer wins, ping gets pong, non-upgrade requests fall through. Framing (MQTT 3.1.1 section 6): a CONNECT split across two frames, two packets in one frame, garbage bytes and a frame over the transport limit. Session semantics as on AWS: MQTT 5 over wss, client id takeover across transports, retained messages, QoS 2 disconnects, shadow topics, topic rules, keep-alive pings and the IoT Data connection APIs on a WebSocket session. * test(iot): log the tolerated exceptions in the WebSocket contract tests * test(iot): pin the MQTT TLS port and the unrelated-subprotocol handshake The profile pins floci.services.iot.mqtt.tls-port now that #3142 opens 8883 whenever TLS is on. A client offering only graphql-ws on an API Gateway WebSocket path still connects, with no subprotocol echoed: the server-wide MQTT list does not affect other WebSocket routes. * test(iot): pin the deployment claims of MQTT over WebSocket Every claim the docs and comments make now has a test that fails without the behaviour: ws and wss share one port through TlsProxyServer (the 443:4566 path), a hostname learned by ensureHost serves /mqtt to a client verifying that name, the first upgrade starts a lazy broker (also eight at once, and again after a stop), a text frame or an abrupt TCP drop after a live CONNECT frees the broker session, 30 connect and disconnect cycles leave nothing behind, and the burst is 1000 messages. * test(iot): force-close the Paho client the broker stop left behind * test(iot): wait for the dropped session before closing the Paho client |
||
|
|
006f3c77c9 |
fix(cloudfront): echo OriginSslProtocols and round-trip legacy cache behavior fields (#3182)
A custom origin's OriginSslProtocols was dropped from the GetDistribution and CreateDistribution response. The AWS provider flattens CustomOriginConfig.OriginSslProtocols.Items with no nil guard, so the missing object segfaults it on the read that runs at the end of create. The legacy forwarded_values cache-behavior path lost more than that. Track it alongside the crash fix since both are the same read-back gap: 1. CustomOriginConfig now echoes OriginSslProtocols, round-tripping the submitted protocols and defaulting to TLSv1.2 when the client sends none. 2. DefaultTTL and MaxTTL were emitted only when greater than 0, so an explicit default_ttl = 0 (the usual "do not cache" with forwarded_values) read back as absent and drifted on every plan. Presence is now tracked separately from the value, so a submitted 0 round-trips and an unsubmitted TTL stays absent. 3. ForwardedValues echoed Headers and QueryStringCacheKeys as a bare Quantity 0 and the parser kept only QueryString and Cookies.Forward, so whitelisted headers, query-string cache keys and cookie names came back empty. All three now round-trip as Quantity/Items pairs, scoped so the shared Name element lands in the right block. 4. Both cache behaviors also round-trip ForwardedValues, SmoothStreaming and FieldLevelEncryptionId. Fixes #3208. Verified: 1. CloudFrontControllerTest gains tests that fail without the change and pass with it: OriginSslProtocols is present and round-trips, an explicit DefaultTTL of 0 survives the read-back, an unsubmitted TTL stays absent, and whitelisted headers, query-string cache keys and cookie names round-trip. Full CloudFront suite green, 181 tests. 2. End to end against the real pulumi-aws v5 provider. A distribution with a custom origin, defaultTtl 0 and whitelisted headers and cookies creates, reads back with no segfault, and destroys clean. The same run panics in flattenDistributionConfig before the change. |
||
|
|
64538f7d32 |
feat(iam): resolve resource and request tag condition keys for EC2 and S3 (#3212)
* feat(iam): resolve resource and request tag condition keys for EC2 and S3 bucket actions A policy scoped through aws:ResourceTag or aws:RequestTag never matched because neither key was placed in the request context. The resolver now reads aws:RequestTag from the tags named in RunInstances, CreateTags and PutBucketTagging, and aws:ResourceTag from the target's current tags for the EC2 tag and instance actions and the S3 bucket tagging and delete actions. EC2 and S3 are reached through Instance, as DynamoDB already is. Ported from lex00/floci#135. * fix(iam): authorize every target of a multi-resource EC2 request The resource tag context came from the first ResourceId or InstanceId only, so a caller could name a permitted resource first and act on later ones the policy did not allow. The resolver now yields one context per further target and the filter evaluates each of them, denying the request when any target fails. An untagged target gets an empty context so a tag condition fails on it. * fix(iam): read a repeated numbered parameter the way the EC2 handler does A Query request can repeat ResourceId.1 or InstanceId.1. The resolver kept the last value while the handler acts on the first, so the authorized resource and the acted-on resource could differ. The form parameters now keep the first value, and the remaining-targets pass starts only when member 1 is present, so both readers stop at the same numbering gap. |
||
|
|
5b7c2c4a62 |
feat(cloudwatch): store and serve metric stream definitions (#3214)
* feat(cloudwatch): store and serve metric stream definitions PutMetricStream, GetMetricStream, ListMetricStreams, DeleteMetricStream, StartMetricStreams and StopMetricStreams work over Query and JSON. A stream is a definition with a running or stopped state, and nothing is delivered to the Firehose delivery stream it names. The service lives in its own metricstreams package next to dashboards and is injected into both handlers, and the tag operations route a metric-stream ARN to it. Ported from lex00/floci#42. * fix(cloudwatch): validate nested metric stream members, page ListMetricStreams, keep batches atomic StartMetricStreams and StopMetricStreams resolve every requested name before changing any, so a batch naming a missing stream fails as a whole. PutMetricStream now checks the nested members: a filter needs a Namespace, an IncludeMetrics entry needs a Namespace and a MetricName, and a statistics configuration needs non-empty IncludeMetrics and AdditionalStatistics. ListMetricStreams pages through the shared Pagination helper with MaxResults and NextToken over both protocols. * fix(cloudwatch): answer an unknown name on StartMetricStreams and StopMetricStreams with InvalidParameterValue The model declares ResourceNotFoundException on GetMetricStream alone. Start and Stop declare InvalidParameterValue, so an unknown name in the batch answers that, still after resolving every name before any change. |
||
|
|
f77cf4da77 | fix(ec2,ssm): explain missing IMDS registration for SSM-only managed instances (#3283) | ||
|
|
f30ba77ac0 |
fix(ec2): answer DescribeTransitGatewayConnects with an empty list (#3274)
* fix(ec2): answer DescribeTransitGatewayConnects with an empty list LZA's tgw-associations-and-propagations module calls this unconditionally alongside DescribeTransitGatewayVpcAttachments. floci does not yet support creating Connect attachments, so the action was entirely unhandled and the module failed with "Operation DescribeTransitGatewayConnects is not supported", found while running LZA phase2 against parent 1176. Since floci has no Connect attachments to return, an empty list is the wire-faithful answer for every account. Requested attachment ids still validate against the shared tgw-attach- id namespace: malformed ids reuse the existing InvalidTransitGatewayAttachmentID.Malformed check, well-formed but unknown ids get InvalidTransitGatewayConnectID.NotFound. * test(ec2): cover DescribeTransitGatewayConnects over the Query protocol and make the service hook void The service method only validates the request; the handler always renders an empty transitGatewayConnectSet, so returning a List of VPC attachments suggested a resource type it never produces. It is void now. Two integration tests drive the action through the EC2 Query dispatch and pin the response wire shape (EC2 namespace, requestId, empty transitGatewayConnectSet) and the Malformed / Connect NotFound error codes. |
||
|
|
c57b8ff5f6 |
fix(apigateway): report rootResourceId and the API key defaults (#3269)
* fix(apigateway): report rootResourceId and the API key defaults
GetRestApi, CreateRestApi and GetRestApis returned only id, name, description,
createdDate, apiStatus, tags and endpointConfiguration. Three documented response
members were missing. None of them is ever supplied by the caller, so a client has
no way to obtain them other than from the response.
rootResourceId is the most load bearing. The root resource is created with the API
and is already reachable through GetResources, it was just not reported on the API
itself -- which is where a client reads it in order to parent its first resource:
resource "aws_api_gateway_resource" "hello" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_rest_api.api.root_resource_id # was empty
path_part = "hello"
}
apiKeySource and disableExecuteApiEndpoint are reported with the AWS defaults,
HEADER and false. Neither is settable on a REST API here: createRestApi ignores
both and updateRestApi patches only /name and /description, so the emulated value
is always the default. Reporting it beats omitting it, because a client that reads
an absent member back as "" or null sees a difference from the configuration it
just sent and never converges.
Reference: the GetRestApi response syntax and elements, including the sample
response carrying "rootResourceId" --
https://docs.aws.amazon.com/apigateway/latest/api/API_GetRestApi.html
apiKeySource is documented there with valid values HEADER | AUTHORIZER.
Tests assert that the reported rootResourceId is the same id GetResources gives the
"/" resource, and that a resource can actually be created against it.
* fix(apigateway): refuse to delete the root resource of a REST API
Reporting rootResourceId on the API only holds up if the resource at "/" is
still there. deleteResource had no guard, so a caller could delete the root and
leave the API with nothing to report and nothing to parent a new resource on,
a state with no way back short of recreating the API.
The root is created with the API and has no pathPart to address it by; it goes
away when the API does, via deleteRestApi, which cascades through the store and
is unaffected by this. putRestApi already skipped "/" when clearing resources.
The botocore model shipped with awscli 2.36.30 (apigateway/2015-07-09) lists
BadRequestException, httpStatusCode 400, among the errors of DeleteResource,
which settles the error type for a delete the service refuses to carry out. It
does not document the root-resource case either way, so the refusal itself is a
deliberate choice for the reason above rather than verified AWS parity, and the
message is descriptive rather than copied from AWS.
* fix(apigateway): let a vanished API cost only its rootResourceId
ListRestApis renders a snapshot of the APIs and resolves each one's root
afterwards, and that lookup read the API's resources, whose first act is to load
the API itself. An API deleted between the snapshot and the render was therefore
already gone by the time its root was looked up, and the NotFoundException it
raised turned the whole listing into a 404 rather than costing the caller one
member of one item.
The lookup moves into ApiGatewayService.findRootResourceId, which returns an
empty Optional for an API that is no longer there. The tolerance is narrow: only
NotFoundException is caught, every other AwsException still propagates, and
GetRestApi on a missing API is still a 404 because it loads the API directly.
|
||
|
|
922eb0b9e5 |
fix(acm): reflect the requested ValidationDomain in DescribeCertificate (#3264)
* fix(acm): reflect the requested ValidationDomain in DescribeCertificate RequestCertificate ignored DomainValidationOptions entirely: the handler never read the field, and generateDomainValidation hardcoded ValidationDomain to the certificate domain. A caller that asked for ValidationDomain=db.de read back the FQDN and could not tell whether the request was accepted as sent, even though the value decides which mailboxes may approve the certificate. Carry the requested ValidationDomain per DomainName through to the stored DomainValidation, and reject the entries AWS rejects: a DomainName that is not part of the request, and a ValidationDomain that is neither the domain itself nor one of its superdomains. That superdomain rule already backed ResendValidationEmail, so it moves to a shared helper rather than being written twice. Domains with no requested entry keep validating against themselves, which is what AWS reports when the caller supplies nothing. * fix(acm): reject incomplete DomainValidationOptions entries Both DomainName and ValidationDomain are required members of DomainValidationOption, but the parser skipped an entry missing either one, so RequestCertificate returned 200 and the domain quietly fell back to validating against itself. Reject those entries with the same InvalidDomainValidationOptionsException the other bad entries already get. Also brace the array guard, per the repository style rule. |
||
|
|
141b15939f |
fix(firehose): isolate streams by account and region (#3267)
* fix(firehose): isolate streams by account and region * test(firehose): preserve default owner resolution * fix(firehose): migrate owner-scoped state and source reads * fix(firehose): avoid ambiguous legacy checkpoints |
||
|
|
8e10fd1ea6 |
fix(ram): enforce resource share principal visibility (#3266)
* fix(ram): enforce resource share principal visibility * fix(ram): restrict resource share visibility * fix(ram): handle reassociated invitations |
||
|
|
290559cff0 |
fix(lambda): scope extracted function code by region (#3265)
* fix(lambda): scope extracted function code by region * fix(lambda): isolate new paths from legacy code * chore(ci): retry transient pull request checks |
||
|
|
e02accff4a |
fix(memorydb): scope resources by account and region (#3261)
* fix(memorydb): scope resources by account and region * fix(memorydb): migrate legacy records during scans |
||
|
|
496b376da1 |
fix(ec2): nest cidrBlockState in AssociateVpcCidrBlock response (#3243)
AssociateVpcCidrBlock returned cidrBlockState as a bare string instead of the nested <state> element that DescribeVpcs already returns for the same association. terraform-provider-aws's SDK waiter for aws_vpc_ipv4_cidr_block_association parses the nested shape, so it never observed a valid state and polled DescribeVpcs until giving up, hanging `terraform apply` on any secondary_cidr_blocks entry. Fixes #3241 |
||
|
|
eb3a6b23ef |
fix(ec2): match cidr-block-association filters on DescribeVpcs (#3257)
DescribeVpcs silently ignored the cidr-block-association.* and ipv6-cidr-block-association.* filters: unrecognized filter names fell through matchesFilter's default -> true, so every VPC in the account matched regardless of the requested association. terraform-provider-aws's waiter for aws_vpc_ipv4_cidr_block_association polls DescribeVpcs filtered by cidr-block-association.association-id and asserts exactly one VPC comes back. With more than one VPC in the account that assertion failed with a too-many-results error, which the SDK's retry machinery treats as not-found-yet rather than a fatal error, so the waiter retried until its create timeout, hanging terraform apply on any secondary_cidr_blocks entry. Fixes #3256 |
||
|
|
f4954dec02 |
fix(dynamodb): word BatchWriteItem key rejections the way AWS does (#3227)
* fix(dynamodb): word BatchWriteItem key rejections the way AWS does A key value can arrive on three surfaces, and AWS words the rejection differently on each. The boolean that told a Key argument from a PutItem item body is now an enum with a third value for BatchWriteItem. BatchWriteItem reports a schema mismatch rather than naming the types, and uses the "are not valid." form for an empty key value. PutItem and TransactWriteItems keep the "Type mismatch for key" form. An empty binary key value is now rejected on every surface. It was accepted before, where the empty string was already rejected. * fix(dynamodb): report a missing BatchWriteItem key as a schema mismatch * fix(dynamodb): use the same empty string key wording on every surface |
||
|
|
67198c7064 |
fix(elasticache): honor the requested Port on CreateReplicationGroup (#3276)
* fix(elasticache): honor the requested Port on CreateReplicationGroup
Port is a modeled optional input on CreateReplicationGroup ("the port number
on which each member of the replication group accepts connections"), but
allocateProxyPort took no argument and always handed out the next free port
from the base of the range. A caller that pinned a port read back a different
one, which Terraform reports as a replacement-forcing change and therefore as
permanent drift.
allocateProxyPort now takes the requested port and honors it when it is free
and inside the proxy range, matching NeptuneService.allocateProxyPort. Floci
multiplexes every group's proxy onto one host, so two groups genuinely cannot
share a port; when the requested one is taken or out of range this logs why
and falls back to the next free port rather than failing the create. In
cluster mode only the first node can take the requested port, because the
group reports its port from that node.
The compatibility fixtures pinned 6379, the bottom of the range and the port
floci would have allocated anyway, so they asserted nothing and passed by
coincidence. They now pin 6395, which fails without this fix.
* fix(elasticache): refuse a requested Port that cannot be honored
Honoring Port left one path that quietly ignored it: a requested port that was
already held by another replication group, or outside the range this emulator
serves, fell back to the next free one. The describe then reported the allocated
port, so a caller who pinned one still read back a different value and still saw
the replacement-forcing drift that honoring Port exists to remove. The narrower
case reproduced the bug the change was written to fix.
The fallback could only ever hit a caller who did ask for a port, since one who
does not care passes no Port at all and never reaches that branch, so it served
nobody. An explicit port is now either honored or refused with
InvalidParameterValue, the sender fault CreateReplicationGroup declares, naming
the port and the reason so the caller can pick another. Unpinned creates still
scan the range exactly as before, and the restore path for persisted groups is
unaffected because it asks for no particular port.
The two tests that pinned the old fallback are inverted rather than dropped, so
the new contract is held just as firmly, and one more proves an unpinned create
still falls back when the base port is taken.
NeptuneService.allocateProxyPort carries the same substitution and RdsService
ignores a requested port entirely; both are left for their own changes.
Raised by the review on this PR.
|
||
|
|
d322d48bd5 |
fix(ram): emulate organization sharing side effects (#3279)
* fix: emulate RAM organization sharing side effects * test(ram): add SDK organization sharing coverage |
||
|
|
ed116ae815 |
fix(guardduty): scope organization state across accounts (#3278)
* fix: scope GuardDuty state across accounts * test(guardduty): add cross-account SDK coverage |
||
|
|
9d4e71f8a2 |
feat(securityhub): add organization configuration operations (#3161)
* feat(securityhub): add organization configuration operations * fix(securityhub): complete organization configuration contracts * fix(securityhub): harden organization contracts * test(securityhub): log tolerated organization state * test(securityhub): clean organization fixture state * test(securityhub): isolate organization cleanup failures * fix(securityhub): return modeled invalid access error |
||
|
|
fd3c4d9ab6 |
feat(cloudtrail): support AdvancedEventSelectors and CloudFormation Trail provisioning (#2720)
* feat(cloudtrail): support AdvancedEventSelectors in PutEventSelectors and S3 capture Adds AdvancedEventSelector/AdvancedFieldSelector models, JSON wiring through PutEventSelectors/GetEventSelectors, mutual-exclusivity enforcement against basic EventSelectors, and field-selector evaluation (Equals/NotEquals/StartsWith/NotStartsWith/EndsWith/NotEndsWith) in the S3 data-event capture path. Lets a trail exclude its own log-delivery bucket via resources.ARN NotStartsWith, avoiding the CloudTrail circular-logging cost problem. Basic-selector behavior is unchanged. * feat(cloudtrail): add CloudFormation provisioner for AWS::CloudTrail::Trail Handles create/update/delete of AWS::CloudTrail::Trail via CloudTrailService, applies EventSelectors or AdvancedEventSelectors (mutually exclusive, same JSON shapes as PutEventSelectors), starts logging when IsLogging is true, and sets the trail ARN as the resource's physical id and Arn attribute. Delete is idempotent when the trail is already gone. * feat(cloudtrail): implement ListTrails and trail tagging Adds ListTrails (returns Name/TrailARN/HomeRegion for trails visible in the region, including multi-region trails), plus AddTags/ListTags backed by per-trail stored state, keyed by trail name or ARN. * fix(cloudtrail): emit data events for the trail's own log deliveries CloudTrailLogWriter.flushTrail() wrote delivered log files via a direct S3Service.putObject() call, bypassing S3Controller.emitCloudTrailEvent() - the only place that recorded an S3 data event. A trail whose selector matched its own destination bucket (the exact circular-logging config from upstream issue #1192 / PR #1194) never saw its own deliveries, so the emulator could prove the dangerous config was live but not reproduce the loop it causes. flushTrail now calls cloudTrailService.emitS3DataEvent() after each delivery, so internal writes are evaluated against selectors identically to API-driven ones. Closes issues/0034. * docs: mark issue 0034 fixed * fix(cloudtrail): resources.type reflects actual S3 resource, not hardcoded object Advanced selector matching hardcoded resources.type to AWS::S3::Object for every event, so an object-scoped AdvancedEventSelectors exclusion (the real-world fix for the issue 0034 self-delivery loop) still let bucket-level calls like ListObjects through against the excluded bucket. Now derived per event from whether an object key is present. Live-verified on 1160-ct: loop confirmed unbounded and compounding with external writes, then confirmed stopped by the real AdvancedEventSelectors remediation, with this gap found and closed in the same pass. Details in issues/0034 and issues/0035. * docs(0034): add raw delivery-size timeline from 1160-ct verification Per-cycle size data showing the burst-compounding and the fix-stop point concretely, not just summarized. * fix(cloudtrail): match delete() to current CfnResourceProvisioner signature Upstream/main dropped the accountId parameter from CfnResourceProvisioner.delete() since this branch was originally authored; the provisioner never used accountId in its body, so the fix is a straight signature match with no behavior change. * docs(cloudtrail): regen action table and register CFN Trail resource type New ListTrails/AddTags/ListTags actions and the CloudFormation AWS::CloudTrail::Trail resource type need doc entries per the repo's docs-check gate. * fix(cloudtrail): enforce AddTags 200-tag list limit Botocore's AddTagsRequest.TagsList models a 200-item max (service-2.json, cloudtrail 2013-11-01); the handler accepted an unbounded list. RED test added first (addTagsRejectsMoreThanTwoHundredTags), confirmed failing (200 instead of 400), then fixed by rejecting oversized lists with TagsLimitExceededException, matching AWS's modeled error for AddTags. * fix(cloudformation): close two audit-control gaps in CloudTrailCfnProvisioner Local code review flagged two HIGH findings in the new CFN provisioner: - physicalId was only set after selector validation and startLogging succeeded, so a create that failed on the mutually-exclusive EventSelectors/AdvancedEventSelectors check left a real trail with no recorded physical id for the engine to clean up. Now set immediately after createTrail returns. - update only called startLogging when IsLogging was explicitly true, never stopLogging when it was explicitly false, so a template setting IsLogging: false on a currently-logging trail silently left logging enabled. RED tests confirmed both failures against the pre-fix code, then GREEN after the fix (6/6 provisioner tests, 51/51 CloudTrail suite). * docs(issues): ledger deferred CloudTrail local-review findings MEDIUM/LOW findings from the local code-review pass, plus a few inherited-not-ours items on code this branch didn't touch, that are real but out of scope for the CFN provisioner / advanced-selectors PR. * style(cloudtrail): brace unbraced conditionals in ListTrails and event-matching traversal Per AGENTS.md style rule (always use braces in conditionals). * fix(cloudtrail): avoid NPE on List.of(trailName) when TrailName is missing PutEventSelectors/GetEventSelectors called List.of(trailName) with a possibly-null trailName before findTrailOrThrow could validate it, throwing an NPE (500 InternalFailure) instead of the modeled TrailNotFoundException. Guard the lookup so the null flows through to the existing validation. * fix(cloudtrail): do not re-queue records on self-delivery emission failure flushTrail wrapped the self-delivery emitS3DataEvent call in the same try/catch as the S3 write. A failure there re-queued records that were already durably written, causing the next flush to redeliver the same batch. Split the write and the emission into separate try blocks so only a write failure triggers requeue. * docs(cloudformation): register AWS::CloudTrail::Trail in the resource-type inventory CfnResourceInventoryTest and the docs-sync resource-type table both derived from supported-resource-types.tsv, which never picked up CloudTrailCfnProvisioner's registration. * docs(issues): drop fork-local ledger files from the PR Per maintainer review, the issues/ ledger entries are fork-local tracking notes and are kept out of the upstream contribution. * fix(cloudformation): wire CloudTrailCfnProvisioner into CfnProvisionerFixture CfnProvisionerFixtureTest.everyProvisionerIsReachableThroughThePublicBuilderOrExplicitlyExempt failed because CloudTrailCfnProvisioner had no field, setter, or construction arm in the test fixture, so a test naming CloudTrailService would silently fall through to the stub arm instead of exercising the real provisioner. Add cloudTrailService field, cloudTrail(CloudTrailService) setter, and the discovered.add(new CloudTrailCfnProvisioner(...)) construction arm, mirroring the existing Route53Service wiring. * fix(cloudtrail): drop em-dashes from new test comments per AGENTS.md style check * fix(cloudtrail): reject mixed basic and advanced selectors with InvalidEventSelectorsException PutEventSelectors does not model InvalidParameterCombinationException; the error it declares for an invalid selector combination is InvalidEventSelectorsException (botocore cloudtrail/2013-11-01). Both the JSON handler and the AWS::CloudTrail::Trail provisioner now throw that code, and the integration test pins it. Also braces the remaining one-line conditionals in matchesAdvancedFieldSelector. |
||
|
|
c1e5cc239f |
fix(mq): match CreateBroker EngineType and DeploymentMode without regard to case (#3268)
* fix(mq): match CreateBroker EngineType without regard to case
CreateBroker compared EngineType with equals() against "RABBITMQ", so "RabbitMQ" --
the spelling AWS uses everywhere outside the enum itself -- was refused:
BadRequestException: Only RABBITMQ EngineType is supported
The API reference gives the EngineType enum as ACTIVEMQ | RABBITMQ, but that is not
the form callers write. The Amazon MQ console, the developer guide and the
aws_mq_broker registry example all use "RabbitMQ" and "ActiveMQ", and SDK clients
transmit the caller's string verbatim rather than normalising it. A broker declared
the documented way therefore never reached the emulator's happy path.
Match case-insensitively and keep storing the canonical uppercase form, so
DescribeBroker still reports RABBITMQ however the request spelled it.
Also name the offending engine in the rejection message. The old text was reused for
ActiveMQ, which is a real capability gap rather than a malformed request, leaving
the two indistinguishable: someone who wrote "RabbitMQ" and someone who asked for
ActiveMQ got the same sentence.
References:
- EngineType enum and the CreateBroker input model --
https://docs.aws.amazon.com/amazon-mq/latest/api-reference/brokers.html
- The developer guide and console consistently write RabbitMQ / ActiveMQ --
https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/rabbitmq-basic-elements-broker.html
Worth a maintainer's eye: I have confirmed that clients send the mixed-case string
and that real-world Terraform modules are written that way, but I could not verify
against real AWS whether it accepts "RabbitMQ" or normalises it somewhere earlier in
the stack. If AWS is in fact strict here, the more faithful fix would be to keep
rejecting it and let the caller correct the spelling -- though that would break every
module written to the published examples.
* fix(mq): match CreateBroker DeploymentMode without regard to case
The EngineType fix (fix/mq-enginetype-case-insensitive) left the DeploymentMode
compare next to it on String.equals against the upper-case wire enum, so
`deployment_mode = "single_instance"` -- naming the one mode this emulator does
support -- came back as "Only SINGLE_INSTANCE DeploymentMode is supported".
Same defect, same line of reasoning, one guard away.
Both members are now matched with equalsIgnoreCase, and the canonical wire casing
is stored rather than the caller's so DescribeBroker reads back the enum value the
SDKs expect however the request happened to be spelled.
Consolidation note: this is the DeploymentMode half of cabe5ccc on
fix/messaging-terratest. That commit's EngineType and MSK serverProperties halves
were already carried by 2eb27421 and 3d167252 respectively, so only this remained.
|
||
|
|
27d2de0479 |
docs(lambda): say blank LogGroup is deliberately read as not supplied (#3271)
* docs(lambda): say blank LogGroup is deliberately read as not supplied LogGroup carries a 1-512 length constraint, so an empty string is a length violation on paper, yet validateLogGroup exempts blank and applyLoggingConfig then falls back to the /aws/lambda/ default. That looked like the guard missing the minimum. It is a choice, not an oversight. botocore enforces the 1-character minimum client side, so an empty LogGroup never reaches the wire from an SDK caller and nobody has observed what the service answers to one. A 400 here would be inferred rather than measured, and rejecting a request we have never seen AWS reject is the expensive side of the trade; accepting it costs a caller nothing. Say that in the javadoc, and pin the leniency with a test so a later reader who wants the minimum enforced has to change the decision rather than just the guard. * test(lambda): pin the whitespace-only LogGroup case, not just the empty one The javadoc says blank means "empty or whitespace-only" and the guard is isBlank(), but the only test passed "". Narrowing isBlank() to isEmpty() left the suite green, so half the documented contract was unpinned. Adds the whitespace-only case. Verified load-bearing: with isEmpty() in place of isBlank() this test alone fails, and nothing else does. |
||
|
|
b6080ea4ff |
fix(cloudcontrol): scope resources by caller account (#3244)
* fix(cloudcontrol): scope resources by caller account * fix(cloudcontrol): register persisted models for reflection * fix(cloudcontrol): make persisted recovery idempotent * fix(cloudcontrol): preserve request order across restart |
||
|
|
8bc4891a9a |
fix(ec2): report NotFound for launch templates requested by name (#3246)
* fix(ec2): report NotFound for launch templates requested by name DescribeLaunchTemplates filtered the launch-template collection and returned whatever matched, so an explicitly requested LaunchTemplateName that does not exist came back as an empty success. Karpenter creates a missing launch template only when the lookup fails with InvalidLaunchTemplateName.NotFoundException, so the empty list read as "already there" and left EC2NodeClass validation stuck at launch-template-count=0. An explicit name or id is now checked against the region's templates before filtering, mirroring DescribeKeyPairs. Unqualified listings and filter queries that match nothing still return an empty list. The lenient scan stays available as matchingLaunchTemplates for the callers that treat "absent" as an answer: DescribeLaunchTemplateVersions feeds AutoScaling's own ValidationError for an unresolved template, and the reconciler must not abort a pass over a group whose template was deleted. Fixes #3234 * fix(autoscaling): only treat NotFound as a deleted launch template The reconciler's launch-template lookup caught every AwsException and returned null, so any other failure from DescribeLaunchTemplates would have read as "the template is gone" and silently skipped the group's scaling instead of surfacing. Only InvalidLaunchTemplateName.NotFoundException and InvalidLaunchTemplateId.NotFound mean the template is absent; anything else now propagates, which reconcileAll already logs per group. * fix(ec2): use InvalidLaunchTemplateId.NotFound on the mutating paths DescribeLaunchTemplates reports a missing explicit id as InvalidLaunchTemplateId.NotFound, while findLaunchTemplate — the lookup behind ModifyLaunchTemplate, DeleteLaunchTemplate, CreateLaunchTemplateVersion and resolveLaunchTemplateData — spelled the identical condition InvalidLaunchTemplateId.NotFoundException, so the two disagreed on the wire code for the same missing template. EC2 has no Exception suffix on the id code, only on the name one; that asymmetry is now noted where it is easy to "correct" by mistake. |
||
|
|
172765a808 |
fix(secretsmanager): serialize secret version updates with the rotation lock (#3247)
* fix(secretsmanager): serialize secret version updates with the rotation lock PutSecretValue and UpdateSecretVersionStage rewrote a secret's version stages without the per-secret lock that RotateSecret's "a previous rotation isn't complete" guard reads under, so a rotation Lambda writing its AWSPENDING version could leave that staging label momentarily unassigned. A RotateSecret call landing in that window started a second rotation over a live one. Both operations now take that lock, and PutSecretValue no longer strips a staging label off the version it is about to replace under the same version id, so the label stays attached for readers that do not take the lock. * fix(secretsmanager): lock the non-immediate rotation lifecycle and name the staging label in two errors RotateSecret with RotateImmediately=false retires AWSPENDING from its background thread, and that read-modify-write ran outside the per-secret lock the other staging-label updates now take, so a concurrent PutSecretValue could still interleave with it. UpdateSecretVersionStage's two RemoveFromVersionId errors formatted the staging-label placeholder with the SecretVersion holding the label, printing its identity instead of the label the sentence names. The strings themselves were not re-probed against AWS. * fix(secretsmanager): keep the version id in the RemoveFromVersionId mismatch error The mismatch error names the staging label in its first placeholder, so only that argument was wrong. Its second placeholder keeps the id of the version that currently holds the label, which is the part a caller needs to correct the request. The wording itself still wants an AWS probe. |
||
|
|
379910b008 |
fix(iam): use AWS-managed policy documents (#3237)
* fix(iam): use AWS-managed policy documents * fix(iam): include managed policy documents in native images |
||
|
|
8a122d2b8c |
feat(firehose): validate and persist DataFormatConversionConfiguration (#3236)
* feat(firehose): validate and persist DataFormatConversionConfiguration Accept, validate, store, and echo the extended S3 destination's DataFormatConversionConfiguration instead of silently ignoring it. Validation messages and precedence follow probed AWS behavior: Smithy ParquetSerDe bounds first, then compression, buffering floor, and member checks in AWS order, identical on CreateDeliveryStream and UpdateDestination, which now merges the configuration member-wise and validates the merged effective state. OrcSerDe is rejected as a documented deviation (the planned DuckDB engine cannot write ORC). Conversion itself is not applied yet: delivery logs a warning and ships records unconverted. * docs(firehose): match the conversion helpers' wording to what they do The legacy-shape helper clears DataFormatConversionConfiguration alone, not every extended-only member, and the create/update warning fires on each call that leaves conversion enabled rather than once. Rename the first and reword both so the contract a reader infers is the one the code keeps. |
||
|
|
af42564cb3 |
feat(lambda): provision AWS::Lambda::EventInvokeConfig (#3230)
* feat(lambda): provision AWS::Lambda::EventInvokeConfig The physical id is the registry schema's composite FunctionName|Qualifier identifier. A create puts the configuration, an update with the same identity applies the template's settings through the merge-style update call, and a changed function or qualifier is a replacement whose displaced configuration the ReplacementCleanup record deletes once the update commits or restores on rollback. The schema's MaximumRetryAttempts and MaximumEventAgeInSeconds bounds are checked before any call, as CloudFormation validates them before the handler runs. The Lambda docs now list the five event invoke config operations, which the page wrongly called not implemented, and say that asynchronous invocations do not yet apply the settings. * fix(lambda): update the event invoke config in place for equivalent names and roll back in-place changes A short name and the function's ARN address one configuration, so an update that changes between them updates in place under the prior physical id instead of recording a replacement whose cleanup would delete that one configuration. An in-place update keeps the settings it replaces on the resource, and a failed stack update puts them back in full. DestinationConfig is resolved before it is looked at, so a conditional that resolves to AWS::NoValue is omitted rather than sent as an empty destination set. The integration test reads stack events with XmlParser. * fix(lambda): keep the event invoke config rollback snapshot until the restore succeeds A restore that throws left no snapshot behind, so the next rollback attempt reported success without restoring anything. The snapshot is now spent only after the settings are back. |
||
|
|
d9cddc56cb |
fix(s3): honor per-object VersionId in batch DeleteObjects (#3232)
* fix(s3): honor per-object VersionId in batch DeleteObjects DeleteObjects parsed request bodies with a flat extractAll(xml, "Key"), discarding every <VersionId> before it reached S3Service. The batch path then always called the 2-arg deleteObject(bucket, key), the no-version-specified overload — so on a versioned bucket every batch delete placed a new delete marker instead of removing the version named, even when the request pointed at a specific version or a delete marker's own version id. Repeated list-then-batch-delete cycles accumulate delete markers without bound and slow down ListObjectVersions. XmlParser gains extractDeleteObjectEntries, which pairs each <Key> with the VersionId from the same <Object> block (absent VersionId -> null). S3Controller.handleDeleteObjects and S3Service.deleteObjects now carry that pairing through authorization and into the existing, already-correct 3-arg deleteObject(bucket, key, versionId) - the same code path #1045 fixed for the single-object DeleteObject API. That fix only touched the single-object path; the batch path never reached it, which is the gap this closes. * fix(s3): authorize and report explicit-version batch deletes correctly The batch DeleteObjects path introduced in the previous commit carried each entry's VersionId through to deleteObject, but two spots still treated every entry as an unversioned delete: - handleDeleteObjects authorized every entry as s3:DeleteObject, even one naming an explicit VersionId. A bucket policy granting ordinary deletion but not s3:DeleteObjectVersion therefore let an unsigned caller permanently remove a retained version through the batch API, though the equivalent single-object DELETE (authorizeDeleteObject) already denies it. The batch loop now calls that same authorizeDeleteObject(bucket, key, versionId, authorization) helper instead of hardcoding the action, so both paths enforce identically. - The <Deleted> entries in the response never serialized VersionId, so a successful explicit-version delete returned no version id to the caller even though S3Service.DeleteResult already carried it. handleDeleteObjects now emits <VersionId> when present. Adds batchDeleteObjectsPolicyGrantDoesNotAuthorizeVersionedDelete, mirroring deleteObjectPolicyGrantDoesNotAuthorizeVersionedDelete for the batch endpoint, and extends S3DeleteObjectsIntegrationTest to assert the response VersionId on explicit-version deletes and its absence on plain key deletes. * docs(core): remove em dash from extractDeleteObjectEntries javadoc Replace the em dash in XmlParser.extractDeleteObjectEntries's javadoc with a period, per the repository's prohibited-em-dash directive. |
||
|
|
ebd849a956 |
fix(lambda): serialise the version snapshot against function updates (#3010)
publishVersion copies roughly thirty fields off the live LambdaFunction inside synchronized (lockForConcurrencyOp(...)), but neither updater took that lock, so nothing was serialised. An update landing mid-copy produced a snapshot that was part old code and part new configuration, carrying a sourceRevisionId that identified neither state. #2939 made extractZipCodeBytes publish the code identity fields under the lock, which closed the CodeSha256 precondition hole specifically. The rest of the snapshot copy stayed unprotected, and updateFunctionConfiguration never took the lock at all. Both updaters now take the same per-function lock. Their bodies move unchanged into private *Locked methods behind a thin wrapper, so the change is a small number of production lines rather than a few hundred lines of reindentation. The monitor is one object per function ARN and synchronized is reentrant, so the nested acquisitions inside extractZipCodeBytes, and publishVersion's own when updateFunctionCode is called with Publish, are no-ops rather than a second lock. Every existing acquisition is keyed to a single function, so there is no cross-ARN ordering to invert. Zip extraction now runs inside the lock. extractZipCodeBytes called extractTo outside it and took the lock only to publish the code fields afterwards, so a deploy could rewrite $LATEST's code directory while publishVersion held the lock copying that directory into a version's own (#3041). Serialising the whole updater closes that too. UpdateFunctionConfiguration's structure members stay shape-checked ahead of the function lookup, where #3051 put them, so a malformed member on a function that does not exist still reports SerializationException rather than 404. The locked body re-reads them; structureMember is pure, so the second read cannot fail once the first has passed. That ordering was not pinned by any test, and now is. This also corrects a comment from #2939 claiming the hash check ran "inside the lock UpdateFunctionCode takes". UpdateFunctionCode did not take a lock. Closes #3007 |