mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
6fa53abd7cd9db183addee8d0bd2a80c38449e20
324
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a2389e7733 |
fix(ecs): round-trip runtimePlatform and logConfiguration on task definitions (#2443)
RegisterTaskDefinition parsed a fixed field list and dropped everything else, so a task definition registered with a runtimePlatform or a container logConfiguration came back from DescribeTaskDefinition without them. A client that verifies its own write — Terraform, or a deploy tool comparing the registered revision against desired state — saw drift that was not there. Both are now parsed, stored on the task definition, and serialized back with the AWS wire shape. A request that omits them still produces a response without the keys, so nothing changes for existing callers. The two fields are set on the task definition returned by EcsService.registerTaskDefinition, following the pattern already used for task-level volumes. That mutation happens after the value was stored, so a backend that serializes on put (persistent, hybrid, WAL) had captured the pre-mutation value; the definition is now written back, which also makes the existing volumes round-trip survive a restart. |
||
|
|
353d9c842f |
feat(kinesis): add PutRecords request caps and a per-stream max record size (#2438)
PutRecords enforced only the per-record limit. AWS also caps a request at 500 records and 10 MiB including partition keys; both are now whole-request rejections with InvalidArgumentException, since per-record ErrorCode only carries throughput and internal failures. The count cap is checked upfront and the byte cap as the loop goes, so neither an over-long batch nor an oversized one is fully decoded before it is rejected. Undecodable or non-string Data counts toward the cap at the UTF-8 bytes the caller sent, so a batch of malformed records cannot slip past it. The per-record maximum becomes per-stream state defaulting to 1024 KiB, set by CreateStream's MaxRecordSizeInKiB or UpdateMaxRecordSize (1024-10240) and reported by DescribeStreamSummary. UpdateMaxRecordSize documents ValidationException for an out-of-range size. CreateStream doesn't, and reserves ValidationException for the on-demand case, so it answers InvalidArgumentException. Streams persisted before the field existed deserialize to the default. |
||
|
|
04d120fdd5 |
feat(fis): add AWS FIS support (#2435)
* feat(fis): add AWS FIS support * refactor: add typed FIS persistence models * ci(fis): retrigger timed-out build * fix(fis): reject trailing JSON request bodies |
||
|
|
470ec77711 |
feat(signin): support AWS login credentials provider (#2428)
* feat(signin): add AWS login credentials provider * fix(signin): initialize secure random at runtime * fix(signin): make refresh exchange idempotent * fix(signin): match AWS OAuth token contracts * refactor(signin): add typed token result model * fix(signin): align errors with AWS exception handling |
||
|
|
f45d64a00e |
feat(sns): deliver topic broadcasts to application-protocol platform endpoints (#1856)
* feat(sns): deliver topic broadcasts to application-protocol platform endpoints
Add an application-protocol case to deliverMessage so publishing to a
topic fans out to subscribed mobile push platform endpoints, matching
real SNS behavior. Thread messageStructure through the delivery boundary
so platform-specific payload keys (GCM/FCM/APNS) resolve per endpoint,
and factor the push-capture tail of publishToEndpoint into a shared
capturePushForEndpoint helper. Disabled endpoints are skipped in the
fan-out rather than failing the publish. Broadcast pushes surface in the
same retrospection API keyed by EndpointArn.
* fix(sns): validate MessageStructure synchronously before topic fan-out
Topic Publish with MessageStructure=json now validates that the message is
a JSON object with a top-level default entry up front, mirroring the real
SNS API. Previously a malformed envelope was only rejected lazily inside
per-subscriber delivery, where deliverMessage's catch swallowed the
InvalidParameter and logged a warning while publish still returned a
success messageId, so application subscribers silently received no push.
* fix(sns): validate MessageStructure per entry in PublishBatch
publish() validates a MessageStructure="json" envelope synchronously before
fan-out, but publishBatch() only threaded MessageStructure into deliverMessage.
A batch entry with a malformed or default-less envelope was therefore added to
Successful while deliverMessage's catch swallowed the resulting InvalidParameter,
dropping the push for every application subscriber.
Run the same validation per entry, reporting a bad envelope as that entry's
BatchResultErrorEntry (InvalidParameter, senderFault=true) instead of throwing,
so the rest of the batch still publishes as real PublishBatch does.
* fix(sns): resolve MessageStructure=json payload per protocol on fan-out
Under MessageStructure="json", only the application protocol consumed the
envelope: sqs, lambda, http/https, email, email-json and sms each delivered
the raw JSON structure. Real SNS resolves per-protocol for every subscriber,
picking the value under the protocol key and falling back to default.
deliverMessage now resolves the payload for each subscription through the
(renamed) resolveProtocolPayload, which already keyed off an arbitrary
string; application keeps resolving against the push platform inside
capturePushForEndpoint. validateTopicMessageStructure guarantees default
exists before fan-out, so the fallback cannot come up empty.
* fix(sns): ignore non-string MessageStructure=json keys, matching AWS
Under MessageStructure=json, real SNS ignores a protocol key whose value
is not a string ("Non-string values will cause the key to be ignored"),
falling back to default rather than stringifying it. resolveProtocolPayload
was calling protocolValue.toString(), so {"default":"hi","sqs":42} delivered
the literal "42" to an SQS subscriber instead of "hi".
Only textual values are now accepted for both the protocol key and the
default fallback; non-textual values fall through. validateTopicMessageStructure
is tightened to require a textual default so a non-string default is rejected
synchronously rather than throwing (and being swallowed) during fan-out.
Adds regression tests for a non-string protocol key falling back to default
and for rejection of a non-string default.
* chore: remove unnecessary file
|
||
|
|
f2ad05ce22 |
feat(cloudfront): forward origin custom headers (#1832)
* feat(cloudfront): serve distribution requests from S3 and custom origins * feat(cloudfront): forward origin custom headers * fix(cloudfront): omit Allow-Credentials and Vary for wildcard S3 CORS rules withS3CorsHeaders emitted Access-Control-Allow-Credentials: true for every matched rule, including one whose AllowedOrigin is "*" (where evaluateCors echoes "*"). The CORS specification forbids that pairing and browsers reject it for credentialed requests, so the emulator produced a response that fails in a browser while passing against Floci. Verified against real S3 rather than inferred. Bucket with AllowedOrigins ["*"]: Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET Access-Control-Max-Age: 3000 and with a concrete AllowedOrigin it additionally returns Access-Control-Allow-Credentials: true Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method Both preflight and actual GET behave identically. Vary is now also conditional: the wildcard response is byte-identical for every origin, so there is nothing to vary on, and real S3 omits it there too. * chore: re-run CI The Build and Test failure on the previous head was RuntimeApiServerTest's extension/stop race, a pre-existing flake unrelated to this change — it also failed on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it). Reproduced locally under `--cpus=1` and fixed separately. * fix(cloudfront): wildcard aliases match exactly one subdomain level wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the wildcard at that level only: "you can't add alternate domain names that are at levels higher or lower than the wildcard. For example, you can't add the alternate domain names example.com or marketing.product.example.com." https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html Practical effect: a distribution owning "*.example.com" would answer for a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to nobody. Require the label standing in for the wildcard to contain no dot. wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour (a.b.example.test resolving to the *.example.test distribution); it now asserts no match, plus the same for a deeper wildcard. * test(dynamodb): retain Quarkus port for cleanup * fix(cloudfront): isolate mocked storage backends * fix(ec2): wire managed prefix list storage in public IP test * fix(cloudfront): allow authorization origin custom headers * fix(cloudfront): preserve S3 preflight CORS headers |
||
|
|
520c0f4da2 |
feat(cloudfront): apply response-headers policies when serving (#1833)
* feat(cloudfront): serve distribution requests from S3 and custom origins * feat(cloudfront): add response headers policy support * chore: re-run CI The Build and Test failure on the previous head was RuntimeApiServerTest's extension/stop race, a pre-existing flake unrelated to this change — it also failed on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it). Reproduced locally under `--cpus=1` and fixed separately. * fix(cloudfront): wildcard aliases match exactly one subdomain level wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the wildcard at that level only: "you can't add alternate domain names that are at levels higher or lower than the wildcard. For example, you can't add the alternate domain names example.com or marketing.product.example.com." https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html Practical effect: a distribution owning "*.example.com" would answer for a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to nobody. Require the label standing in for the wildcard to contain no dot. wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour (a.b.example.test resolving to the *.example.test distribution); it now asserts no match, plus the same for a deeper wildcard. * test(dynamodb): retain Quarkus port for cleanup * fix(cloudfront): isolate mocked storage backends * fix: validate credentialed CloudFront CORS headers * fix: log ignored CloudFront policy parse errors * fix(ec2): wire managed prefix list storage in public IP test * fix(cloudfront): preserve custom CORS-like headers |
||
|
|
d778a6e393 |
feat(rds): model Aurora Serverless v2 scaling configuration on DB clusters (#1829)
* feat(rds): model Aurora Serverless v2 scaling configuration * test(dynamodb): retain Quarkus port for cleanup |
||
|
|
bc13801121 |
feat(lambda): support kubernetes as the lambda runner (#1941)
* feat(lambda): support kubernetes as the lambda runner * fix(lambda): keep the port reserved when a failed launch cannot confirm pod deletion * fix(lambda): carry the owning account in the layer Content.Location URL The URL is fetched unsigned. Without an X-Amz-Credential query the account filter falls back to the default account, so a layer published under another account resolves the wrong bucket namespace and 404s. Mirror the credential query the kubernetes executor already appends to its download URLs. * chore(build): raise the surefire heap to 6g The suite outgrew the 4g default heap of 16g CI runners. At OOM a full GC reclaims almost nothing, so the live set is real. The heap dump shows 192 surviving QuarkusClassLoader instances, each pinned test app keeping its own copy of the Jandex index. This PR widens the classpath with the kubernetes client, which made each pinned copy heavier and tipped CI over the edge. Verified locally that the full suite passes with 6g and fails with 4g. Unpinning the leaked classloaders remains follow-up work on main. |
||
|
|
bd8d99b757 |
fix: apply S3 Vectors metadata filters (#2417)
Fixes #2160 |
||
|
|
8a673fc580 |
feat(emrserverless): support EMR Serverless applications (#2403)
* feat(emrserverless): add EMR Serverless application management emulator This adds a full emulator for the EMR Serverless Application management plane, allowing tools like Terraform to provision and manage EmrServerless applications. Includes full CRUD operations, route collision handling, and integration tests. * fix(emrserverless): disambiguate local endpoint routing using SigV4 auth header * fix(emrserverless): resolve bot feedback on ARNs, idempotency, updates, and list controls * fix(emrserverless): resolve bot feedback on idempotency races and dropped update fields * fix(emrserverless): add jobLevelCostAllocationConfiguration to updates * fix(emrserverless): retain nested configuration fields using dynamic properties * fix(emrserverless): add required field validation and correct 404 status code * docs(emrserverless): document unsupported tagging APIs * fix(emrserverless): increase ListApplications maxResults limit to 100 * test(emrserverless): fix integration test assertions to align with required field validations and correct 404 status code * fix(emrserverless): revert ListApplications maxResults limit to 50 to match AWS limits * test(emrserverless): add validation tests for CreateApplication required fields |
||
|
|
7505110ed9 |
feat(msk): add configuration revision actions (#2344)
* fix(core): extract shared pagination helper, reject maxResults=0 Closes #2339, #2340. ListResult<T> and its paginate()/encode()/decode() helpers existed as five near-identical private copies (BedrockAgentCoreGatewayService, BedrockAgentCoreIdentityService, BedrockAgentCoreMemoryService, BedrockAgentCoreControlService's three list methods, and MskService), not the two originally scoped in #2340 - the ListResult<T> record was already shared within bedrockagentcorecontrol, which is what earlier scoping missed. Extracts core.common.Pagination + PaginatedResult<T> and migrates every one of them, deleting both now-unused per-service ListResult model classes. Every duplicate collapsed "maxResults omitted" and "maxResults=0" onto the same primitive int, defaulting both to the full page instead of rejecting the explicit zero the way AWS's MaxResults min:1 constraint requires (confirmed against botocore's real kafka and verified live: botocore itself refuses to send MaxResults=0 client-side). Pagination.paginate/parseMaxResults take a boxed Integer so the two cases are distinguishable, and every migrated service now rejects 0 with its own existing error code (ValidationException for the bedrockagentcorecontrol services, BadRequestException for MSK) - the fix lands once, not five times. Also carries over the MskController fix from #2336: an Integer-typed @QueryParam converts before the resource method runs, so a non-numeric maxResults was a bare 404 instead of an AWS-shaped 400. Every migrated REST controller now binds maxResults as a String and calls Pagination.parseMaxResults, closing the same gap in BedrockAgentCoreGatewayController/ControlController/MemoryController that MSK already had fixed. * feat(msk): add configuration revision actions Closes #2338. Adds UpdateConfiguration, ListConfigurationRevisions, and DescribeConfigurationRevision, the three actions #2299 explicitly scoped out ("a separate follow-up issue"). MskConfiguration now stores a full revision history (revisions + serverPropertiesByRevision keyed by revision number) instead of a single latest-revision field - UpdateConfiguration appends rather than overwrites, and DescribeConfigurationRevision is the only action that returns serverProperties (base64), matching AWS's real shapes: Configuration/ DescribeConfigurationResponse/CreateConfigurationResponse never include it, verified against botocore's kafka service model the same way as #2336/#2343 rather than trusting the docs page. ListConfigurationRevisions builds on the shared Pagination.paginate helper from #2343 (cursor = zero-padded revision number) instead of introducing a sixth duplicate of that logic. getLatestRevision() is now derived from the revision list rather than a separately-stored field, so it can never drift out of sync with it. * fix(msk): guard configuration schema upgrade and update-race in UpdateConfiguration Old (pre-revision-history) persisted configurations have latestRevision/ serverProperties keys this class no longer maps, which previously threw and failed the entire msk-configurations.json load; ignore them instead and reject updates against such an entry with a 400 rather than NPE-ing. Also serialize UpdateConfiguration's read-modify-write behind a lock so two concurrent updates for the same ARN can no longer derive the same revision number and silently overwrite each other's serverProperties. * fix(msk): stop leaking mutable revision state through getters MskConfiguration#getRevisions/getServerPropertiesByRevision returned the live internal List/Map, which is why MskService#updateConfiguration was mutating through them directly - and in an order (revision appended, then its properties inserted) that let an unsynchronized reader observe a revision with no server properties yet and NPE on Base64-encoding it. Add MskConfiguration#addRevision to own both writes in the safe order, and have the getters return copies so callers can no longer bypass it. * fix(msk): guard revision reads with the same lock updateConfiguration writes under listConfigurationRevisions/describeConfigurationRevision read revisions and serverPropertiesByRevision - plain, non-thread-safe collections - without holding configurationUpdateLock, so a concurrent updateConfiguration could race the reader's iteration/copy, not just return stale data. * fix(msk): close remaining unsynchronized-read races on configuration revisions Two more gaps in the same family as the last fix: - deleteConfiguration didn't take configurationUpdateLock, so it could race updateConfiguration and get resurrected by the update's trailing put(arn, ...) after the delete already removed the entry. - getLatestRevision() is read directly from MskController with no access to the service's lock at all, so no per-call-site synchronized block can close that gap. Make revisions/serverPropertiesByRevision CopyOnWriteArrayList/ConcurrentHashMap instead, so every current and future reader is safe by construction rather than by remembering to take a lock it may not have access to. * fix(msk): migrate pre-revision-history configurations onto revision 1 A configuration persisted before this PR's schema change stored a single "latestRevision" object plus a flat "serverProperties" string. Those keys were only being swallowed by ignoreUnknown, so the entry loaded with an empty revision list and getLatestRevision() == null. AWS marks Configuration's LatestRevision required, and toConfigurationView builds into a HashMap - which keeps a key with a null value, unlike Map.of - with no NON_NULL inclusion configured anywhere in the application. So DescribeConfiguration and ListConfigurations emitted a required member as an explicit "latestRevision": null for those entries, and UpdateConfiguration rejected them permanently. Map both old keys back onto revision 1 at load time instead. The data was always still there, so this is a migration rather than a degradation, and it un-breaks UpdateConfiguration for those configurations as well. - The setters are deserialize-only: @JsonSetter is an explicit marker, so it survives the @JsonIgnore split on getLatestRevision() without re-enabling the write side. The old shape is read, never written back. - Jackson calls the two setters in whatever order the keys sit in the file, so neither can assemble the revision alone; each buffers its half and the pair completes the migration. - A legacy entry with no serverProperties migrates to an empty string, not null: serverPropertiesByRevision is a ConcurrentHashMap, which rejects null values, and DescribeConfigurationRevision base64-encodes what it finds without a null check. - The updateConfiguration guard stays, now covering only an entry with no revision data at all rather than every pre-schema configuration. Also corrects the comment in listConfigurationRevisions, which still justified its lock by calling the collections plain and non-concurrent. That was true when it was written but stopped being true in 93bc30e7; the lock is kept, for consistency with describeConfigurationRevision reading both collections, not to prevent a torn read. Verified locally: MskServiceTest 34, MskControllerTest 2, MskControllerIntegrationTest 20 - 0 failures, 0 errors. Reverting only the MskConfiguration change fails 6 of the new tests, confirming they bite. |
||
|
|
7b83bd5283 |
feat(rds,docdb): tag DocumentDB clusters and parameter groups (#2408)
* fix(rds): tag DB and DB cluster parameter groups The tag resolver handled db, cluster, subgrp, db-proxy and og, so tagging a parameter group answered that Floci does not implement the type — a live account tags both, and the terraform provider reads a group's tags as part of its read. DocumentDB's cluster parameter groups are these records too, so the same read fails for aws_docdb_cluster_parameter_group. Neither model carried tags, and neither carried the ARN a caller tags by: the create response omitted it, leaving nothing to address the group with. Both are stored and reported now, and tags given at create are kept, as a live account keeps them. * feat(docdb): tag clusters and instances aws_docdb_cluster reads a cluster's tags as part of every read, so a cluster that created fine failed its apply on DBClusterNotFoundFault — created, but not readable. DocumentDB signs with the rds credential scope, and on that scope it is told apart by Engine or a cluster/instance identifier. The tag actions carry neither, only the ARN of the resource they address, so they reached the RDS handler, which does not hold DocumentDB's records. The router reads that ARN now, and an ARN naming something DocumentDB does not have still goes to RDS. Clusters and instances store tags, keep the ones given at create, and answer the three tag actions. Behaviour follows a live account: an existing key is overwritten, removing a key that is not present is not an error, and an ARN in another region or account is rejected with the one message AWS gives for both — storage is keyed by identifier alone, so without that check an ARN naming another region would be answered with this caller's cluster. A tag update is a read-modify-write, so it takes the record's monitor and the other writers take the same one; otherwise tagging a cluster while it is being deleted stores it again. Paths that hold both take the instance's monitor before the cluster's. Filters on ListTagsForResource are accepted without validation: a live account rejects an unrecognised name, but Floci carries no list of the ones it accepts, and the tags of one named resource are the same answer either way. * fix(rds,docdb): store an empty value for a tag given without one A tag whose Key arrived without a Value was stored with a null, and the read hands the tags back as an immutable copy, which rejects nulls — so one such tag made every subsequent read of that resource fail with an internal error, not just the tag that caused it. A live account stores an empty value and reads it back. Both handlers parse tags the same way and both had it. * fix(rds,docdb): match the whole ARN when routing tags, and give legacy groups one Two things reported on review. Routing read the trailing name of the ResourceName ARN and looked it up in DocumentDB storage, but RDS and DocumentDB share one ARN space: an RDS resource whose name a DocumentDB record happens to share was answered — and mutated — out of the wrong store, and an RDS parameter group or option group could be resolved as a cluster. The whole stored ARN is matched now, which settles region, account, type and name at once, as the db-cluster-id filter already does. And only creation assigned a parameter group's ARN, so a group persisted by an earlier version read back without one, leaving describe with no ARN to report and the caller nothing to tag by. The read that backfills a missing region backfills the ARN too. The service keeps rejecting an ARN from another region or account: the router no longer sends it one, but the check guards its own contract, and it is covered directly rather than through the endpoint. * fix(rds,docdb): keep one identifier space across the RDS family Matching the whole ARN still left one ambiguity: an RDS cluster and a DocumentDB cluster of the same name in the same account and region produce the same ARN, and a tag call naming it could only reach one of them. A live account settles it — creating an Aurora cluster named like an existing DocumentDB one is refused with DBClusterAlreadyExistsFault, because the RDS family shares one identifier space. Floci already refused that direction, since a create naming an identifier DocumentDB holds is routed to DocumentDB, which answers AlreadyExists; the other direction was open, so a docdb create could take a name RDS already had. A create naming an identifier RDS holds now goes to RDS whatever engine it names, so it answers AlreadyExists too and the two stores cannot both hold one identifier — which is what makes an ARN unambiguous. * fix(rds,docdb): report a persisted identifier held by both services Creates can no longer put one identifier in both stores, but state written before that can, and a restart loads it. For such a record the identifier checks in the router already send every action to DocumentDB — describe, modify and delete included — and have long before tags existed, so tags answer from there too: one identifier keeps one answer, rather than a tag call reaching a record no describe can show. The collision is logged once per ARN, since the RDS record behind it cannot be reached on this scope at all and only deleting one of the two records fixes it. * fix(docdb): build cluster and instance ARNs from the caller's region The ARN was built from the configured default region, so a caller signing for anywhere else got back an ARN naming somewhere they were not — and since a tag call is checked against the region it is made from, that caller could not tag the cluster the create had just answered with. It also reopened the identifier collision from the other side: the create-time check looked for an RDS record in the request region while the ARN landed in the default one, so signing the create for another region got past the check and produced two records under one ARN. DocumentDB keys records by bare identifier, so the check now covers every region — narrower than AWS, which allows one name per region, but Floci cannot hold both and answer either correctly. The check also asked about the wrong identifier for instances: CreateDBInstance names its parent cluster, and that cluster existing in RDS is the normal case, not a clash. Only the identifier being created is checked, and the clash is answered with AlreadyExists directly rather than by handing the create to a service that rejects the engine first. * fix(rds): scope the create-time identifier check to the request's region Widening it to every region broke what RDS actually does: names are scoped by region, so the same instance name in two regions is two resources, and RdsControlPlaneTest.sdkScopesTheSameDbInstanceNameBySignedRegion pins exactly that. The second create answered DBInstanceAlreadyExists. The cross-region case that widening was meant to cover is closed by the ARNs instead: each carries the region it was created in, so two records of one name in different regions never share an ARN and no tag call has to choose between them. What must not exist is one identifier in both services in one region, and that is what the check now asks about. * fix(docdb): decide ownership of an identifier per region The routing checks asked whether DocumentDB holds an identifier at all, and its records are keyed by identifier alone, so a name DocumentDB held in one region was taken away from RDS in every other one: the create was refused as already existing, and a describe, modify or delete answered from the wrong region's record. The region now comes from the one place a record carries it — the ARN — so DocumentDB claims an identifier only in the region it was created in. Records written before ARNs carried the caller's region read as the configured default, which is the region they were in fact created under. This was true before tags existed; it becomes reachable in a way worth fixing now that a create in another region records that region rather than the default. * fix(docdb): check the identifier on every route into DocumentDB The create-time check lived in the rds credential scope's branch, but DocumentDB is reachable under its own scope too, and that one dispatches straight to its handler — which knows only its own store. A create signed that way could take an identifier RDS already held in the region, which is the state the ARN matching relies on being impossible. The check is one method now, called from both routes. Neptune shares the same identifier space and its scope is not checked either; that is untouched here, since this PR's invariant is about the ARN a tag call resolves and Neptune holds no tags. * fix(docdb): resolve a tag ARN to the record it names, not to the identifier resolveTagTarget checked the ARN's region against the caller's and then loaded the record by identifier, and records are keyed by identifier alone — so an ARN whose region matched the request but named a record stored in another region resolved to that other record, and tagged it. Reachable on the docdb credential scope, which dispatches to this service directly rather than through the routing that matches the whole ARN. The stored ARN is now compared with the one asked for, and anything else is not found. |
||
|
|
06d58aad36 |
feat(elasticache): support cache subnet groups (#2401)
* feat(elasticache): support cache subnet groups CreateCacheSubnetGroup was unsupported, so aws_elasticache_subnet_group could not be created and no Redis or Valkey module placing a cluster in a VPC could apply. DescribeCacheSubnetGroups already answered with an empty list, so the read half existed with nothing behind it. Adds Create, Modify and Delete, and makes the describe return what was created. A group's VpcId and each subnet's availability zone come from the subnets rather than the request, because that is where AWS reads them: resolving the subnets against EC2 is part of answering, not an optional check. The service follows the RDS DB subnet group, which faces the same problem. Taken from a live account: the create response and its ARN, SupportedNetworkTypes on both the group and each subnet, and the error for each rejection — subnets that do not exist, subnets spanning two VPCs, a duplicate group, and a name that breaks the identifier rule. Describe and delete word their not-found differently from one another, and both are reproduced as AWS words them. Tags given at create are stored and readable through ListTagsForResource, rather than accepted and dropped. A modify naming no subnets keeps the stored ones as they are instead of resolving them again, which would fail a description-only change if a subnet had since been deleted. * fix(elasticache): resolve subnet group subnets in the caller's region CreateCacheSubnetGroup and a subnet-changing ModifyCacheSubnetGroup looked the subnet ids up in the configured default region. A caller in any other region had its own subnets rejected as invalid, and the group was reported under an ARN built from the caller's region while its VPC and availability zones came from somewhere else. Resolve against the request's region, which is the region the ARN already uses. * fix(elasticache): report a subnet group's subnets in the order they were given describeSubnets answers in the subnet store's own scan order, and the group was built by iterating that answer, so the order a group reported its subnets in was arbitrary between calls — the model documents the order the caller gave. Build the zone map from the requested ids. Adds a CLI case covering the region the subnets are resolved in, which is what caught this: it read Subnets[0] and disagreed with itself between runs. * fix(elasticache): answer a missing cache subnet group with 400, not 404 The service model declares CacheSubnetGroupNotFoundFault a 400, where the parameter-group fault a few hundred lines up is a 404 — the two really differ, in the wire code as well as the status, and the status was carried across from the parameter-group code. All three sites answered 404, and the integration test pinned it there, so a client reading the status saw the wrong one. The difference is now stated where the copy would be made, since either fault looks like a mistake beside the other. |
||
|
|
bba5ffb644 |
feat(firehose): honor CompressionFormat and FileExtension on S3 delivery (#2410)
Firehose accepted CompressionFormat on the control plane and echoed it back on DescribeDeliveryStream, but the delivery path never read it: every delivered object held the raw record bytes, with no compression extension in the key and no Content-Encoding. The divergence was silent, since only a consumer reading the delivered objects (Athena over .gz, Spark reading Snappy, anything that decompresses by extension or encoding) ever saw the wrong bytes. Deliveries are now compressed the way real AWS compresses them: UNCOMPRESSED (no extension) (no Content-Encoding) GZIP .gz gzip ZIP .zip zip single deflated entry, UUID name Snappy .snappy snappy-java xerial stream format HADOOP_SNAPPY .snappy hadoop-snappy Hadoop block framing Snappy is the xerial snappy-java stream format, not the official Snappy framing format, so a consumer must use snappy-java's own reader; HADOOP_SNAPPY is the block framing Hadoop and Spark consumers read. Both are reproduced byte for byte against real AWS. HADOOP_SNAPPY deliberately carries .snappy rather than the .hsnappy the S3 object name documentation tables: the service delivers .snappy, reproduced on two separate dates, and only Content-Encoding tells the two variants apart. Content-Type is now application/octet-stream for every format, including UNCOMPRESSED, matching AWS instead of the previous application/x-ndjson. Buffered records are concatenated as bytes rather than through a String. Record payloads are arbitrary bytes, and compression makes the corruption of anything that is not valid UTF-8 observable. FileExtension is implemented alongside it, since it governs the same part of the key: it replaces the extension the compression format contributes instead of being appended to it, the empty string means "not specified", and it changes only the key, never the body or its Content-Encoding. Building the extension into the key belongs to S3ObjectKeyResolver, which already owns the key format, so the resolver now takes the destination and resolves prefix, time zone and extension together. Both members are validated, with the code and message shape captured from real AWS's raw HTTP responses rather than from an SDK's rendering of them. Unsupported values answer ValidationException naming the shape that carried them, so the same bad value reports extendedS3DestinationConfiguration.compressionFormat, s3DestinationConfiguration.compressionFormat or extendedS3DestinationUpdate.compressionFormat, which is why the wire-shape check runs from the handler. snappy-java becomes a direct dependency: it is the only Java library that writes the xerial stream format, it already shipped as a runtime-scope transitive of kafka-clients, and its version comes from the Quarkus BOM. For the GraalVM native image the loader needs run-time initialization; left to build-time initialization the image still builds and then dies with UnsatisfiedLinkError on the first compression. Snappy and SnappyLoader are the only classes on the compression path with a static initializer, which jdeps and a set of Mandrel 25.0.4 builds confirm is the whole requirement. Two deviations from AWS are documented rather than changed, both newly verified while testing this: Floci appends a newline after records that lack one where AWS inserts no separator at all, and Floci accepts streams with no destination configuration where AWS requires exactly one complete destination. Closes #2328 Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com> |
||
|
|
29b0d600c6 |
feat(rds,docdb): answer DescribeGlobalClusters (#2402)
* feat(rds,docdb): answer DescribeGlobalClusters aws_docdb_cluster reads global cluster information as part of every cluster read, so a cluster that created successfully failed its apply on UnsupportedOperation — created, but not readable. DocumentDB's signing name is rds and the action carries no engine or cluster identifier to route on, so the request reaches RdsQueryHandler whichever service the caller has in mind; the docdb scope Floci also accepts is answered the same way. Global clusters are not modelled, so the list is empty, which is what a live account with none answers. Behaviour follows a live account: MaxRecords outside 20-100 is rejected before the identifier is looked up, a named identifier that does not exist is GlobalClusterNotFoundFault, and a marker is rejected after the identifier. The response is in the RDS namespace, which is the namespace DocumentDB answers in. Filters are accepted without validation: every name AWS accepts answers empty here, and a partial list of accepted names would refuse filters a live account allows. * fix(rds): infer rds for DescribeGlobalClusters on unsigned requests Without a credential scope the service is inferred from the action name, and an action the RDS handler serves but the inference list does not name is dispatched to SQS, which answers UnsupportedOperation for it. * fix(rds): infer rds for every action the RDS handler serves The inference list that routes unsigned Query requests named 32 of the 43 actions RdsQueryHandler dispatches. The other eleven — the cluster parameter groups, the option groups, and both snapshot describes — were dispatched to SQS, which answers UnsupportedOperation for them. The two sets now match exactly: every dispatched action is inferable, and nothing inferable is undispatched. None of the added names appear in another service's inference list, so no existing routing changes. |
||
|
|
6b628179f3 |
feat(elasticache): support cache parameter groups (#2392)
* feat(elasticache): support cache parameter groups CreateCacheParameterGroup was unsupported, so a Redis module that sets any parameter could not apply at all — most set at least maxmemory-policy. The describe was a stub that answered with an empty list whatever was asked of it. Adds the group surface over the Query protocol: - CreateCacheParameterGroup, DescribeCacheParameterGroups, ModifyCacheParameterGroup, DescribeCacheParameters, DeleteCacheParameterGroup - ListTagsForResource for a parameter group ARN, without which the tags a create carries would be stored and never readable - the default.* groups AWS publishes for all 13 families, derived rather than stored: nothing can modify or delete them, so persisting them would only add records to migrate and a writer to race Taken from a live account: the create response and its ARN, IsGlobal, and the error each rejection carries — CacheParameterGroupAlreadyExists for a duplicate, CacheParameterGroupNotFound for an unknown group, and the identifier rule that rejects a name containing a dot, which is also how AWS refuses to delete a default group. Each writer takes one monitor keyed by the group name before it reads. Guarding the record cannot serve a create, which has no record yet, so two of them would both pass the existence check; and a modify that resolved its record before locking would write back a group a concurrent delete had removed. floci does not carry AWS's per-family catalogue of parameter names, so it stores what a caller sets and reports it with source "user". Rejecting names missing from a partial catalogue would refuse configurations AWS accepts, so nothing is rejected on that basis, and a request for system parameters returns none rather than reporting user parameters under another source. * fix(elasticache): answer tags for the ARN that was asked about ListTagsForResource read the trailing name out of the ARN and ignored the rest, so an ARN naming another account or region was answered with this caller's group of the same name — a response describing a different resource than the request identified. The ARN is now checked before it is used, with the errors AWS gives for each: InvalidARN for a string that is not seven components, "Unauthorized call. Please check the region or customer id" for another region, "The resource ARN does not belong to the caller's account." for another account, and "<name> is not present" for a group that does not exist, which is worded differently from the describe's not-found. Tightening the tolerated exception in the race test, as review asked, turned up a second problem: a modify whose group had been deleted reported "is a default group and cannot be modified", because absence from the store was read as proof of a published default. The two are now told apart, and both errors are asserted directly rather than only when the race happens to expose them. * fix(elasticache): check every component of a tag ARN, not only region and account An ARN in another service's namespace was accepted as long as its region and account matched, so arn:aws:rds:<region>:<account>:parametergroup:<name> was answered with the ElastiCache group of that name — tags for a resource the caller did not ask about. The partition and service are checked too, with the errors AWS gives: "partition field is wrong. Expected value is aws" and "service field is wrong. Expected value is elasticache". * fix(elasticache): word each parameter group not-found the way AWS words it Three actions, three sentences on a live account. Delete omits the space after the type name — that is verbatim, and the line now says so, because it reads like a typo and the next person to tidy it would silently stop matching AWS. Modify was the one that was actually wrong: it answered with describe's sentence. A live account words it "CacheParameterGroup not found: <name>", which is neither describe's nor delete's. Pinned by a test that asserts all three, so the odd one cannot be quietly aligned with the others. |
||
|
|
f8b07a78ff | feat(lambda): add the ability to name and label lambda containers, code volumes (#2409) | ||
|
|
3f12428d97 |
feat(appsync): Phase 7 — GraphQL execute authentication (#2380)
* feat(appsync): register GraphQL execute controller in the service catalog
Unsigned POST /v1/apis/{apiId}/graphql was not a registered AppSync resource, so the data-plane path could be claimed by other catch-all routes.
* feat(appsync): default API key expiry and reject duplicate auth providers
CreateApiKey now expires in seven days when omitted, caps expiry at 365 days, and looks keys up by value. Create/UpdateGraphqlApi reject duplicate API_KEY, IAM, and Lambda providers.
* feat(appsync): authenticate GraphQL execute requests
Classify credentials by header shape and require a configured provider before GraphQL runs. Request failures return HTTP 401 UnauthorizedException on the data-plane envelope.
* feat(appsync): enforce SDL field authorization on GraphQL execute
Wrap registered fields with AuthorizationDataFetcher so directive mismatch, Cognito groups, IAM field DENY, and Lambda deniedFields stay HTTP 200 with null data and errors[].
* test(appsync): execute GraphQL over HTTP with an SDK-created API key
Cover data-plane success with x-api-key and 401 without credentials after management CreateGraphqlApi/CreateApiKey.
* fix(appsync): match missing-header 401 text and SigV4 precedence
AWS returns Missing authorization header when credentials are absent, evaluates auth before schema, and routes SigV4 Authorization ahead of x-api-key without falling back to the API key.
* fix(appsync): emit field-level Unauthorized GraphQL errors
AWS AppSync returns HTTP 200 with errorType Unauthorized and
Not Authorized to access {field} on type {type}, not UnauthorizedException.
* fix(appsync): omit sourceIp from OIDC identity
Official AppSync OIDC identity is only sub, issuer, and claims.
* fix(appsync): round API key expiry down to the hour
CreateApiKey and UpdateApiKey store expires as epoch seconds rounded
down to the nearest hour, matching the AWS API Reference.
* fix(appsync): match duplicate auth provider BadRequestException text
AWS names the 1-based additional provider index and the repeated type.
* fix(appsync): reject API key expiry outside 1-365 days
CreateApiKey and UpdateApiKey now raise ApiKeyValidityOutOfBoundsException
when expires is not between 1 and 365 days from now.
* fix(appsync): set ApiKey deletes to expires plus 60 days
AWS keeps expired da2 keys for 60 days and returns deletes as epoch
seconds rounded down to the hour.
|
||
|
|
74da157681 |
feat(apigatewayv2): support custom domain names and API mappings (#2390)
* feat(apigatewayv2): support custom domain names and API mappings POST /v2/domainnames was not routed, so it matched the S3 controller's catch-all and answered with an S3 XML error about multipart uploads, which an SDK expecting JSON cannot deserialize. The same was true of the API mappings a domain is used through. Adds the eight actions over the records the REST endpoints already keep, since a custom domain is one resource in AWS reachable through both APIs. A domain created here is therefore visible to the v1 endpoints and resolves through the Host-header routing that already exists: - CreateDomainName, GetDomainName, GetDomainNames, DeleteDomainName - CreateApiMapping, GetApiMapping, GetApiMappings, DeleteApiMapping - the mapping id is derived from what identifies the mapping, so it survives a restart and is the same id whichever API created it Taken from a live AWS account rather than the service model alone, which the model does not tell you: - every domain reports RoutingMode API_MAPPING_ONLY and an ipv4 IpAddressType - a create without exactly one configuration is "Invalid input. Expected one domain name configuration" - a duplicate domain is BadRequestException, not a conflict — for the REST API too, so the shared code and the test that asserted 409 were both wrong - deleting an API that a domain still maps to is refused: "Please remove all API mappings for the API from your custom domain names" - an unknown domain is "Invalid domain name identifier specified" Tags are stored and returned rather than dropped, which would have left terraform with a diff it could never settle. Mutual TLS, ownership verification certificates, routing rules and non-ipv4 address types are refused rather than accepted and ignored, so nothing is answered with a domain that behaves differently from the one that was asked for. * fix(apigatewayv2): make api mapping ids unique and validate what a mapping points at Five problems from review of the previous commit. Mapping ids were derived by hashing the base path, so two keys sharing a Java hash shared an id and a read or delete by that id picked between them. The base path is encoded rather than hashed, which cannot collide. An omitted mapping key and an explicit empty one produced two different records, where the shared store keeps the root mapping under "(none)" and could no longer find either from v1. Both spellings now canonicalise to the one record, and a second attempt is the ConflictException AWS answers: "ApiMapping key already exists for this domain name". A mapping was accepted for an API or stage that does not exist, returning 201 for something that routes nowhere. Both are looked up first, and answer as AWS does: "Invalid API identifier specified: <id>" and "Invalid stage identifier specified". The delete guard scanned only the caller's region, so an API could still be deleted out from under a mapping made in another region. It scans every region, since a mapping is keyed under the region of its domain rather than of its API. A domainNameConfigurations entry that was not an object passed the size check and then failed an unchecked cast, answering 500 instead of the AWS-shaped 400. * fix(apigateway): canonicalise base paths on write, key mapping ids off what is stored Canonicalising only where the v2 mapping id was derived left the collision it was meant to remove: the store could hold "(none)", "/" and "" as separate records that all mean the root, and folding them together at id time gave them one id for a read or a delete to choose between. Base paths are canonicalised where they are written instead, matching what reads have always done. The store can no longer gain a second record meaning the root, and a v1 mapping created as "" can now be read back as "", which it could not before: the write kept the raw value while the read looked for the canonical one. The id is derived from the path a record is stored under rather than its canonical form, so state persisted before this change keeps one id per record rather than several records sharing one. No endpoint can create such a record now, so that property is asserted directly against the records deserialization can restore. * fix(apigateway): delete the mapping record that was selected, not its canonical twin The v2 endpoints select a mapping by an id derived from the path its record is stored under, then deleted it through the lookup that normalises the root. For a record left under "/" or "" by state written before writes were canonicalised, that deleted the canonical root instead and left the selected record in place. Deletion by record now addresses the stored path exactly, so the record that answered the lookup is the record that goes. The normalising delete stays for callers that pass a key to look one up by, which is what the REST endpoint does. * fix(apigatewayv2): identify a mapping by its stored key, not by the field it reports BasePathMapping normalises an empty base path to "(none)" in its constructor, so a record the old write path left under the key "" reports "(none)" from its own field. Deriving the mapping id from that field gave it the canonical root's id, and deleting by it removed the canonical root while leaving the record behind — the collision the previous commit was meant to close, through the one door it left open. The service exposes mappings keyed by the base path each record is stored under, and the v2 endpoints derive ids, resolve lookups and delete through that key. The key is the only thing that identifies a record; the field can disagree with it. Seeded through the storage backend the service uses, since no endpoint creates such a record any more: the test asserts the two records keep separate ids, each id resolves to its own record, and deleting one leaves the other. |
||
|
|
8d33c65129 |
feat(s3): support bucket metrics configurations (#2382)
* feat(s3): support bucket metrics configurations PutBucketMetricsConfiguration was not routed, so a metrics call fell through to the unqualified CreateBucket and came back as BucketAlreadyOwnedByYou, which tells the caller nothing about what happened. The DELETE was worse: it fell through to DeleteBucket and silently removed the whole bucket while reporting success, so delete-bucket-metrics-configuration destroyed the bucket it was called on. Adds the four actions, stored per bucket and keyed by id: - PutBucketMetricsConfiguration, GetBucketMetricsConfiguration, ListBucketMetricsConfigurations, DeleteBucketMetricsConfiguration - the body is parsed and re-serialized rather than echoed back, so responses are built by floci and a filter survives the round trip in AWS's shape: repeated Tag elements inside And, with no wrapping element - an id in the body that disagrees with the query string is MalformedXML, and an unknown id is NoSuchConfiguration on both get and delete, neither of which AWS treats as a no-op - put and delete take the bucket monitor the other bucket-scoped mutations use, so concurrent puts of different ids cannot drop one another Behaviour taken from a live AWS account: the status codes (204 on put and delete, 404 for an unknown id), both error codes, and the exact XML of the single-configuration and list responses. floci records the configurations and returns them; no metrics are produced from them, and the listing is unpaged, so a continuation token is neither issued nor honoured. * fix(s3): validate metrics filters, use the shared XML utilities, guard the delete Three problems in the previous commit. The filter was normalized rather than validated, so bodies AWS rejects were accepted: a filter naming more than one predicate or none, an And of fewer than two conjuncts, an unknown predicate, and a tag missing its key or value. Verified against a live account that each is MalformedXML, and the parser now answers the same. Parsing and response building went around XmlParser and XmlBuilder, which AGENTS.md requires, and the S3 namespace was declared again rather than taken from AwsNamespaces. The bespoke DocumentBuilderFactory carried its own security configuration, where XmlParser disables DTDs and external entities for everyone in one place. The controller branches now delegate to handler methods like their siblings instead of inlining the work. A metrics mutation resolved the bucket record before writing it back, while DeleteBucket took no monitor, so a delete landing in between was undone by the write and the bucket returned. DeleteBucket now takes the same bucket monitor as the bucket-scoped mutations, and those re-read the record under it, so a mutation that lost the race reports NoSuchBucket rather than restoring the bucket. Its test forces that interleaving rather than racing for it. * fix(s3): reject malformed metrics bodies and stale writes over a recreated bucket Re-reading the record for presence was not enough. A bucket deleted and then recreated under the same name leaves a different record in the store, so a mutation that had resolved the old one passed the presence check and wrote it back, replacing the new bucket with the old one's state. The check now compares the record itself, and a mutation holding a superseded one reports NoSuchBucket. The parser also accepted bodies whose elements were duplicated or misplaced: a second Id or Filter, or a stray element under the root, was normalized away rather than refused, so what was stored was not what was sent. The root now has to be exactly one Id and at most one Filter, in either order. The concurrency tests wait on thread state rather than sleeping, so they observe the interleaving instead of hoping for it: instant on a fast machine and not flaky on a slow one. DeleteBucket taking the bucket monitor is asserted directly, since the window it closes — a delete between a mutation's re-read and its write — is too narrow to force from a test. |
||
|
|
23015a7475 |
fix(secretsmanager,rds): rotate secrets that an AWS service manages (#2378)
* fix(secretsmanager): rotate secrets that an AWS service manages RotateSecret required a rotation Lambda for every secret, so a secret RDS manages through ManageMasterUserPassword could never enable rotation: InvalidRequestException: You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. AWS rotates those secrets itself, so they carry no Lambda at all. It accepts RotateSecret with rotation rules alone, and refuses a Lambda ARN outright: "Rotation Lambda ARN is not supported for a service-managed secret." Key the behaviour off ownership rather than the rds! name prefix, since anyone may create an ordinary secret called rds!something and that must not grant it managed-rotation semantics: - Secret carries an owningService, set by floci services only and never settable over the wire - RDS marks the master user secret it creates as owned by rds, with the two tags AWS attaches to it - RotateSecret needs no Lambda for an owned secret, rejects one, and skips the Lambda rotation lifecycle that has nothing to invoke - DescribeSecret and ListSecrets report OwningService, and the owning-service ListSecrets filter matches on it instead of always returning nothing Covered by unit tests and by a CLI compatibility test that walks the whole path: create the instance with --manage-master-user-password, describe the secret it produced, then rotate it with rules and no Lambda ARN. Behaviour confirmed against a live AWS account: a db.t3.micro postgres instance created with --manage-master-user-password, then describe-secret and rotate-secret against the secret it produced. * fix(secretsmanager): keep managed rotation across restarts, report a real version Two problems in the previous commit: A secret persisted before ownership tracking deserializes without an owning service, so after an upgrade RotateSecret went on rejecting the Lambda-free call these secrets are rotated with. RDS backfills ownership at startup from the instances that name those secrets: RDS state is what makes a secret managed, so that is what the backfill reads, never the secret's name. RotateSecret answered a service-managed rotation with the request token as VersionId, while nothing stages a version for that token, so reading the advertised version failed with "can't find the specified secret version". Report the current version instead, which exists and holds the value a caller reads back. * fix(secretsmanager): back-fill ownership per account, stop claiming a rotation The startup backfill ran outside any request, so the secrets store resolved the default account while the instances it read span every account. Secrets owned by another account were left unmarked, and a same-named default-account secret could be written instead. The secret's ARN names its own account and region, so markOwnedByService takes the ARN and addresses that account's store directly. RotateSecret also recorded LastRotatedDate for a service-managed secret while neither the master password nor the stored value changed, so the secret claimed a rotation that GetSecretValue and the database would contradict. floci does not re-issue the credential, so it no longer reports one: rotation is enabled and scheduled, and NextRotationDate still follows from the rules. * fix(rds): never fail startup on the master user secret backfill The backfill reads persisted state at StartupEvent, so a storage error while scanning instances would have stopped the emulator from starting over work that is not needed to serve requests. It now logs and moves on, per instance and for the scan as a whole. * fix(rds): run the secret ownership backfill after storage is loaded The backfill observed StartupEvent, as does EmulatorLifecycle.onStart, which calls storageFactory.loadAll(). Two observers of one event have no ordering between them, so under hybrid or WAL storage the backfill could write ownership into memory that the reload then replaced with the older on-disk secret, leaving rotation rejected exactly where the backfill exists to help. It now hangs off restorePersistedRuntime(), which the lifecycle already calls after loadAll() for the same reason, alongside the other persisted-state fixups. |
||
|
|
bc0f88c9b1 |
feat(ec2): support transit gateway route tables, associations and routes (#2348)
* feat(ec2): support transit gateway route tables, associations and routes CreateTransitGatewayRouteTable, DescribeTransitGatewayRouteTables and DeleteTransitGatewayRouteTable; Associate, Disassociate and GetTransitGatewayRouteTableAssociations; Enable, Disable and GetTransitGatewayRouteTablePropagations; CreateTransitGatewayRoute, DeleteTransitGatewayRoute and SearchTransitGatewayRoutes. Part three of #2308, on top of the gateway in #2329 and the attachments in #2347. Backs aws_ec2_transit_gateway_route_table and the association, propagation and route resources beside it. Behaviour taken from a live account rather than the reference: - a table asked for by name is neither default; only the one a gateway mints for itself is - an attachment associates with exactly one table, so a second attempt is Resource.AlreadyAssociated rather than a move - association reports the transitional associating and disassociating, while propagation reports the settled enabled and disabled at once - enabling propagation twice is TransitGatewayRouteTablePropagation.Duplicate - a blackhole is a static route in the blackhole state rather than a type of its own, and carries no attachment - deleting a table is refused while it is a gateway's default association table, and again while attachments are associated, both IncorrectState with their own messages - an id that does not exist is InvalidRouteTableID.NotFound while one of the wrong shape is InvalidRouteTableId.Malformed, casing included Associations live on the attachment record rather than in a store of their own, since an attachment has at most one; propagations are their own records, since an attachment may propagate into several tables. Propagated routes are derived when routes are searched, from each enabled propagation joined to the attached VPC's CIDR blocks, rather than written down. Storing them would go stale the moment a VPC's CIDR associations changed, and would need invalidating from every VPC and attachment path. Deleting an attachment removes its propagations and leaves a static route that named it as a blackhole, which is what the live API does: the destination stays configured with nowhere to go. Deleting a gateway takes its tables' propagations, routes and tags with them, so nothing outlives the table it belongs to. Every mutation runs under the region-scoped topology lock introduced in #2347. * fix(ec2): keep route table operations within one gateway and one lock Three gaps found sweeping the new surface before review rather than after it, each checked against a live account. A route table reached attachments of any gateway. Associating, propagating or routing to another gateway's attachment was accepted and recorded, leaving a table pointing at something outside its own gateway. AWS refuses all three as though the attachment did not exist, which is the same shape a subnet from another VPC gets, and all five call sites now do the same. modifyTransitGateway writes route tables through its default-table markers but held only the gateway's striped lock, so a modify racing a route table delete could put the deleted table back. It and createTransitGateway now take the topology lock as well, which makes the rule exceptionless: every write to a gateway, route table, attachment, propagation or route happens under that one lock, acquired before any striped one. Deleting an attachment left its propagations and any static route naming it behind. On AWS the propagations go and the route survives as a blackhole - the destination stays configured with nowhere to go - and that is now what happens here. Deleting a gateway takes its tables' propagations, routes and tags with it, so nothing outlives the table it belongs to. * feat(ec2): support ReplaceTransitGatewayRoute Completes the route surface beside create, delete and search. Backs a provider moving a route between an attachment and a blackhole without recreating it. Verified on a live account: replacing a destination the table has never held writes it rather than reporting it missing, so this is an upsert rather than an update. The target moves as a unit - a route turned into a blackhole keeps no attachment, and one pointed back at an attachment regains its id, resource and resource type together. It carries the same rules as the rest of the route table surface: the attachment has to belong to the table's own gateway, the write happens under the topology lock, and a route it wrote is blackholed like any other when its attachment is deleted. * fix(ec2): apply the route search filters instead of ignoring them SearchTransitGatewayRoutes handled four filter names and let every other one through a default arm that matched everything, so a search by route-search.supernet-of-match, subnet-of-match or longest-prefix-match returned the whole table. A plausible wrong answer rather than an error. The three take different value forms, which the reference does not spell out. Observed on a live account, against a table holding 10.0.0.0/8, 10.1.0.0/16, 10.1.1.0/24 and 192.168.0.0/16: supernet-of-match 10.1.1.0/24 -> /8, /16 and /24, the exact match included subnet-of-match 10.1.0.0/16 -> /16 and /24, the exact match included longest-prefix-match 10.1.1.5 -> /24 longest-prefix-match 10.1.9.9 -> /16 longest-prefix-match 8.8.8.8 -> nothing So the containment filters take a CIDR and match inclusively in either direction, while longest-prefix-match takes a bare address and returns the one most specific route covering it. Handing either the other's form returns nothing there, and now here. An unrecognised filter name is rejected rather than ignored, matching InvalidParameterValue: Value (nonsense) for parameter Filter is invalid. Silently accepting one answers a question that was never asked. |
||
|
|
36a55f5060 |
feat(eventbridge): add Connection API actions (#1897)
* feat(eventbridge): add Connection model and state enum * feat(eventbridge): wire connection storage through EventBridgeService * feat(eventbridge): implement CreateConnection * feat(eventbridge): implement DescribeConnection and ListConnections * feat(eventbridge): implement UpdateConnection and DeleteConnection * feat(eventbridge): build connection responses with credential sanitization * feat(eventbridge): dispatch Connection actions in EventBridgeHandler * test(eventbridge): add Connection lifecycle integration test * test(eventbridge): cover connection secret stripping and validation errors * docs(eventbridge): document Connection actions * fix(eventbridge): register ConnectionState for reflection and validate auth type changes * chore: remove stray PR body helper file * fix(eventbridge): default IsValueSecret to true when omitted on connection parameters IsValueSecret is optional on Connection header/query/body parameters, and AWS treats an omitted flag as secret. Reading it with asBoolean(false) inverted that default, so a parameter that simply didn't set the flag came back in cleartext from DescribeConnection instead of masked. Reported by @abanna on PR #1897. * test(eventbridge): cover DescribeConnection masking when IsValueSecret is omitted Reproduces the leak abanna reported on PR #1897: a header parameter that doesn't set IsValueSecret must still come back masked, not in cleartext. Fails against the pre-fix asBoolean(false) default. |
||
|
|
3374bfeb04 |
feat(rds): add option group CRUD (#2352)
Adds CreateOptionGroup, DescribeOptionGroups, ModifyOptionGroup and DeleteOptionGroup, mirroring the DB parameter group actions. DB instances now accept OptionGroupName and report OptionGroupMemberships, so a group still attached to an instance faults on delete. Fixes #2304 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> |
||
|
|
1461a10de7 |
feat(cloudformation): apply security-group rules — inline properties and standalone resources (#1993)
* feat(cloudformation): apply security-group rules — inline properties and standalone resources Inline SecurityGroupIngress/Egress on AWS::EC2::SecurityGroup were silently dropped (groups deployed with no rules), and the standalone AWS::EC2::SecurityGroupIngress/Egress resource types were unsupported. Both now map onto the existing Ec2Service authorize APIs, including CidrIp/CidrIpv6 ranges and Source/DestinationSecurityGroupId peer pairs. Rules are removed with their group, so stack delete needs no revoke. Fixes #1992 * refactor(cloudformation): move standalone security-group rules into a per-service provisioner The standalone AWS::EC2::SecurityGroupIngress and AWS::EC2::SecurityGroupEgress types move out of the CloudFormationResourceProvisioner switch and into Ec2SecurityGroupRuleCfnProvisioner, discovered through the CDI registry. The inline SecurityGroupIngress/SecurityGroupEgress properties stay with AWS::EC2::SecurityGroup, which has not been extracted yet, and call the shared rule-to-IpPermission mapping so there is one copy of it. Along with the move: - delete() revokes the rule. A standalone rule can target a group that outlives the stack, so DeleteStack and create rollback used to mark the resource gone while its permission stayed active on the group. - Update revokes the rule the previous execution created before authorizing. The authorize APIs append, so re-running a template used to duplicate an unchanged rule and orphan the permission of a changed one. - A rule's Description now reaches its ipv6 range, and DescribeSecurityGroups reports ipv6 range descriptions. - GroupName resolves to a group id instead of being passed through as one. Ec2Service.deleteSecurityGroupRule removes a rule by SecurityGroupRuleId: the rule record plus the one permission (or the one range within it) that the record describes. The existing by-permission revoke matches on protocol and ports alone, which would strip a group's unrelated rules that share them. * fix(ec2): security-group rule records carry their peer, so deletion hits the right rule Three review findings with one root cause. createRules only turned ipv4 ranges into rule records. An ipv6 range or a referenced group collapsed into a single record holding nothing but protocol and ports, so DescribeSecurityGroupRules could not report the peer, and deleting one of several rules sharing a port revoked whichever permission happened to carry no ipv4 ranges — the requested rule stayed active while an unrelated one disappeared. Records are now created per peer, as AWS does: one per ipv4 range, one per ipv6 range, one per referenced group, with the peer recorded on each. removeRecordedPermission matches on that peer and drops the enclosing permission only once nothing is left in it. A record naming no peer matches only a permission that names none either, instead of falling back to the first port match. DescribeSecurityGroupRules gained referencedGroupInfo. The CFN provisioner updated a standalone rule by revoking then authorizing, so a rejected replacement left the group with neither rule: rollback keeps the old physical id but never recreates its permission, and the stack settled as UPDATE_ROLLBACK_COMPLETE minus a valid rule. It now authorizes first and revokes the previous rule only after that succeeds. * fix(cloudformation): a security-group rule names exactly one peer CloudFormation documents exactly one source per rule, an IPv4 range, an IPv6 range, a prefix list or a security group. Floci read each peer property independently, and authorize creates a rule record per peer, so a rule naming several kept only the first record as its physical id. Delete revoked that one and the rest stayed on the group, and a replacement leaked them. Naming more than one is now a ValidationError, which covers the standalone resources and the inline SecurityGroupIngress/Egress entries through the shared mapping. Delete no longer swallows failures from deleteSecurityGroupRule. That call already returns false for a rule it has no record of and succeeds when the group is gone, so the cases the catch existed for never reached it, and what it did absorb was a real failure reported to CloudFormation as a successful delete. * fix(cloudformation): a security-group rule carries its Description to a peer group The ipv4 and ipv6 branches both put Description on the range they build, while the peer-group branch left it off the UserIdGroupPair. Ec2Service reads the description straight off the pair, so a rule declaring SourceSecurityGroupId or DestinationSecurityGroupId with a Description came back from DescribeSecurityGroupRules without it. * fix(cloudformation): a security-group rule naming no source is rejected The peer check counted sources and rejected more than one, so a rule naming none passed and sent an IpPermission with no cidr, prefix list or group on it. CloudFormation then reported the source-less rule as successfully provisioned. AWS requires exactly one, so zero is as invalid as several. * fix(cloudformation): a security-group rule can name its peer group by name The source count read SourceSecurityGroupId but not SourceSecurityGroupName, so tightening the count to exactly one rejected a template that named its peer by name. The ingress schema lists both, along with SourceSecurityGroupOwnerId for a group in another account, and neither was read. Egress has no name variant. The name is handed to Ec2Service as a name rather than resolved here. resolveGroupReferences maps it to an id on authorize before createRules records the rule, so the delete path still matches on the resolved id. Also drops a stale comment three lines above the code it contradicted, claiming UserIdGroupPair has no description field. |
||
|
|
74e43a4632 |
feat(ec2): support transit gateway VPC attachments (#2347)
* feat(ec2): support transit gateway VPC attachments CreateTransitGatewayVpcAttachment, DescribeTransitGatewayVpcAttachments, DescribeTransitGatewayAttachments, ModifyTransitGatewayVpcAttachment and DeleteTransitGatewayVpcAttachment. Part two of #2308, on top of the gateway itself. The two describes are separate shapes rather than one being a superset: the VPC-specific form carries the subnets and options, while the resource-agnostic form drops both, types the VPC as a resource, and is the only place the route table association appears. Behaviour taken from a live account rather than the reference. The attachment's option defaults are its own: dnsSupport and securityGroupReferencingSupport enabled, ipv6Support and applianceModeSupport disabled. The second of those is enabled here while the gateway that owns the attachment defaults it to disabled, which is not something the documentation calls out. An attachment associates with the gateway's default route table only when the gateway asks for it, and an association already made survives the gateway later disabling that default: the association belongs to the attachment from creation, and only later attachments are affected. Rejections, all as observed: a VPC attached twice to one gateway is DuplicateTransitGatewayAttachment, two subnets in one zone are DuplicateSubnetsInSameZone, a subnet from another VPC is reported missing rather than mismatched, removing a subnet that is not attached is InvalidSubnetID.NotFound with its own wording, and removing the last one is InsufficientSubnetsException. A malformed attachment id is rejected before the lookup, with the terse message the real API uses. Two changes reach outside the new surface, both deliberate: DeleteTransitGateway now refuses while attachments exist, reporting IncorrectState and naming them. Part one could not have hit this, since nothing could attach then. parseTagsForResource reads TagSpecifications as well as TagSpecification. CreateTransitGatewayVpcAttachment declares no locationName on that member and so serializes the plural, unlike its neighbours; every tag sent by the AWS CLI was being dropped. The change only adds a spelling, so actions using the singular are untouched. State is reported settled rather than transitional, as for the gateway. Ipv6Support is accepted without checking that the subnets carry IPv6 CIDRs, which real AWS rejects; Floci does not model subnet IPv6 allocation, and inventing that state to enforce it seemed worse than documenting the gap. * fix(ec2): make attachment uniqueness atomic and guard attached resources Two defects in the VPC attachment work, both found in review. The one-attachment-per-VPC rule scanned for an existing attachment and then stored the new one without holding a lock between the two, so concurrent creates for the same VPC could all find nothing and all persist. Reproduced by disabling the fix: eight threads, eight attachments, where the API promises one. The check and the write now share the gateway's lock, and the test asserts one winner, the right error for every loser, and one stored attachment, over forty trials. Deleting a VPC or a subnet that an attachment uses left the attachment naming resources that no longer existed, which surfaced later as a modify failing on a subnet the caller never touched. Checked on a live account: both refuse, with the same code and shape of message. DependencyViolation: The subnet 'subnet-…' has dependencies and cannot be deleted. DependencyViolation: The vpc 'vpc-…' has dependencies and cannot be deleted. Both deletes now refuse the same way. A subnet of the attached VPC that the attachment does not use still deletes, so the guard is no wider than the dependency it protects. * test(ec2): lighten the attachment concurrency harness Forty trials of eight threads was heavier than the race needs — without the lock it shows on the first trial — and the extra load disturbed two thread-timing-sensitive tests elsewhere in the suite, PostgresProtocolHandlerTest and ElbV2HealthCheckerTest, neither of which this branch touches. Ten trials of six still reproduces it and leaves those alone. * fix(ec2): guard everything an attachment depends on under one lock The previous fix locked the uniqueness check alone, which was too narrow twice over. The gateway was resolved before the locked section, so a concurrent DeleteTransitGateway could see no attachments, delete the gateway, and let the create persist against the object it had already read. The VPC and subnet checks were outside any shared lock at all, and lockFor is striped, so a gateway's monitor never guarded a VPC or subnet delete regardless. Everything an attachment depends on now resolves and writes under one region-scoped monitor: the gateway, the VPC, the subnets, and the uniqueness rule. Deleting a gateway, a VPC or a subnet takes the same monitor across its dependency check and its delete. Where a gateway lock is also taken it is acquired inside this one, so the two cannot interleave in opposite orders. The test races a create against each delete and asserts the invariant rather than a winner: whoever wins, the store must never hold an attachment naming a gateway, VPC or subnet that is gone. It reproduces both holes — with the create-side lock removed, "attachment outlived its gateway" fails on the first trial. * fix(ec2): stop a tag write restoring a deleted transit gateway resource Tagging is a read-modify-write, so a tag call overlapping a delete could read the record, lose the race, and put it back afterwards. A resurrected attachment goes on blocking the VPC and subnets it names; a resurrected gateway goes on refusing its own deletion. The gateway and route table branches were as exposed as the attachment one, so all three moved together rather than only the case reported. Ordering matters as much as the lock here. The deletes take the topology lock and then a striped resource lock, so the tag paths have to take them the same way round; taking the topology lock further down the stack, with the resource lock already held, deadlocks against a concurrent delete. That is what the first attempt did, and the race test caught it as a pool that never drained. createTags and deleteTags now take the topology lock outermost for tgw- resources and updateResourceTags relies on its callers for it. The test races tagging against deletion for an attachment and for a gateway, asserting neither comes back. |
||
|
|
2f0ef45978 |
fix(lambda): validate Layers ARNs eagerly on CreateFunction/UpdateFunctionConfiguration (#2282)
* fix(appconfig): add DeleteConfigurationProfile/DeleteHostedConfigurationVersion/ListDeploymentStrategies/DeleteDeploymentStrategy
These four operations had no route at all, so a request fell through
to S3's generic path-style catch-all (GET/DELETE /{bucket}[/{key}])
and returned a misleading NoSuchBucket 404 instead of a real AppConfig
response - confirmed via both raw HTTP and the real AWS SDK for Java.
Adds the missing routes + AppConfigService methods, mirroring existing
precedent (DeleteConfigurationProfile/DeleteHostedConfigurationVersion/
DeleteDeploymentStrategy follow DeleteApplication's idempotent-delete
convention - no upfront existence check; ListDeploymentStrategies
includes the three predefined strategies alongside custom ones,
verified against the API reference's own sample response).
DeleteDeploymentStrategy's real path is /deployementstrategies/{id}
(extra "e" - a genuine, documented quirk in AWS's own API model; every
other deployment-strategy operation correctly uses
/deploymentstrategies). Confirmed against the API reference and
reproduced against the real SDK, which sends the misspelled path
literally - matched it rather than "fixing" it, since wire-protocol
fidelity to what AWS actually does is the point.
Regenerated docs/services/appconfig.md's Supported Operations list
(hand-maintained for REST controllers - not yet covered by
tools/docs/regen_action_docs.py, confirmed via services.yaml's own
Phase-1 scope comment).
Tests: AppConfigIntegrationTest (+4), compatibility-tests/sdk-test-java
AppConfigTest (+1, covering all four operations via the real SDK).
Ran locally (JDK 25):
AppConfigIntegrationTest (unit): 29/29 passed
AppConfigTest (SDK compat, live): 16/16 passed
* fix(appconfig): scope profile deletion to its application, reject deleting predefined strategies
Review feedback on #2280 (Copilot + Greptile, both independently):
- deleteConfigurationProfile ignored appId entirely and deleted by the
bare, globally-keyed profileId - a caller could delete another
application's profile just by guessing/reusing its ID, since
sibling reads (getConfigurationProfile) already enforce this
ownership check but the new delete route didn't. Now rejects with
the same ResourceNotFoundException as a mismatched get; a profileId
that doesn't exist anywhere is still an idempotent no-op, matching
deleteApplication's existing convention - only an existing-but-
wrongly-scoped one is rejected.
- Same method also now cascades the delete to that profile's hosted
configuration versions - they aren't independently addressable
outside a profile's lifecycle, so leaving them in versionStore after
the profile was "deleted" let a caller keep fetching versions for a
profile that supposedly no longer exists.
- deleteDeploymentStrategy silently reported success (204) for a
predefined strategy (e.g. AppConfig.AllAtOnce) without doing
anything, since builtins were never in strategyStore in the first
place - the strategy would still exist and still show up in every
subsequent Get/List call despite the "successful" delete. Now
rejects with BadRequestException.
Also applied this project's own established cleanup-logging
convention (System.err.println on a best-effort catch, matching
several other compatibility-tests/sdk-test-java files) to the one new
try/finally block flagged by Greptile, rather than swallowing the
exception silently.
Tests: 2 new AppConfigIntegrationTest cases (cross-application delete
rejected + original untouched, predefined-strategy delete rejected +
still resolvable) and 2 new SDK compatibility tests using the real
AWS SDK for Java v2's exception types.
AppConfigIntegrationTest: 31/31 passed
AppConfigTest (SDK compat, live): 18/18 passed
* fix(lambda): validate Layers ARNs eagerly on CreateFunction/UpdateFunctionConfiguration
Real AWS rejects an unresolvable layer ARN at attach time with
InvalidParameterValueException. Floci accepted any ARN unconditionally
- CreateFunction/UpdateFunctionConfiguration never validated it at
all, so the only signal was a silent WARN log from ContainerLauncher
when it tried (and failed) to mount the layer's content at container-
launch time, well after the caller had already moved on believing the
attach succeeded.
Adds LambdaLayerService as a LambdaService dependency and validates
each Layers ARN via the existing resolveLayerByArn before setting it
on the function, on both CreateFunction and UpdateFunctionConfiguration.
Left ContainerLauncher's existing warn-and-continue behavior alone for
the one case it still legitimately covers: a layer deleted *after*
being attached (real AWS doesn't re-validate layers on invoke either).
The three package-private test-only constructors (predating layer
support) now assign the new field null and validateLayersResolvable
short-circuits on it, following this class's own existing convention
for optional test-nulled dependencies (see the s3Service/aliasStore/
esmStore null-guards already throughout this file) - existing tests
using those constructors are unaffected.
Also fixes docs/services/lambda.md, which still described layer
support as entirely stubbed/unimplemented (PublishLayerVersion,
GetLayerVersion, ListLayerVersions, ListLayers, and DeleteLayerVersion
were all actually implemented already, just never documented as such).
This intentionally does NOT add real cross-account layer content
fetching (e.g. resolving the actual AWS-owned AppConfig Extension or a
Datadog-published layer) - there is no AWS-SDK/credential-handling
infrastructure anywhere in Floci for that, and it's a materially
larger feature (new dependency, credential trust boundary into
Floci's own control-plane process, cache/failure-semantics design)
than this fix. Documented as a known limitation instead.
Tests: LambdaLayerIntegrationTest (+2, covering both CreateFunction
and UpdateFunctionConfiguration rejecting an unresolvable layer and
leaving existing state unchanged). Ran locally (JDK 25):
LambdaLayerIntegrationTest: 21/21 passed
LambdaServiceTest/PersistenceTest/
ImageConfigTest/EventInvokeConfigTest/
ContainerLauncherTest (constructor-affected): 114/114 passed
* fix(lambda): validate UpdateFunctionConfiguration's Layers before any field mutation
Review feedback on #2282 (Greptile): InMemoryStorage#get returns the
live object backing the store entry, not a copy, and this method
mutates that object's fields one by one with a single save() at the
end - validating Layers where it's applied (after Description,
Timeout, and several other fields are already set) meant a rejected
update could leave those earlier fields live on the stored function
even though the whole call returned 400.
Moves the Layers extraction + validateLayersResolvable call to the
very top of the method, before any field mutation, so a rejected
Layers ARN no longer has that side effect. CreateFunction didn't need
the same fix - its function object is newly constructed and never
touches the store until the very end, so a validation failure there
was already side-effect-free (confirmed by checking where zip
extraction happens relative to the existing Layers check - after it).
This is a narrow fix for the field this PR touches - the same
mutate-then-single-save pattern already existed for other fields
(e.g. the RevisionId check happens after Description/Handler/
MemorySize/Role/Runtime/Timeout/Environment are already mutated), so
it's a pre-existing gap for those, not something this PR introduces or
attempts to fix wholesale.
Strengthened the existing update-rejection test to bundle a Description
change into the same rejected request and assert it was NOT applied -
this is the actual regression check for the ordering fix, not just
that Layers itself was left alone.
LambdaLayerIntegrationTest: 21/21 passed.
|
||
|
|
02898cf5e2 |
fix(iam): route long-term access keys to owning accounts (#2319)
* feat(storage): expose account ownership when scanning resources * fix(storage): validate account prefixes when scanning * fix(iam): resolve long-term access key accounts * test(iam): cover long-term access key account routing * docs(auth): clarify account-routing trust model |
||
|
|
be625023eb |
fix(appconfig): add DeleteConfigurationProfile/DeleteHostedConfigurationVersion/ListDeploymentStrategies/DeleteDeploymentStrategy (#2280)
* fix(appconfig): add DeleteConfigurationProfile/DeleteHostedConfigurationVersion/ListDeploymentStrategies/DeleteDeploymentStrategy
These four operations had no route at all, so a request fell through
to S3's generic path-style catch-all (GET/DELETE /{bucket}[/{key}])
and returned a misleading NoSuchBucket 404 instead of a real AppConfig
response - confirmed via both raw HTTP and the real AWS SDK for Java.
Adds the missing routes + AppConfigService methods, mirroring existing
precedent (DeleteConfigurationProfile/DeleteHostedConfigurationVersion/
DeleteDeploymentStrategy follow DeleteApplication's idempotent-delete
convention - no upfront existence check; ListDeploymentStrategies
includes the three predefined strategies alongside custom ones,
verified against the API reference's own sample response).
DeleteDeploymentStrategy's real path is /deployementstrategies/{id}
(extra "e" - a genuine, documented quirk in AWS's own API model; every
other deployment-strategy operation correctly uses
/deploymentstrategies). Confirmed against the API reference and
reproduced against the real SDK, which sends the misspelled path
literally - matched it rather than "fixing" it, since wire-protocol
fidelity to what AWS actually does is the point.
Regenerated docs/services/appconfig.md's Supported Operations list
(hand-maintained for REST controllers - not yet covered by
tools/docs/regen_action_docs.py, confirmed via services.yaml's own
Phase-1 scope comment).
Tests: AppConfigIntegrationTest (+4), compatibility-tests/sdk-test-java
AppConfigTest (+1, covering all four operations via the real SDK).
Ran locally (JDK 25):
AppConfigIntegrationTest (unit): 29/29 passed
AppConfigTest (SDK compat, live): 16/16 passed
* fix(appconfig): scope profile deletion to its application, reject deleting predefined strategies
Review feedback on #2280 (Copilot + Greptile, both independently):
- deleteConfigurationProfile ignored appId entirely and deleted by the
bare, globally-keyed profileId - a caller could delete another
application's profile just by guessing/reusing its ID, since
sibling reads (getConfigurationProfile) already enforce this
ownership check but the new delete route didn't. Now rejects with
the same ResourceNotFoundException as a mismatched get; a profileId
that doesn't exist anywhere is still an idempotent no-op, matching
deleteApplication's existing convention - only an existing-but-
wrongly-scoped one is rejected.
- Same method also now cascades the delete to that profile's hosted
configuration versions - they aren't independently addressable
outside a profile's lifecycle, so leaving them in versionStore after
the profile was "deleted" let a caller keep fetching versions for a
profile that supposedly no longer exists.
- deleteDeploymentStrategy silently reported success (204) for a
predefined strategy (e.g. AppConfig.AllAtOnce) without doing
anything, since builtins were never in strategyStore in the first
place - the strategy would still exist and still show up in every
subsequent Get/List call despite the "successful" delete. Now
rejects with BadRequestException.
Also applied this project's own established cleanup-logging
convention (System.err.println on a best-effort catch, matching
several other compatibility-tests/sdk-test-java files) to the one new
try/finally block flagged by Greptile, rather than swallowing the
exception silently.
Tests: 2 new AppConfigIntegrationTest cases (cross-application delete
rejected + original untouched, predefined-strategy delete rejected +
still resolvable) and 2 new SDK compatibility tests using the real
AWS SDK for Java v2's exception types.
AppConfigIntegrationTest: 31/31 passed
AppConfigTest (SDK compat, live): 18/18 passed
* chore: retrigger CI
|
||
|
|
112602fc6e |
fix(cloudwatch): page FilterLogEvents forward with a usable nextToken (#2354)
FilterLogEvents returned UUID.randomUUID() as its nextToken and had no nextToken parameter to accept one back, so a response could advertise more results while giving a client no way to reach them. Truncation compounded it: the time and pattern filters ran before .limit(maxEvents) over an ascending-sorted list, so an over-cap query kept the oldest matches and the newest were unreachable. The canonical use of this action is finding the error that just happened across a group, which is exactly the event most likely to be dropped. Accept a nextToken and make it an f/<index> offset into the matched set, reusing the parser GetLogEvents already validates its tokens with so a malformed, negative or overflowing token raises InvalidParameterException here too. The offset indexes matches rather than stored events, so a request narrowed by pattern, time range or stream names pages through only what it matched. Emit the token only when a further page exists, unlike GetLogEvents which echoes its forward token back. The two AWS actions signal exhaustion differently: FilterLogEvents documents an absent nextToken as "pagination is finished", and its SDK paginators keep requesting while the token is present with no same-token guard, so echoing a final token would never terminate. Also refuse to emit a cursor that cannot advance, which a max-events cap configured to zero would otherwise produce, and compute the page end by subtracting from the total so a cap near Integer.MAX_VALUE cannot overflow the index negative. startFromHead is still unsupported, so results run oldest first. |
||
|
|
6779aa8270 | feat(guardduty): add GuardDuty detector and organization configuration emulation (#2346) | ||
|
|
24cdabb257 |
feat(cognito): add GetUserAttributeVerificationCode support (#1898)
* feat(cognito): issue attribute verification codes in CognitoService * feat(cognito): dispatch GetUserAttributeVerificationCode in CognitoJsonHandler * test(cognito): add GetUserAttributeVerificationCode happy path * test(cognito): cover invalid token and unverifiable attribute errors * docs(cognito): document GetUserAttributeVerificationCode * fix(cognito): key attribute verification codes per attribute * fix(cognito): match AWS error messages for GetUserAttributeVerificationCode Real Cognito returns "Invalid Access Token", "Invalid attribute name. Only phone_number and email can be verified.", and attribute-specific "User does not have a valid registered email address" / "...phone number" messages, per AWS-parity comparison in PR #1898 review. * fix(cognito): match AWS destination masking format for verification codes Real Cognito masks as "z***@b***" for email (first char of local part and domain, three asterisks, no TLD retained) and "+********8920" for phone (leading "+", asterisks, last four digits kept), per AWS-parity comparison in PR #1898 review. Applies to both attribute-verification and forgot-password/account-recovery delivery masking, which share these helpers. * test(cognito): assert exact AWS-parity error messages and mask format Tighten GetUserAttributeVerificationCode assertions from loose containsString checks to the exact wording and masking AWS returns, so a regression in either silently drifting from AWS again is caught. * test(cognito): cover re-issuing verification code for a verified attribute AWS permits requesting a fresh GetUserAttributeVerificationCode code for an attribute that is already verified, as long as its value has not changed. Nothing in the current issuance path checks the *_verified flag, so this locks in that AWS-parity behavior. * style(cognito): drop redundant comment in attribute verification test The method name already conveys the AWS behavior being tested, per AGENTS.md's guidance to prefer self-explanatory code over comments. |
||
|
|
1cc97d57c1 |
feat(cloudhsmv2): implement CloudHSM v2 service (#1776)
* feat(cloudhsmv2): implement CloudHSM v2 service * refactor(cloudhsmv2): delete HSM parameters and docs * feat(cloudhsmv2): implement AWS CloudHSM v2 service (phased) * fix: greptile bot reviews * refactor(cloudhsmv2): delete HSM parameters and docs * feat(cloudhsmv2): implement AWS CloudHSM v2 service (phased) * fix: greptile bot reviews * fix(cloudhsmv2): fix backup retention policy parsing and SDK test cert usage * fix(cloudhsmv2): fix CreateHsm IP generation, ModifyCluster validation, and duplicate test Order * docs(cloudhsmv2): add service to mkdocs, readme, and index matrices * fix(rds): preserve configured database images (#2035) * fix(cloudhsmv2): resolve remaining AWS-compatibility edge cases * feat(stepfunctions): run Map iterations concurrently honoring MaxConcurrency (#1810) * feat(stepfunctions): run Map iterations concurrently honoring MaxConcurrency A Map state ran its iterations one after another. AWS runs them concurrently up to MaxConcurrency (default 0 = unlimited), which is a correctness requirement, not just a speed-up: a Map whose iterations coordinate — e.g. a dependency-ordered fan-out where one child blocks until a sibling completes — deadlocks when the iterations are serialised. Run each iteration on the shared executor under the execution's account, gated by a Semaphore sized to MaxConcurrency (unlimited when 0). Results are written into per-index slots so the output array preserves input order regardless of completion order, MaxConcurrency=1 stays strictly sequential, and a failed iteration cancels the rest and fails the Map (fail-fast, matching the default ToleratedFailureCount of 0). * fix(stepfunctions): cap Map worker threads with a bounded pool + handle interruption Address review: submitting every iteration to the shared cached pool behind a Semaphore spawned one thread per item (a 1000-item Map with MaxConcurrency=5 created ~1000 threads, ~995 parked). Run iterations on a fixed-size per-Map ThreadPoolExecutor sized to MaxConcurrency so live threads are capped and the rest queue. shutdownNow() in finally stops the iterations on any exit, and an InterruptedException from the driver now preserves the interrupt status. * fix(stepfunctions): make Map concurrency bounded and fail-fast * docs(stepfunctions): document map concurrency * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after OpenTofu registry flake * test(stepfunctions): pin Map item selection order * perf(lambda): reuse a populated code volume across restarts via a completion marker (#1827) * perf(lambda): reuse populated code volumes across restarts * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after download outage * ci: retry transient gosu downloads --------- Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> * fix(apigateway): apply MOCK integration response headers (#1822) * fix(apigateway): apply mock response headers for OPTIONS * refactor(apigateway): drop the OPTIONS route in favour of #1955 Both this PR and #1955 added an @OPTIONS method on the same @Path in ApiGatewayExecuteController and ApiGatewayUserRequestController, so whichever merged second would not have compiled. #1955's version is the more complete one: it covers ApiGatewayAwsExecuteController (the /_aws/execute-api path) as well, forwards the request body, and skips GlobalCorsFilter for deployed-API paths -- without which a real browser preflight is short-circuited before it ever reaches the route. This PR keeps only its own contribution: invokeMock returned early on the empty-response-template path and dropped static method.response.header.* mappings. ApiGatewayMockCorsHeadersTest now exercises that over GET, since the dropped-header bug is verb-agnostic, leaving the two PRs independently mergeable in either order. * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after autoscaling test flake --------- Co-authored-by: abanna <abanna@users.noreply.github.com> * fix(cloudwatch): return logStreamName on FilterLogEvents results (#2259) FilterLogEvents is the cross-stream search API, so a match is only attributable if the response names the stream that emitted it. Floci served FilterLogEvents and GetLogEvents from one serializer emitting eventId, timestamp, message and ingestionTime, so a caller searching a whole log group could tell which group a hit came from but not which stream, and tooling written against real AWS lost that attribution without any error. Derive the stream from the event's storage key rather than persisting it on the event. Keys are already <region>::<group>::<stream>::<timestamp>::<uuid>, so the key is an authoritative record of the emitter for every event in the store, including ones written before this change. Storing the name on LogEvent instead would leave every already-persisted event with a null logStreamName and need a backfill pass to repair it. The stream is read back between the group prefix and the trailing timestamp and uuid, both generated here, so a stream name is recovered whole even though nothing stops a caller from creating one that holds a ':'. filterLogEvents walks the keyset once and pairs each event with its stream, which also collapses the stream-restricted branch: it previously ran one full keyset scan per requested stream, since a scan walks every key regardless of the prefix it filters on. GetLogEvents keeps its existing shape. Real AWS returns OutputLogEvent there, which carries no logStreamName, because the caller named the stream in the request. Closes #2210 * fix(ec2): start sshd even when run-instances omits a key pair (#2245) * fix(ec2): start sshd even when run-instances omits a key pair Reported in #2184: run-instances without --key-name left every container with no SSH daemon listening at all, "connection refused" regardless of image (alpine, Amazon Linux 2023, Ubuntu all affected). The cause: startSshd() only ran inside the same conditional as injectSshKey(), so no key pair meant sshd never started. Real AWS AMIs run sshd as part of normal boot regardless of whether a key pair is attached - the daemon is always there, it just has nothing to authenticate an unattached client with. Floci's behavior diverged by not running the daemon at all in that case, rather than running it and correctly having no way in. Splits the two: injectSshKey still only runs when a key was actually provided (nothing to inject otherwise), but startSshd now always runs. It's fully self-contained already (installs openssh-server if absent, generates host keys, starts the daemon) and never depended on anything injectSshKey sets up, so making it unconditional needed no other changes. Verified: new test launches an instance with no public key and asserts sshd still starts (and confirms nothing gets written to authorized_keys, since there's no key to inject). Confirmed it fails with the fix reverted (no /usr/sbin/sshd invocation happens without a key) and passes with it restored. Full ec2 package regression is green (268 tests) - including the several existing tests that already launched with no key pair and needed no changes to keep passing. * fix(ec2): stop silently claiming sshd started when it never actually did Follow-up on a comment from duytanisme on #2245: sshd not starting even when an SSH key IS provided, requiring a manual exec-in or a custom user-data script to work around it. Root cause: startSshd() ran every step through execInContainer(), which discards the exec's exit code entirely and only throws if the Docker API call itself fails. The install step's shell script is an if/elif chain with no matching branch, or whose install command itself failed (no network yet, apt lock held, etc.) - and a bash if/elif with no matching branch and no else clause exits 0 by convention. So a container without a package manager, or one where the install call failed for any reason, still reported success, ssh-keygen and sshd then both ran anyway against a daemon that was never installed, and "Started sshd in EC2 instance" got logged regardless. Switches every step to execInContainerForResult and checks its exit code explicitly, following the exact pattern already used by configureLinkLocalMetadataEndpoint for the same class of problem: bail out and log a specific warning with the actual command output at whichever step actually failed, instead of silently proceeding. Also adds an explicit "command -v sshd" as the last statement of the install script, so its own exit code is the real source of truth for whether sshd is actually available afterward, and switches the start command from a hardcoded /usr/sbin/sshd to a bare "sshd" resolved via PATH (matching how ssh-keygen is already invoked two lines above), since not every image installs it to that exact path. Verified: new test forces the install probe to fail and asserts ssh-keygen and the start command are never even attempted. Confirmed it fails (proceeds anyway) with the exit-code check disabled and passes with it restored. Updated the existing no-key-pair test for the new bare "sshd" command. Full ec2 package regression is green (269 tests). * feat(stepfunctions): add UpdateStateMachine and update in place on stack updates (#1867) * feat(stepfunctions): add UpdateStateMachine and update in place on stack updates * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after download outage * fix(cloudformation): preserve log group on failed rename * fix(cloudformation): scope update rollback to attempted resources * fix(cloudformation): delete resources after stack updates * test(cloudformation): wire cloudfront fixture dependency * fix: include Step Functions update date in describe response * fix: preserve Step Functions describe response shape * fix: preserve generated Step Functions names * fix(s3): derive S3 host suffix matching from DNS config (#1843) * fix(s3): derive S3 host suffix matching from DNS config S3VirtualHostFilter hardcoded the wildcard-DNS suffixes (localhost.floci.io, localhost.localstack.cloud) in two places: the bare service-host check (isS3ServiceEndpointHost) and the virtual-hosted bucket fallback (isAwsS3Domain). Both now derive their suffix set from the embedded DNS source of truth plus any configured floci.dns.extra-suffixes, so a custom DNS suffix is recognised the same way the builtins are. Why: the two literal lists duplicated what the DNS server already knows and could drift from it silently. Deriving from EmbeddedDnsServer.BUILTIN_SUFFIXES keeps them in lockstep, and folding in extra-suffixes means a user migrating from LocalStack via a custom suffix gets consistent S3 host handling (bucket routing and service endpoint detection), not just the DNS resolution they get today. How: - buildServiceHostSuffixes() computes {localhost} + BUILTIN_SUFFIXES + extra-suffixes once per instance; isS3ServiceEndpointHost() checks membership instead of literals. - matchesConfiguredSuffixHost() routes the virtual-hosted forms bucket.<suffix>, bucket.s3.<suffix> and bucket.s3.<region>.<suffix> for every configured suffix, replacing the hardcoded localstack/floci branches in isAwsS3Domain. - EmbeddedDnsServer.BUILTIN_SUFFIXES widened to public so the filter reuses the list. The virtual-host match now requires the full builtin suffix (.localhost.localstack.cloud) rather than the bare parent domain (.localstack.cloud), matching LocalStack's actual wildcard DNS (*.localhost.localstack.cloud). * test(s3): derive DEFAULT_SUFFIXES from the production factory The test constant hardcoded a copy of the builtin suffix set, which would silently drift if a new builtin were added to EmbeddedDnsServer.BUILTIN_SUFFIXES. Widen buildServiceHostSuffixes() to package-private and reuse it in the test so the two stay in sync automatically. * fix(s3): include the configured hostname in the derived suffix set EmbeddedDnsServer resolves builtins + floci.hostname + floci.dns.extra-suffixes, but the derived service-host set carried only two of the three. The configured hostname reaches the filter as baseHostname, and matchesEndpointHost excludes the bare s3.<host> remainder by design, so the bucket form one level down (bucket.s3.<hostname>) matched nothing. DNS still resolves that host, so the request reached Floci and was then handled path-style, binding the first path segment as the bucket, rather than being refused. Carry the hostname into buildServiceHostSuffixes so all three DNS inputs are mirrored and a host that resolves by wildcard DNS routes under the same rules. * fix(ec2): assign a public IP only when the subnet opts in via MapPublicIpOnLaunch (#2023) * fix(ec2): assign a public IP only when the subnet opts in via MapPublicIpOnLaunch (#1984) Every instance was given PublicIpAddress 127.0.0.1 unconditionally in Ec2ContainerManager, so a private-subnet instance wrongly reported an internet-facing address (breaks the ssh-reachability / public-vs-private distinction). runInstances now flags the instance (associatePublicIp) from its subnet's MapPublicIpOnLaunch, and the container manager exposes a public address only when that flag is set. Private-subnet instances get no PublicIpAddress — DescribeInstances omits the element (XmlBuilder skips nulls), matching real EC2. The value for public instances stays the host-reachable 127.0.0.1 (unchanged). Unit test covers the public-vs-private flag. Supports the aws-bench project: un-excludes the ssh-reachability scenario. * fix(ec2): honor the launch-time AssociatePublicIpAddress override * fix(ec2): honor the top-level AssociatePublicIpAddress and an explicit-false launch configuration Two gaps left by the previous commit, both flagged in review. RunInstances only read the override off the primary network-interface spec (NetworkInterface.1.AssociatePublicIpAddress), so the legacy top-level AssociatePublicIpAddress parameter — what the CLI and older SDKs send — was silently dropped and the subnet default decided instead. It is now read as a fallback; AWS rejects both shapes at once, so the interface spec wins when present. The launch-configuration path was worse than before. LaunchConfiguration stored a primitive boolean, so an absent flag and an explicit false were indistinguishable, and the reconciler could only forward an explicit true. An LC that set AssociatePublicIpAddress=false in a MapPublicIpOnLaunch subnet still got a public address. The field is now a nullable Boolean the whole way through (service, query handler, CFN provisioner), so false overrides the subnet and only null falls back to it. DescribeLaunchConfigurations omits the element when it was never set, as AWS does. Tests: a handler-level test pins all four parse cases (top-level, interface spec, both present, absent), and the reconciler test pins true/false/null reaching runInstances unchanged. * feat(cloudfront): enforce signed private content (#1831) * feat(cloudfront): serve distribution requests from S3 and custom origins * feat(cloudfront): enforce signed private content * chore: re-run CI The Build and Test failure on the previous head was RuntimeApiServerTest's extension/stop race, a pre-existing flake unrelated to this change — it also failed on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it). Reproduced locally under `--cpus=1` and fixed separately. * fix(cloudfront): wildcard aliases match exactly one subdomain level wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the wildcard at that level only: "you can't add alternate domain names that are at levels higher or lower than the wildcard. For example, you can't add the alternate domain names example.com or marketing.product.example.com." https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html Practical effect: a distribution owning "*.example.com" would answer for a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to nobody. Require the label standing in for the wildcard to contain no dot. wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour (a.b.example.test resolving to the *.example.test distribution); it now asserts no match, plus the same for a deeper wildcard. * test(dynamodb): retain Quarkus port for cleanup * fix(cloudfront): isolate mocked storage backends * fix(cloudfront): match wildcards in signed policy queries * feat(cloudhsmv2): implement AWS CloudHSM v2 service (phased) - Fix malformed dummy certificate in sdk-test-java by generating a self-signed X.509 cert programmatically using BouncyCastle - Apply fixes for tag operations targeting backups - Escape backslashes in regex - Resolve compilation issues * fix(test): Add CloudFrontClient to TestFixtures to resolve merge conflict * revert(test): revert CloudFrontClient addition to TestFixtures * fix(cloudhsmv2): fix CSR public key mismatch in SDK tests by signing properly extracted CSR * test(ec2): fix Ec2PublicIpOnLaunchTest compilation after StorageBackend changes * fix(cloudhsmv2): remove explicit BouncyCastle JCA provider to fix native image certificate validation * fix(cloudhsmv2): add null check for DestinationRegion in copy backup * fix(test): correct storage imports in Ec2PublicIpOnLaunchTest after rebase * fix(cloudhsmv2): resolve code review comments including AZ lookup and validation * style(cloudhsmv2): remove trailing whitespace in CloudHsmV2Test --------- Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in> Co-authored-by: Aniket Shukla <aniketshukla619@gmail.com> Co-authored-by: Alex Banna <alexanderbanna@gmail.com> Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> Co-authored-by: TiM <tim@nuimarkets.com> Co-authored-by: Olamide Kosile <64154023+Mide69@users.noreply.github.com> Co-authored-by: lex00 <121451605+lex00@users.noreply.github.com> |
||
|
|
bfda938f72 |
feat(firehose): honor BufferingHints with time and size based flush (#2314)
* feat(firehose): honor BufferingHints with time and size based flush Buffers now flush when the stream's BufferingHints.SizeInMBs is reached or when IntervalInSeconds has elapsed since the first buffered record, replacing the hardcoded 5-record count trigger that matched neither AWS nor LocalStack. A single-thread daemon flusher ticks every floci.services.firehose.tick-interval-seconds (default 10). Buffers are drained on ShutdownDelayInitiatedEvent so pending records reach S3 before EmulatorLifecycle persists storage to disk. DeleteDeliveryStream keeps discarding pending records, matching real AWS (verified empirically: 3 records buffered under a 300s/5MB hint never reached the bucket after deletion). Fixes #1886 * feat(firehose): add opt-in flush-record-count trigger Emulator-only volume trigger complementing BufferingHints: setting floci.services.firehose.flush-record-count to N flushes a stream's buffer as soon as it holds N records. Disabled by default (0) so out-of-the-box delivery matches real AWS; 1 gives LocalStack-style record-at-a-time delivery for interactive local dev, where stream definitions mirror production intervals and waiting for IntervalInSeconds is impractical. Covers the use case of #1852. Co-Authored-By: yoshinori-aono-om <yoshinori.aono@omiai.inc> * test(firehose): cover size and interval flush triggers at the wire level The size trigger delivers inline on the writing request, and the interval trigger runs through the real background flusher started on StartupEvent — previously only verified manually. The test-scope Clock is the frozen MutableClock alternative, so the interval test advances it explicitly instead of sleeping through real time. * fix(firehose): clamp the flush tick interval and mirror config keys in application.yml A zero or negative floci.services.firehose.tick-interval-seconds reached scheduleAtFixedRate unchanged, which throws IllegalArgumentException from the StartupEvent observer and aborts startup. Clamp it to a 1s minimum, the same guard RdsDataService applies to its cleanup interval. Also list tick-interval-seconds and flush-record-count under the firehose service in the main and test application.yml, matching how other tunable service settings are surfaced there. * test(firehose): wait for buffered delivery in DataLake and SES compatibility tests DataLakeTest relied on the removed 5-record flush: with buffered delivery its Athena query ran before anything reached S3, failing with NoSuchBucket on floci-firehose-results (caught by the compatibility CI job). Both tests now set explicit BufferingHints and poll for the delivered object first. A 5s interval keeps the wait short — floci does not enforce AWS's 60s server-side minimum and the SDK does no client-side range validation. --------- Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com> |
||
|
|
9280369b64 |
feat(cloudformation): provision ApiGateway::Account, AutoScaling::LifecycleHook, and EC2::FlowLog (#2003)
* feat(cloudformation): provision ApiGateway::Account, AutoScaling::LifecycleHook, and EC2::FlowLog Three small provisioners over existing services: Account records metadata (physical id only), LifecycleHook maps onto AutoScalingService.putLifecycleHook, FlowLog onto FlowLogService.createFlowLog (newly injected into the provisioner). Fixes #2002 * feat(cloudformation): per-service provisioners for ApiGateway::Account, AutoScaling::LifecycleHook, and EC2::FlowLog The three resource types land in the extracted provisioner structure rather than the switch in CloudFormationResourceProvisioner, one class per service: - ApiGatewayAccountCfnProvisioner writes CloudWatchRoleArn into the API Gateway account settings, so GET /account reflects what the template asked for instead of the resource being recorded as a bare physical id. - AutoScalingLifecycleHookCfnProvisioner puts the hook on its group and removes it again when the stack is deleted. - Ec2FlowLogCfnProvisioner creates the flow log and deletes it when the stack is deleted. Both deletes close the cleanup gaps raised in review: flow logs and lifecycle hooks no longer outlive their stack. The delete path only holds a physical id, and a hook's physical id is its name, so AutoScalingService gains deleteLifecycleHookByName to find the hook whichever group owns it, including groups that outlive the stack. API Gateway has no DeleteAccount operation and its account settings are regional rather than stack-owned, so that provisioner keeps the default no-op delete. CloudFormationResourceProvisioner is byte-identical to main again: no switch arms, no FlowLogService injection, and the two constructor-arg test edits are reverted. Tests: three isolated provisioner unit tests (one mocked service each) plus the integration test, extended to cover deletion of the hook and the flow log against a group created outside the stack. * fix(cloudformation): delete a lifecycle hook on its own group, not by name alone A lifecycle hook name is unique within an Auto Scaling group, not within a region, but the CloudFormation delete path only had the physical id — the hook name — so it removed every hook with that name in the region. Two groups using the same hook name meant deleting or rolling back either stack stopped the other group's lifecycle action. CfnResourceProvisioner gained a delete overload that receives the whole StackResource, defaulting to the existing id-only form, and the dispatcher calls it for extracted provisioners. It sits after the EKS Nodegroup and IAM policy special cases so extracting one of those later cannot bypass them. The hook provisioner records its AutoScalingGroupName at create time and deletes through the group-scoped API. Resources provisioned before that still fall back to the by-name form: leaving the hook behind is worse, since it can sit on a group that outlives the stack. * fix(cloudformation): a stack update reuses its flow log and lifecycle hook Ec2FlowLogCfnProvisioner called createFlowLog unconditionally, so every UpdateStack created a second flow log and orphaned the first. The orphan then outlived the stack, since delete only knows the id recorded last. It now reuses the log this stack already made and creates only when that one is absent, on a first execution or after removal out of band. AutoScalingLifecycleHookCfnProvisioner had the same shape, but only when LifecycleHookName is omitted: a freshly generated name each update left the previous hook on the group, still firing, with nothing referencing it. An unnamed hook now keeps the name its first execution generated. A declared name needed no change, since putLifecycleHook is idempotent on it. Both follow EcsCapacityCfnProvisioner. Neither surfaced in CI because no test here ran an UpdateStack, so each provisioner now has one that does. * fix(cloudformation): a createOnly change on a flow log or lifecycle hook is reported Both provisioners reuse the resource the stack already made, so a change to a property AWS treats as createOnly was being absorbed instead of surfaced. The flow log reported the stack complete while DescribeFlowLogs kept serving the previous ResourceId, TrafficType, LogDestination, LogFormat or aggregation interval. The lifecycle hook was worse, since changing LifecycleHookName or AutoScalingGroupName created the new hook and overwrote the id delete uses, leaving the previous hook on its group and still firing. Both now report an unsupported replacement, matching how EcsCapacityCfnProvisioner treats a changed Name. A property the template stops declaring, or one the stored record never captured, is left alone rather than read as a change. * docs(cloudformation): list ApiGateway Account, LifecycleHook and FlowLog in the resource-type table * fix(cloudformation): dropping a flow log's createOnly property is a change rejectIfChanged returned early whenever the template supplied no value, so removing a previously explicit LogFormat or MaxAggregationInterval skipped validation entirely and the stack reported complete while DescribeFlowLogs kept serving the old one. An absent stored value still means leave it alone, since that is not evidence of a different one, but an absent requested value is now compared rather than skipped. MaxAggregationInterval compares against its documented default of 600 when the template omits it, which is the value a create would have used. * fix(cloudformation): a flow log's createOnly comparison uses effective values Removing the early return on a blank request fixed the dropped-property case and broke two others. createFlowLog defaults ResourceType, TrafficType and LogDestinationType, so re-applying an unchanged template compared null against a stored default and failed a no-op update, while adding a property to a log that never had one still returned early on the stored null and was ignored. Both sides are now the effective value, defaulting the requested side exactly as createFlowLog does, so add, drop and change all read as changes and a re-apply stays a no-op. The test helper stamps the same three defaults, since a stub without them is not a flow log this provisioner could have created. |
||
|
|
573d4bdaff |
fix(lambda,iam): assume execution role for in-function SDK calls (#1909)
* fix(lambda,iam): assume execution role for in-function SDK calls - Run Lambda SDK calls as known execution roles so IAM policies and caller identity match AWS behavior. - Preserve unknown-role and mounted-credential fallbacks while leaving ECS behavior unchanged. - Revoke container-bound sessions on cleanup and sweep orphaned sessions after restart. - Resolve the session account from the function ARN when the model carries no account, so a published version enforces its execution role instead of dropping to the placeholder credentials, and revokes under the account it registered with. PublishVersion builds its snapshot field by field and leaves accountId unset (#2040), so the account has to come off the version ARN; routing every read through one helper keeps register and revoke in step. - Add unit, enforcement, lifecycle, and real Docker coverage, plus updated documentation. * fix(lambda): mint execution-role sessions from a CSPRNG and flag credential passthrough The session key and secret are what IamEnforcementFilter authorizes a caller against, so mint them from SecureRandom rather than ThreadLocalRandom, matching how CertificateGenerator already sources security-relevant values. Register the class for native-image run-time initialization so the static instance is not captured, frozen-seed, into the image heap. Credential passthrough (Floci's own AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/ AWS_SESSION_TOKEN forwarded into a launched container) applies whenever those variables are set, so a Floci started from a shell that exports real credentials hands them to every workload whose role it cannot resolve. Log a WARN carrying the access-key prefix the first time the fallback forwards host credentials, and say so in the docs, so the accidental case is visible instead of looking identical to the deliberate one. |
||
|
|
4c510e576c |
feat(msk): add configuration CRUD (Create/List/Describe/Delete) (#2336)
* feat(msk): add configuration CRUD (Create/List/Describe/Delete) MskController only served /v1/clusters and /api/v2/clusters, so every configuration action 404s. An MSK configuration is the only supported way to set broker-level server_properties, and aws_msk_configuration / aws_msk_domain_policy are first-class Terraform resources - any stack setting broker properties failed before the cluster was even attempted. Adds a second StorageBackend on MskService (msk-configurations.json, mirroring msk-clusters.json), a new MskConfiguration model, and four endpoints on MskController mirroring the existing cluster handlers. serverProperties is base64 on the wire; decoded and kept internal (@JsonIgnore) since AWS only returns it via DescribeConfigurationRevision, which is a separate follow-up issue - this stays plain CRUD. Field names verified against botocore's actual kafka service model rather than trusting the API reference docs verbatim: every field is lowerCamelCase, including DeleteConfigurationResponse's `arn` (the public API reference page shows "Arn" capitalized, which does not match the real wire format). * fix(msk): validate request field types and persist serverProperties CreateConfiguration cast request fields directly (String)/(List<String>), so a wrong-typed field threw ClassCastException instead of an AWS-shaped BadRequestException, surfacing as an internal server error. serverProperties was @JsonIgnore, which excludes it from Jackson serialization entirely - not just REST responses, but also the persistent/hybrid/wal StorageBackend serialization that uses the same model. A configuration would silently lose its broker properties on reload under any non-memory storage mode. The field now serializes normally; the controller instead builds explicit response views for Describe/List/Create so serverProperties still never appears on the wire outside CreateConfiguration's own request, matching AWS (which only returns it via the out-of-scope DescribeConfigurationRevision). * fix(msk): default kafkaVersions to an empty array when omitted kafkaVersions is optional on CreateConfigurationRequest, but asStringList returns null when it's absent, and toConfigurationView put that null straight into the response - AWS's Configuration shape always populates it as an array. Default it the same way description already is. No existing test created a configuration without the field, which is why it slipped through. * feat(msk): support maxResults/nextToken pagination on ListConfigurations ListConfigurations previously returned every configuration in one response, ignoring the maxResults/nextToken query parameters the model declares. Mirrors the existing pagination pattern from BedrockAgentCoreGatewayService (ListResult<T> + a private paginate() helper): the cursor is the last returned item's ARN, base64 URL-encoded, resumed by scanning the ARN-sorted list past that value. maxResults is bounded to [1, 100] and an undecodable token both throw BadRequestException, matching CreateConfiguration's existing error family for this service. |
||
|
|
33d35b2079 |
feat(ec2): config toggle to report the AWS-faithful private IP (#2024)
* feat(ec2): config toggle to report the AWS-faithful private IP (#1983) DescribeInstances reported the Docker container's bridge IP as PrivateIpAddress, disagreeing with CloudFormation's subnet-allocated IP. Rather than force a fidelity-vs-reachability tradeoff, this adds an opt-in: ec2.aws-faithful-private-ip (default false) Default (false) is unchanged: the reported private IP is the reachable container bridge IP, so instances can reach each other at that address on the shared Docker network. When true, the CFN/subnet-allocated private IP set at launch is reported instead (AWS-faithful); routing and IMDS always use the container bridge IP (tracked separately as containerBridgeIp) regardless of the flag. Wired via a new awsFaithful overload of exposeReachablePrivateAddress; the three call sites pass the config flag. Test covers both modes. Fixes #1983. * docs(ec2): list aws-faithful-private-ip in application.yml and the config table Every other floci.services.ec2 knob appears in both application.yml files and the docs configuration table; this one was declared only on EmulatorConfig, so a user-facing flag was undiscoverable. |
||
|
|
5e01c07b33 |
feat(cloudformation): provision the network ACL family (#2001)
* feat(cloudformation): provision the network ACL family AWS::EC2::NetworkAcl, NetworkAclEntry (rule number, protocol, action, egress flag, CIDR, port range), and SubnetNetworkAclAssociation (CFN semantics: find the subnet's live association and replace it onto the target ACL) — all mapped onto existing Ec2Service APIs. Fixes #2000 * refactor(cloudformation): move the network ACL family to a per-service provisioner Ec2NetworkAclCfnProvisioner serves AWS::EC2::NetworkAcl, AWS::EC2::NetworkAclEntry and AWS::EC2::SubnetNetworkAclAssociation through the CfnResourceProvisioner seam, so the three types leave the switch in CloudFormationResourceProvisioner along with their private provision methods. The class is CDI-discovered by CloudFormationResourceRegistry, needs no registration, and injects only Ec2Service. delete() now covers all three types, so stack deletion cleans them up instead of leaking them. The ACL and the entry delegate to Ec2Service; the subnet association reverts the subnet to its VPC's default ACL, matching CloudFormation. NotFound is treated as already-deleted so a retried delete does not fail the stack. Entry properties resolve through the template engine rather than being read raw off the JSON, so RuleNumber, Egress and the PortRange bounds accept intrinsics such as Ref and Fn::Sub like the other properties already did. The integration test now deletes the stack and asserts the custom ACL is gone. A unit test covers the family in isolation with one mocked service. * fix(cloudformation): a stack update reuses its network ACL and upserts entries provisionNetworkAcl called createNetworkAcl unconditionally. CloudFormationService re-invokes provision with the prior physicalId on UpdateStack, so every update minted a second ACL, overwrote the id, and orphaned the previous one permanently. It now reuses the ACL this stack already made, creating only when that one is absent, and reports an unsupported replacement when VpcId changes, since VpcId is createOnly. Same shape as EcsCapacityCfnProvisioner. Fixing that alone broke the entry path: createNetworkAclEntry ran with replace=false, which raises NetworkAclEntryAlreadyExists for a rule that already exists. RuleNumber, Egress and NetworkAclId are the createOnly key, so re-provisioning the same key is an update, and replace=true is correct. Neither showed up in CI, since no test here ran an UpdateStack. Three now do. * docs(cloudformation): list the network ACL family in the resource-type table |
||
|
|
78ad357eb8 |
feat(opensearch): parse, store, and return AccessPolicies (#2327)
* feat(opensearch): parse, store, and return AccessPolicies AccessPolicies was never parsed on CreateDomain/UpdateDomainConfig, stored on the domain, or returned by DescribeDomain(s)/ DescribeDomainConfig, so aws_opensearch_domain.access_policies and aws_opensearch_domain_policy were unsupported and any inline policy was silently discarded. Threaded through as a plain string alongside engineVersion, following the same pattern: bare string in DomainStatus, Options+Status wrapper in DomainConfig (mirroring the existing EngineVersion field there). * fix(opensearch): drop unused region parameter from updateDomainConfig Domain.region is baked into the ARN at CreateDomain time and never recomputed on update, so the parameter had no effect. Its own local variable in the controller was correspondingly dead too. * test(opensearch): cover clearing AccessPolicies with an empty string The empty-string-clears-the-policy behavior was implemented but not exercised by any test. |
||
|
|
20470b7f4a |
feat(ec2): support transit gateways (#2329)
* feat(ec2): support transit gateways CreateTransitGateway, DescribeTransitGateways, ModifyTransitGateway and DeleteTransitGateway, as EC2 Query actions alongside the existing VPC and route table ones. Metadata only: nothing routes packets, and the value is in ids later resources can reference and describes that round-trip so plans converge. Option defaults come from a live AWS account rather than the reference: amazonSideAsn 64512, dnsSupport, vpnEcmpSupport and both default route table options enabled, autoAcceptSharedAttachments, securityGroupReferencingSupport and multicastSupport disabled. The last of those is the one worth stating, since disable is easy to assume the other way round. transitGatewayCidrBlocks is omitted entirely when unset rather than sent empty. Creating a gateway with either default route table option enabled also mints the route table AWS mints, and reports its id as both associationDefaultRouteTableId and propagationDefaultRouteTableId. Both name the same table, and it is already on the create response rather than appearing later, so a caller reading either id sees what AWS shows. The actions that operate on route tables directly are not implemented; nor are attachments. State is reported settled rather than transitional. AWS returns a new gateway as pending and reaches available in about 50 seconds, and reports deleting for about a minute before deleted; nothing here is slow, so the settled state is what the caller sees, matching how createManagedPrefixList already compresses create-in-progress. Modify and delete echo the gateway without its tagSet while create and describe include it, which is what the live API does. Part one of #2308. * fix(ec2): keep a transit gateway's default route table options coherent ModifyTransitGateway changed the DefaultRouteTableAssociation and DefaultRouteTablePropagation flags without touching their route table ids, so a gateway created with both disabled could be modified into reporting an option enabled while carrying no id for it. AWS does not create a route table on that request; it rejects it unless an existing table is named, and rejects an id supplied alongside a disable. An unknown table comes back as InvalidRouteTableID.NotFound rather than a transit-gateway-specific code. Checked on a live account: enable DefaultRouteTableAssociation conflicts with AssociationDefaultRouteTableId null disable DefaultRouteTableAssociation conflicts with AssociationDefaultRouteTableId tgw-rtb-0123456789abcdef0 Transit Gateway Route Table tgw-rtb-0123456789abcdef0 was deleted or does not exist. Validate instead: the flag and its id have to move together in both directions, and a named table has to exist. The divergent state is now unreachable and a rejected call leaves the gateway untouched. * fix(ec2): carry a default route table change through to what it governs Disabling DefaultRouteTableAssociation or DefaultRouteTablePropagation changed the flag alone, leaving the id it governs on the gateway and the matching marker on the route table. A describe then reported the option disabled while still naming a table, and the table still claimed to be the default for it. Checked on a live account. Disabling association on a gateway created with both defaults enabled drops AssociationDefaultRouteTableId from the options entirely rather than blanking it, clears DefaultAssociationRouteTable on the table, and leaves the table itself in place with its propagation marker and the gateway's PropagationDefaultRouteTableId untouched: DefaultRouteTableAssociation disable (no AssociationDefaultRouteTableId) DefaultRouteTablePropagation enable PropagationDefaultRouteTableId tgw-rtb-… tgw-rtb-… available defAssoc False defProp True Apply the same: the id follows its flag, the table's marker follows with it, and the table survives. Enabling with a named table marks that table instead. * fix(ec2): require a default route table to belong to the gateway naming it The route table named on a ModifyTransitGateway request was only checked for existence in the region, so a gateway could take another gateway's table as its default. Worse than a bad reference: applying the change then rewrote the foreign table's own default marker, leaving the gateway that actually owns it describing a table that no longer claims to be its default. AWS rejects this, under the same code as a table that exists nowhere but with the gateway named in the message. Checked on a live account, gateway A naming gateway B's default table: Transit Gateway Route Table tgw-rtb-0381f… was deleted or does not exist in Transit Gateway tgw-0438f… Both wordings are now reproduced: unqualified when the table exists nowhere, gateway-qualified when it exists but belongs elsewhere. The three rules governing these options - flag and id agreeing in both directions, and the named table existing and belonging to the gateway - now sit in one validation block rather than accumulating as separate guards. * fix(ec2): judge a default route table change against the stored gateway Validation looked only at the request, so a route table id arriving without its flag skipped the coherence check entirely: the id was stored while the table's default marker was left alone, and a disabled option could end up naming a table. AWS judges the pair against the gateway as it stands. Probed the whole combination surface on a live account rather than the one case reported: id alone, option enabled accepted id alone, option disabled InvalidParameterCombination, and the message quotes the stored flag, not the request enable alone, table named accepted, keeps that table enable alone, no table InvalidParameterCombination disable with an id InvalidParameterCombination disable with an unknown id the combination is reported, not the lookup So the flag defaults to the stored one when the request omits it, enabling without an id keeps the table already named rather than dropping it, and an id on its own marks its table. The lookup still runs after the combination check, which is the order AWS reports them in. Two other behaviours from the same pass, both already correct and now covered: removals apply before additions, so a CIDR added and removed in one call survives, and removing a CIDR that is not present is accepted. * fix(ec2): serialize transit gateway CIDR blocks as the string list they are transitGatewayCidrBlocks is a plain string list, so each item carries the CIDR as its own text. The items wrapped it in a cidrBlock element instead, which the AWS CLI parsed as an empty string: a caller that added a block got it back as "" from create, describe and modify alike. Caught by the CLI compatibility suite, not by the integration test, which asserted the same wrong shape the handler produced and so agreed with it. The bats case now reads the list back through describe as well as modify, since one helper serializes all three responses. * fix(ec2): apply tag changes to a transit gateway, not just to the tag store CreateTags and DeleteTags on a tgw- id updated the tag store but left the gateway object alone, because updateResourceTags had no branch for it. DescribeTags saw the change and DescribeTransitGateways did not, so a gateway kept serving whatever tags its TagSpecification carried at creation. That is the path a Terraform tag update takes: the provider sends CreateTags, then re-reads with DescribeTransitGateways and compares. With the two disagreeing, aws_ec2_transit_gateway would never converge. Route tables get the same branch, so their tags behave once part three can create them. The AWS CLI cases now cover the tag round trip and CIDR blocks supplied at creation, both of which were only asserted against shapes this branch produced itself. |
||
|
|
4e6e6df06d |
feat(bedrockagentcore): emulate the AgentCore control plane and InvokeAgentRuntime stub (#2316)
* docs(bedrockagentcore): add AgentCore emulation design + upgrade path
* feat(bedrockagentcore): add agent runtime CRUD control plane
Implements the bedrock-agentcore-control runtime registry (Phase 1):
Create/Get/List/Update/Delete AgentRuntime plus ListAgentRuntimeVersions,
with immutable version snapshots, cursor pagination, and ISO-8601 timestamps.
- REST-JSON controller + service + reflection-safe models
- ServiceRegistry descriptor + EmulatorConfig toggle
- Unit + RestAssured integration tests
- AWS SDK v2 compatibility test (sdk-test-java)
- Service docs page
Refs lex00/floci#2
* feat(bedrockagentcore): add agent runtime endpoints
Phase 2: Create/Get/Update/Delete/List AgentRuntimeEndpoint under
/runtimes/{id}/runtime-endpoints/, with a DEFAULT endpoint auto-created per
runtime and agentEndpoint/<uuid> ARNs. RestAssured + SDK v2 compat tests.
Refs lex00/floci#3
* feat(bedrockagentcore): add InvokeAgentRuntime data-plane stub
Phase 3: POST /runtimes/{agentRuntimeArn}/invocations returns a fixed,
configurable canned response ({"output":"yes"}) and echoes the runtime
session id. Opaque payload is never parsed; streaming is not emulated.
Separate stateless bedrock-agentcore service. RestAssured + SDK v2 compat tests.
Refs lex00/floci#4
* feat(bedrockagentcore): add tagging and workload identity
Phase 4:
- TagResource/UntagResource/ListTagsForResource for runtime ARNs via a
TagHandler on the shared /tags/{arn} route
- Workload identity RPC CRUD (POST /identities/<Op>); each runtime auto-creates
a resolvable workload identity
- Workload-identity timestamps are epoch-seconds (unixTimestamp), distinct from
the runtime ISO-8601 timestamps
RestAssured + SDK v2 compat tests.
Refs lex00/floci#5
* feat(bedrockagentcore): add gateway and memory primitives
Phase 5 (optional): metadata-only CRUD registries.
- Gateways (POST /gateways/) + gateway targets, standard REST
- Memory (POST /memories/create, GET /memories/{id}/details, ...), action-suffix
- Gateway timestamps are ISO-8601; memory timestamps are epoch seconds
RestAssured + SDK v2 compat tests.
Refs lex00/floci#6
* fix(bedrockagentcore): correctness fixes from adversarial audit
- Fix ListAgentRuntimeVersions pagination cycling for >=10 versions: sort by
the pagination cursor and zero-pad the version cursor (closes #7)
- Capture authorizerConfiguration/protocolConfiguration in version snapshots so
GetAgentRuntime?version returns the requested version's config (closes #8)
- Support tagging AgentCore gateways (AWS-taggable): add tags to Gateway,
dispatch the TagHandler by ARN resource type, store tags on CreateGateway;
non-taggable AgentCore ARNs now 400 (closes #9)
- Validate maxResults range (1..N) across all list operations (closes #12)
Adds regression tests: version-pagination multi-page, version-config snapshot,
gateway tag round-trip (REST + SDK), unsupported-ARN 400, maxResults + malformed
nextToken validation, and an HTTP-level multi-page pagination test.
Refs lex00/floci#14
* feat(bedrockagentcore): clientToken idempotency, invoke existence flag, config docs
- clientToken idempotency for Runtime/Endpoint/Memory create+delete (lenient:
same token returns the existing resource; completed-delete tokens tracked
in-memory so a replayed delete returns 202 not 404) (closes #10)
- InvokeAgentRuntime existence check behind floci.services.bedrock-agent-core
.validate-runtime-exists (default false, preserving permissive behavior);
when on, unknown runtime ARNs return ResourceNotFoundException (closes #11)
- Document that YAML config keys are hyphenated (bedrock-agent-core-control),
distinct from the reported service name (closes #13)
Adds unit tests (create/delete idempotency), a TestProfile integration test for
the existence flag, and an SDK v2 idempotency compat test.
Refs lex00/floci#10 lex00/floci#11 lex00/floci#13
* ci: trigger fork pipeline dry-run
* test(bedrockagentcore): add persistence, region-isolation, concurrency and boundary coverage
Closes the structural test gaps from the audit (issue #14):
- Persistence-across-restart: full AgentRuntime (JsonNode config, Instants,
version snapshots, endpoints, tags, env vars) round-trips through
PersistentStorage to disk and reloads intact
- Region isolation: a runtime is invisible/ungettable from another region
- Concurrency: concurrent creates all persist (no dropped inserts)
- Endpoint version retargeting, gateway + target update, duplicate-name 409,
and memory eventExpiryDuration boundaries (2/3/365/366)
Refs lex00/floci#14
* fix(bedrockagentcore): validate endpoint versions and the identity in a tagging ARN
createEndpoint and updateEndpoint stored agentRuntimeVersion without resolving
it against the runtime, so a version that was never published produced a READY
endpoint whose generated runtime ARN resolves to nothing. Both now reject one
the runtime has not published.
Tag operations resolved a resource from the ARN's id suffix alone, so an ARN
naming another account or region but a local id reached the local runtime or
gateway and could read or change its tags. The shared tag dispatch now checks
both fields against the request, which covers runtimes and gateways in one
place, and reports not found rather than a validation error so the response
does not confirm what sits behind the foreign identity.
|
||
|
|
dfcd492198 |
feat(ec2): allow a security group rule to take a prefix list as its source (#2271)
* feat(ec2): allow a security group rule to take a prefix list as its source AuthorizeSecurityGroupIngress and AuthorizeSecurityGroupEgress now read IpPermissions.N.PrefixListIds.M, so a rule can name a managed prefix list instead of a CIDR. The rule carries prefixListId in place of cidrIpv4 and DescribeSecurityGroups nests the reference under the permission, matching the shapes AWS returns. AWS emits one rule per source, so createRules expands a permission across its CIDRs and its prefix lists rather than treating the two as alternatives; a permission naming neither still yields the single bare rule it did before. An unknown list is rejected with InvalidPrefixListID.NotFound before the rule is stored, so a typo cannot leave a rule pointing at nothing. Closes #2269 * fix(ec2): resolve every prefix list before writing any security group rule createRules stored the CIDR rules of a permission before validating its prefix lists, so a permission naming a valid CIDR alongside an unknown list returned InvalidPrefixListID.NotFound while leaving the CIDR rule behind. AWS persists neither, checked against a live account, and rejects the call as a whole rather than per permission. Resolve every reference a request names before the first write, across all of its permissions, so a later bad permission cannot leave an earlier good one applied. Also brace the new parsing conditional, as AGENTS.md requires. * style(ec2): brace the conditionals in parseIpPermissions AGENTS.md is unconditional about braces, and the method held five unbraced conditionals around the line this branch added. Bracing the whole method rather than only the new line keeps it internally consistent. * fix(ec2): scope security group revocation to the sources it names Revocation compared only protocol and ports, so revoking one source removed every permission sharing that tuple: revoking a prefix list also dropped a CIDR rule on the same port. AWS scopes it to the source, verified against a live account, and leaves the others in place. Subtract the named sources instead, dropping a permission only once it had sources and has lost them all. A request naming no source at all still removes the whole matching permission, which is how a bare protocol and port revoke behaves. The permission a revoke names can be the very object authorize stored on the group, so the source values are snapshotted before either list is mutated. * fix(ec2): validate prefix lists once per request rather than per permission Resolving the prefix lists again inside createRules reopened the window the request-wide check had closed: a list can be deleted between the two, since the group lock and the prefix list lock are different monitors, so a later permission could fail after earlier ones had already stored their rules. Authorize resolves every reference before the first write, so the repeat is removed. createRules keeps no validation of its own; its other callers pass the CIDR-only default egress permission. * fix(ec2): resolve group references when revoking too Scoped revocation compares the sources a request names against the ones stored on the permission. Authorize resolves a reference made by group name to its group id before storing it, so a revoke naming the same source by name alone carried no id and matched nothing: the rule survived the revoke that named it. Resolve on the revoke path as well, mirroring authorize. This only surfaces once both source-scoped revocation and group references as a source exist, so the gap is between this branch and #2266 rather than in either alone. --------- Co-authored-by: Michal Schreiber <michal.schreiber@benefitsystems.pl> |
||
|
|
984886f697 |
feat(kms): implement UpdateAlias (#2324)
* feat(kms): implement UpdateAlias Repoints an existing alias at a different KMS key, following the existing createAlias/deleteAlias/resolveKey patterns. Required by the Terraform AWS provider, which treats a target_key_id change on aws_kms_alias as an in-place update. * fix(kms): reject invalid replacement keys in UpdateAlias UpdateAlias accepted any existing key as a replacement target, including keys pending deletion or with a different key usage/spec than the alias's current target. Real AWS KMS rejects both: the replacement key must be in a compatible state and match the current target's key usage and key spec. * fix(kms): compare key type instead of exact key spec in UpdateAlias The exact KeySpec comparison rejected valid updates between same-type keys with different specs (e.g. RSA_2048 to RSA_3072), which AWS KMS accepts as long as both keys share the same key type and usage. * test(kms): add Terraform compatibility test for UpdateAlias Verifies the exact scenario from #2291: the Terraform AWS provider treats target_key_id on aws_kms_alias as an in-place update, so re-applying with a different target must call UpdateAlias and update the alias without a destroy/recreate. Self-contained config, mirroring the eni-destroy-tf pattern, since it needs a second apply with a different var rather than the shared single-apply main.tf. * fix(kms): compare key family instead of KeyType in UpdateAlias Comparing the fine-grained KeyType enum rejected valid cross-family asymmetric updates (e.g. RSA_2048 to ECC_NIST_P256) that AWS KMS accepts. AWS only requires the current and new key to be "the same type (both symmetric or both asymmetric or both HMAC)" - a coarser three-way split - so compare on that instead. |
||
|
|
b45de1bb7d |
feat(s3tables): emulate metadata service (#2322)
* feat(s3tables): emulate metadata service * fix(s3tables): serialize metadata updates |
||
|
|
ff0201a13a |
feat(ses): add DKIM actions with domain-inherited email DKIM (#1904)
* feat(ses): add DKIM actions with domain-inherited email DKIM
Adds three DKIM actions and aligns DKIM status with AWS:
- v1 SetIdentityDkimEnabled: toggles the signing flag only (unknown identity ->
InvalidParameterValue).
- v1 VerifyDomainDkim: returns a domain's three DKIM CNAME tokens (stable across
calls), registering the domain as pending if absent.
- v2 PutEmailIdentityDkimSigningAttributes (PUT .../dkim/signing): sets the
signing origin (AWS_SES Easy DKIM, regenerating tokens when the key length
changes; EXTERNAL BYODKIM), returning DkimStatus + DkimTokens.
DkimVerificationStatus now tracks DNS record detection (via the Route53 lookup
in refreshIdentityState) rather than the enabled flag, so setDkimAttributes no
longer forces the status; the v1-native InvalidParameterValue is remapped to
BadRequestException on the v2 path. An email identity inherits its parent
domain's DKIM (SigningEnabled/Status/Tokens), matching AWS. Adds the
SigningAttributesOrigin / signing key length / last-key-generation fields to the
DkimAttributes response (LastKeyGenerationTimestamp is emitted as epoch seconds,
matching the SES v2 wire format).
Includes an AWS Java SDK compatibility test that exercises all three actions and
the email-inherits-domain behavior end-to-end.
* fix(ses): decouple DKIM status from signing flag and reject DKIM signing on email identities
- refreshIdentityState no longer gates the DkimVerificationStatus -> Success
transition on isDkimEnabled(), so a domain with the expected CNAMEs reaches
Success even when DKIM signing is disabled (status tracks DNS detection).
- putDkimSigningAttributes now rejects an email-address identity with
BadRequestException ("The EmailIdentity value must be a valid domain."),
matching real AWS — previously it mutated state the email would just inherit
back from its parent domain on every read.
* fix(ses): report domain DKIM as NotStarted on create, Pending on read
CreateEmailIdentity now returns DkimAttributes.Status=NOT_STARTED for a new
domain (SES has not begun tracking the CNAMEs yet); the first GetEmailIdentity
/ ListEmailIdentities refresh transitions it to PENDING, matching AWS. The
signing-enabled flag no longer gates the NotStarted->Pending transition, so a
disabled domain still reports PENDING on read.
* fix(ses): reject blank identity on PutEmailIdentityDkimSigningAttributes with a 400
A blank or whitespace EmailIdentity fell through to a NotFoundException (404) instead
of the validation error AWS returns. AWS rejects a missing/blank value with the same
400 "The EmailIdentity value must be a valid domain." as an email-shaped identity
(verified), so extend the guard to also cover null/blank.
* docs(ses): clarify DKIM inheritance is from the exact parent domain
An email inherits DKIM only from an exactly-matching registered parent domain, not from a
verified ancestor — a verified example.com does not cover user@mail.example.com unless
mail.example.com is itself registered (verified against AWS). Note this in the DKIM
paragraph so "parent domain identity when one is registered" isn't read as ancestor coverage.
|
||
|
|
e4010ec12f |
feat(rds): model DB proxies and their target groups (#1813)
* feat(rds): model DB proxies and their target groups Add DB proxies as first-class RDS resources for both the RDS Query API and CloudFormation: - RdsService: two persisted stores plus the proxy lifecycle (create/register-targets/describe/delete). A proxy exposes a bare-host endpoint on the engine family's default port; in non-mock mode registering a target starts an auth relay (via RdsProxyManager) that forwards 1:1 to the target cluster/instance, re-armed on restart. - RdsQueryHandler: CreateDBProxy, DeleteDBProxy, RegisterDBProxyTargets, DescribeDBProxyTargetGroups, DescribeDBProxyTargets, and a real DescribeDBProxies listing (2014-10-31 XML shapes). - AwsQueryController: route the six DBProxy actions to RDS. - CloudFormation: provision/delete AWS::RDS::DBProxy and AWS::RDS::DBProxyTargetGroup. This models DB proxies for provisioning and discovery; it does not add real connection pooling (the relay forwards 1:1), so it does not close #1679. * fix(rds): reserve DB proxy port so same-engine proxies get distinct ports createDbProxy used the engine family's default port (5432/3306/1433) directly without reserving it, so two proxies for the same engine got the identical port and the second relay failed to bind in non-mock mode. Reserve the default port via reserveOrAllocateProxyPort, falling back to an allocated pool port when it is already taken — the first proxy keeps the clean bare-host default port, later ones get a distinct port, and the persisted port stays canonical across restarts. * fix(rds): harden DB proxy lifecycle compatibility * fix(rds): complete DB proxy compatibility hardening * fix(rds): make DB proxy lifecycle rollback-safe * fix(rds): default omitted proxy target group * test(dynamodb): retain Quarkus port for cleanup --------- Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> |
||
|
|
80d1dc732e |
feat(ses): implement PutAccountVdmAttributes and return VdmAttributes from GetAccount (v2) (#2265)
* feat(ses): implement PutAccountVdmAttributes and return VdmAttributes from GetAccount (v2) Add the SES v2 PutAccountVdmAttributes action (PUT /v2/email/account/vdm) and surface the account's VDM settings in GetAccount under VdmAttributes. The settings (VdmEnabled, DashboardAttributes.EngagementMetrics, GuardianAttributes.OptimizedSharedDelivery — each an ENABLED/DISABLED FeatureStatus) are stored per region and round-trip through GetAccount. VDM is opt-in, so each flag defaults to DISABLED. An invalid FeatureStatus value is a BadRequestException, matching AWS; Floci stores the settings but does not run VDM analytics. * fix(ses): reject non-string FeatureStatus values in PutAccountVdmAttributes parseFeatureStatus coerced any JSON node via asText(), so a boolean or object VdmEnabled produced a misleading enum error instead of being rejected as a type mismatch. Guard on isTextual() before matching the ENABLED/DISABLED enum, consistent with the other SES v2 parsers. * fix(ses): match AWS GetAccount VdmAttributes shape GetAccount always emitted VdmAttributes with the nested Dashboard/Guardian objects. AWS instead omits VdmAttributes entirely until VDM has been configured for the region, and once present adds the Dashboard/Guardian sub-objects only while VdmEnabled is ENABLED. Return VdmAttributes only when the region has stored VDM state, and gate the nested objects on the stored VdmEnabled flag. * test(ses): record live-AWS confirmation that unconfigured VDM omits VdmAttributes eu-west-1 and ap-northeast-1 (never configured) omit the VdmAttributes key, while a configured-then-disabled region reports VdmEnabled DISABLED. |
||
|
|
30a61646ac |
feat(ec2): support CreateImage (create AMI from instance) (#1979)
* feat(ec2): support CreateImage from an instance Validates the source instance exists, then registers an image the same way RegisterImage does. Unblocks AMI-baking flows (e.g. CDK AwsCustomResource calling ec2:CreateImage on a stack-created instance). Fixes #1978 * fix(ec2): CreateImage reboots the source and produces a launchable AMI Two review findings. CreateImage ignored the default reboot. AWS reboots the source instance unless NoReboot=true so the image is captured from a quiesced file system; the action only checked that the instance existed. NoReboot is now parsed and the reboot runs by default. The resulting AMI kept nothing of what it was captured from. registerImage was called with null architecture, root device and block device mappings, so DescribeImages reported a generic x86_64 /dev/sda1 image with no devices, and RunInstances on the new id fell through to the catalog default guest because a generated ami-* is not in the catalog. The image now inherits architecture, root device name and block device mappings from the source instance's image, and records the launchable ancestor so RunInstances starts the same guest. CreateImage on an instance launched from a created AMI follows the chain back. Tests: unit coverage for the reboot default and its NoReboot opt-out, and for chained images resolving to the catalog ancestor rather than the generated id; integration coverage that an arm64 source yields an arm64 AMI that launches. * fix(ec2): a capture of a catalog AMI reports its root device CreateImage inherits the source image's block device mappings, but a catalog entry describes only its root device name and carries no mappings, so an AMI captured from a catalog-launched instance was registered with no devices and DescribeImages reported none. The root device is now rebuilt from the catalog entry, with a snapshot registered through the existing RegisterImage path. * fix(ec2): a capture takes its own snapshot of each device CreateImage handed the source AMI's mappings straight to RegisterImage, so the captured image reported the source's snapshot ids and the two images shared one snapshot. The mappings are now copied with fresh snapshot ids, keeping the device name, size, type and encryption. * fix(ec2): a capture includes the volumes attached after launch CreateImage read only the mappings of the AMI the instance was launched from, so a data volume attached afterwards was missing from the captured image. AWS records block device mapping information for those volumes as well. The instance's attached volumes are now added to the capture, each with its device name, size, type and a fresh snapshot. The root volume is skipped because the source AMI already describes that device. Also lists CreateImage and RegisterImage in the AMIs action table. That table is hand-maintained because Ec2QueryHandler is a deferred handler. * fix(ec2): a capture reports the root volume type the source actually has The catalog-source fallback in sourceImageMappings recorded the rebuilt root device as gp2, while RunInstances creates the source instance's root volume as gp3. DescribeImages therefore reported a type the instance never had. Both sites now read one DEFAULT_ROOT_VOLUME_TYPE constant, alongside the existing DEFAULT_ROOT_VOLUME_SIZE_GIB, so the two cannot drift apart again. |