mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
39b19d1c92ba2166342b7938d988d32808bb3698
1367
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
39b19d1c92 |
refactor(config): move max-request-size and ecr-base-uri into sub-mappings (#2902)
floci.max-request-size and floci.ecr-base-uri sat at the config root but belong with related settings. Relocate them: - max-request-size -> floci.protocols.max-request-size (ProtocolsConfig) - ecr-base-uri -> floci.services.lambda.ecr-base-uri (LambdaServiceConfig) A new FlociConfigRelocationsInterceptor (SmallRye ConfigSourceInterceptor, registered via META-INF/services) keeps the old flat keys and their FLOCI_MAX_REQUEST_SIZE / FLOCI_ECR_BASE_URI env vars working: the legacy key is consulted when the new key is requested, and iterateNames() rewrites it so config-mapping validation does not flag it as unknown. Future relocations are one entry in its RELOCATIONS list. ImageResolver, both application.yml files, the affected tests and the configuration docs are updated to the new keys. |
||
|
|
3db883d003 |
fix(iam): resolve DynamoDB table ARN from request body for IAM enforcement (#2928)
* fix(iam): resolve DynamoDB table ARN from request body for IAM enforcement (#2925) * fix(iam): evaluate multi-table DynamoDB batch and transact requests per table * fix(iam): support table ARN resolution for DynamoDB PartiQL statements * fix(iam): handle quoted PartiQL table names with special characters * fix(iam): use DynamoDbPartiQLParser to extract table from PartiQL statements |
||
|
|
cf628ba2b9 |
fix(lambda): honour Qualifier on GetFunction and GetFunctionConfiguration (#2932)
* fix(lambda): honour Qualifier on GetFunction and GetFunctionConfiguration Both read paths ignored Qualifier and answered with $LATEST for everything, including versions that were never published. A caller pinning version 1 silently got whatever $LATEST held at the time, which defeats the immutability guarantee that is the point of publishing, and a read against a version that does not exist returned 200 instead of 404, so a typo or a stale alias looked live. Resolve the qualifier through the same target resolver the invoke path uses, so a qualifier means the same thing whether a caller reads it or runs it. That covers published versions, aliases, and an explicit $LATEST, and turns an unresolvable qualifier into the ResourceNotFoundException AWS returns. A qualifier may also ride on the name, as fn:1 or a qualified ARN. An explicit Qualifier and one carried on the name must agree; disagreeing is InvalidParameterValueException rather than a silent pick of one. Scoped to the read paths. The invoke path already resolves qualifiers, and the remaining invoke-side gap is the warm pool keying in #1988, which has an approved fix awaiting a rebase in PR #2028. Closes #2821 * fix(lambda): resolve aliases deterministically when reading, not by weight Routing a qualified read through the invoke resolver also inherited its alias behaviour. An alias carrying AdditionalVersionWeights shifts traffic, so pickAliasVersion chooses at random among the weighted versions, which is right for running a function and wrong for describing one: two reads of the same alias could report different versions. Split the resolver on how aliases resolve rather than copying it, so the two cannot drift. Invoke keeps the weighted pick; a read follows the alias's primary FunctionVersion, which is what AWS reports. |
||
|
|
c54b237cd8 | fix(ec2): include network metadata in instance type responses (#2943) | ||
|
|
30b8f88467 |
fix(kinesis): handle minimum partition key hash (#2950)
* fix(kinesis): handle minimum partition key hash * fix(kinesis): preserve negative hash shard routing |
||
|
|
82ee3605c8 |
feat(cognito): implement user MFA preferences (#2896)
* feat(cognito): implement user MFA preferences * fix(cognito): register email MFA settings for reflection |
||
|
|
96c55ec2e2 |
fix(opensearch): keep publishing the domain's host port when floci runs in a container (#2798)
* fix(opensearch): keep publishing the domain's host port when floci runs in a container The container-IP endpoint fix dropped the Docker host-port binding in the in-container topology, copying the Neptune/MemoryDB pattern - but those services front their backends with floci-internal proxies, and OpenSearch has none, so the binding was the only path to the domain from outside the Docker network. Publish it in both topologies again; the stored endpoint stays the container-IP one. * fix(opensearch): release a domain's host-port reservation when its container is removed Repeated create/delete cycles reserved a fresh port each time and never handed one back, eventually exhausting the configured range. The domain now records its host port, releases it when the container is removed (teardown or restart), and keeps the reservation when keep-running shutdown leaves the container holding the binding. (cherry picked from commit 91507b191abda6f30ee42022add797bff1584487) |
||
|
|
b85dd2b7f7 |
fix(apigateway): import x-amazon-apigateway-any-method on OpenAPI import (#2876)
* fix(apigateway): import x-amazon-apigateway-any-method on OpenAPI import * fix(apigateway): review comments * fix(apigateway): replace em-dash |
||
|
|
0a3bc030f6 |
feat(cognito): implement identity provider configuration CRUD (#2858)
* feat(cognito): implement identity provider configuration CRUD CreateIdentityProvider, DescribeIdentityProvider, ListIdentityProviders, UpdateIdentityProvider and DeleteIdentityProvider were unsupported, so infrastructure tooling could not manage a user pool's federated providers. Stores provider configuration alongside the other user pool sub-resources and matches the response and update semantics measured against the live API: - IdpIdentifiers is echoed by create and update only when the request supplied the member, whatever the stored value; describe always returns it - AttributeMapping defaults to username -> sub when the member is absent at create, while an explicitly empty map is stored as given - members a request omits are preserved rather than cleared - a duplicate provider name raises DuplicateProviderException - ListIdentityProviders returns name/type/date summaries, never ProviderDetails Federated sign-in itself is out of scope: Floci has no /oauth2/authorize or /oauth2/idpresponse endpoint, so providers are stored configuration only. * test(cognito): match identity provider exceptions on the SDK error name `rejects.toThrow(/re/)` matches the error message, but the JS SDK maps the wire `__type` onto `error.name` and puts the AWS text in `message`, so the duplicate provider assertion never matched. Assert the name, and pin the enum text with an explicit message matcher. * fix(cognito): delete a pool's identity providers with the pool, and update a copy Two review findings, both reproduced first. DeleteUserPool left provider records behind. A pool recreated on a pinned id (`floci:override-id`) then inherited the dead pool's providers, ProviderDetails client_secret included. Pool deletion now removes them the way it already removes groups. UpdateIdentityProvider mutated the instance the store handed back, so two concurrent updates could interleave into a state matching neither request. It now writes a copy, which makes the losing update simply lose — what AWS does. * fix(cognito): serialise identity provider mutations UpdateIdentityProvider is a read-modify-write: it copies the stored provider, applies only the members the request supplied and writes the whole record back. Two overlapping updates copied the same base, so the later write restored the other's omitted members to their stale values and silently dropped an update. Live Cognito merges omitted members rather than clearing them, and applies that merge atomically, so both updates survive there. One lock now guards every mutating path, since create (check-then-put) and delete (check-then-act) carry the same race, matching the existing identityLinkLock idiom. The regression test runs two writers touching different optional members across 25 rounds; it fails on the first round with the lock reverted. * fix(cognito): guard the pool deletion provider cascade with the same lock DeleteUserPool clears a pool's identity providers outside identityProviderLock, so a create or update interleaving with the cascade could reinstate a provider for a pool that is going away. It now takes the same lock as the mutations it races, closing the last unguarded path in that set. * fix(cognito): recheck the pool under the lock when creating a provider CreateIdentityProvider validated the pool before taking identityProviderLock and never rechecked it, so a DeleteUserPool whose cascade ran in between left the create writing a provider for a pool that no longer exists. It now reasserts the pool inside the lock, immediately before the duplicate check and the write. UpdateIdentityProvider needs no equivalent: the cascade deletes the provider, so its own lookup throws ResourceNotFoundException. The outer validation stays where it is to keep error ordering unchanged for ordinary single-request calls. |
||
|
|
1e4e8b9ee8 |
feat(cognito): implement managed login branding (#2869)
* feat(cognito): implement managed login branding CreateManagedLoginBranding, DescribeManagedLoginBranding, DescribeManagedLoginBrandingByClient, UpdateManagedLoginBranding and DeleteManagedLoginBranding were unsupported, so a config declaring `aws_cognito_managed_login_branding` could not be applied against Floci. A branding belongs to one app client and is stored on it. Behaviour matches what the live API does: - a second branding for the same client raises ManagedLoginBrandingExistsException - ManagedLoginBrandingId must be a version 4 UUID, checked before the lookup - Settings is omitted from the response when the caller supplied none, while Assets is always returned - members an update omits are left unchanged Settings is stored opaquely rather than validated against AWS's unpublished schema, and ReturnMergedResources does not merge Cognito's default corpus. Closes #2856 * fix(cognito): reject malformed CreateManagedLoginBranding members Create coerced an absent UseCognitoProvidedValues to false and silently ignored a wrongly typed Settings or Assets, so a malformed request produced persisted state. Measured against AWS: neither UseCognitoProvidedValues nor Settings -> InvalidParameterException: useCognitoProvidedValues or settings should be specified (but not both) Assets of the wrong type -> SerializationException: Unexpected field type UseCognitoProvidedValues of the wrong type -> accepted, not rejected Create now enforces the first rule and type-checks Settings and Assets. A non-boolean UseCognitoProvidedValues is still accepted, because AWS accepts it. AWS answers a wrongly typed Settings with a 500 InternalErrorException; Floci returns the same client error it returns for Assets rather than reproducing that, and the divergence is documented. * fix(cognito): check Assets elements before converting them The Assets reader validated only the outer array, so a scalar element reached Jackson's convertValue and escaped as a 500 InternalFailure. This is the same class of bug as the LogConfigurations one, which I fixed in that reader without applying it here. AWS separates the two failures, and they differ from the LogConfigurations rules: [1, 2] / ["str"] -> SerializationException: Unexpected value type in payload [null] -> InvalidParameterException: 1 validation error detected: Value '[null]' at 'assets' failed to satisfy constraint: Member must satisfy constraint: [Member must not be null] A null element is rejected here, where LogConfigurations drops it. * fix(cognito): match AWS branding source validation A managed login branding request must select exactly one source of branding, and the same rule governs create and update. Measured against Cognito in ap-southeast-1: useCognitoProvidedValues settings result absent absent InvalidParameterException true absent accepted false absent InvalidParameterException absent present accepted true present InvalidParameterException false present accepted Create rejected only the neither case, update validated nothing at all, so naming both members and updating with no source both succeeded where the service rejects them. Presence of the member is not the test: false selects no source, which is why it needs settings alongside it. Reading the flag had to move with it. AWS coerces a JSON string rather than rejecting it, storing true for "true" and for "yes" and false for "false", while Jackson maps every string except "true" to false. That turned "yes" into a request selecting no source, so the coercion now follows the service. * fix(cognito): reject malformed UseCognitoProvidedValues types Jackson's asBoolean() maps a number, a JSON null, an object and an array all to false, so a malformed flag alongside valid Settings passed source validation and persisted as branding state that was never requested. Measured against Cognito in ap-southeast-1: 1, null, {} and [] are each a SerializationException, with or without Settings, while omitting the member is accepted and stores false. Only booleans and strings are read now, strings still coerced the way the service coerces them, and everything else raises SerializationException the way SesController already does. * fix(cognito): bound managed login branding assets at 40 Neither create nor update checked the documented 40-item maximum on Assets, so an oversized request was accepted and stored where AWS rejects it. Measured against Cognito in ap-southeast-1: create 40 assets passes the bound, reaches the source rule create 41 assets InvalidParameterException, length constraint create 41 + unknown client the length error, not the missing client update 41 + malformed id 2 validation errors, the length one first update malformed id alone 1 validation error, before the pool lookup The asset and branding-id checks now run before anything is looked up and share one message, matching those last three rows. DescribeManagedLoginBranding ran its pool lookup ahead of the branding-id check, which the fourth row shows is the wrong way round, so it moved with them. The length message embeds the request model's toString. The blob renders as the decoded buffer, confirmed at three payload sizes; the decoder used here is the lenient one so that building a rejection cannot itself fail. |
||
|
|
b8f1e22c74 |
feat(cognito): implement log delivery configuration (#2867)
* feat(cognito): implement log delivery configuration SetLogDeliveryConfiguration and GetLogDeliveryConfiguration were unsupported, so a config declaring `aws_cognito_log_delivery_configuration` could not be applied against Floci. The configuration is stored on the user pool and validated the way the live API validates it: - LogLevel accepts ERROR or INFO, EventSource accepts userNotification or userAuthEvents, both reported with AWS's 1-based member path - every entry must name a CloudWatch, Firehose or S3 destination - Set replaces the list rather than merging, so an empty list clears it - Get always returns LogConfigurations, as [] when nothing is configured Floci stores the configuration and delivers nothing: the destination is neither written to nor required to exist, and the pricing-tier gate AWS applies to userAuthEvents is not reproduced. Closes #2855 * fix(cognito): reject a null LogConfigurations instead of clearing the configuration SetLogDeliveryConfiguration treated an omitted, null or wrongly typed LogConfigurations as an empty replacement, so a malformed request returned 200 and erased the pool's stored configuration. AWS rejects all three. An omitted or null member fails validation, and a value of the wrong JSON type fails deserialization: omitted / null -> InvalidParameterException: 1 validation error detected: Value null at 'logConfigurations' failed to satisfy constraint: Member must not be null wrong type -> SerializationException: Expected list or null Also drops two em-dashes from the docs, per AGENTS.md. * fix(cognito): translate malformed LogConfigurations elements the way AWS does A scalar inside the array reached Jackson's convertValue directly, so an IllegalArgumentException escaped as a 500 InternalFailure instead of a client error, and a null element would have failed on the validation loop. AWS answers both without a 500: [1, 2] / ["a string"] -> SerializationException: Expected null [null] -> 200, the null element is dropped Elements are now checked before conversion: nulls are skipped and non-objects raise SerializationException. * fix(cognito): bound LogConfigurations and reject a repeated event source SetLogDeliveryConfiguration validated each element but never checked the list itself, so a request with three or more well-formed configurations, or two naming the same event source, was accepted and stored where AWS rejects it. Measured against Cognito in ap-southeast-1: 3 well-formed configs InvalidParameterException, length constraint on 'logConfigurations', max 2 2 duplicate sources InvalidParameterException, "appear more then once" 3 configs, one bad enum 2 validation errors, the length one reported first unknown pool, bad enum the validation error, not ResourceNotFoundException 0 configs 200 OK The shape checks now run before the pool lookup, matching that last row, and collect every violation into one message instead of throwing on the first. The duplicate and missing-destination complaints share one message with the missing-destination clause first, and each event source is named once however many configurations carry it, as measured. "more then once" is the service's own spelling, kept so the message matches. The length message embeds the request model's toString, which the emulator now reproduces for all three destination shapes and for an absent destination. |
||
|
|
7d693de663 |
fix(dynamodb): reject QueryFilter with KeyConditionExpression (#2935)
* fix(dynamodb): reject QueryFilter with key expression * test(dynamodb): keep QueryFilter test legacy |
||
|
|
de6bf8f599 |
feat(glue): jobs and crawlers (#2591)
* feat(glue): implement CRUD operations for Jobs and Crawlers * fix(glue): resolve edge cases in jobs, crawlers, and tagging implementation - Fix DynamoDBTarget ScanAll/ScanRate JsonProperty casing - Support MaxResults and NextToken pagination in GetJobs and GetCrawlers - Throw EntityNotFoundException for unknown Job/Crawler deletions - Retain existing configuration values during Crawler updates - Use centralized ResourceGroupsTaggingService for non-schema TagResource/UntagResource/GetTags actions * test(glue): add CRUD, pagination, and tagging tests for Jobs and Crawlers * fix(glue): validate pagination limits and ARN existence for tagging * fix(glue): enforce AWS-compliant validation, semantics, and responses - Add required field validation to Job and Crawler CRUD operations. - Persist SourceControlDetails and ProfileName across Job updates. - Set default State (READY) and Version for Crawlers on creation. - Standardize empty-body responses to bare Response.ok() per AWS specs. - Add handler-level integration tests for request payload parsing. - Refactor GlueServiceTest to use valid mock objects and standard imports. * fix(glue): add missing ARN validation for databases, tables, and UDFs - Restore EntityNotFoundException when attempting to tag nonexistent Databases, Tables, or UserDefinedFunctions. - Expand tagging tests to verify behavior for these resources. * chore(glue): apply AWS defaults for Job creation and remove unused Crawler DTOs - Apply default GlueVersion (5.1) and Timeout (480/2880 based on version) for newly created Jobs. - Remove empty Create/Update/DeleteCrawlerResponse models since they are unused. * fix(glue): throw EntityNotFoundException for unmodeled resource ARNs - Prevent validateResourceExists from silently passing when an ARN type isn't supported (e.g. connections). - Any ARN not matching jobs, crawlers, databases, tables, or UDFs now throws. |
||
|
|
146753b094 |
fix(kms): give ECC_NIST_EDWARDS25519 an actual Ed25519 key (#2930)
* fix(kms): give ECC_NIST_EDWARDS25519 an actual Ed25519 key The spec carried secp521r1 from the line above it, so it made an EC key and every Sign failed. Ed25519 now has its own key type. Message type rules and errors match real KMS, measured in ap-northeast-1. Closes #2924 * fix(kms): reject an ED25519_PH_SHA_512 digest of the wrong length Sign and Verify took any DIGEST value, where real KMS requires exactly one SHA-512 digest and answers otherwise with a ValidationException. Measured in ap-northeast-1 against both operations. |
||
|
|
6dec21479b |
fix(dynamodb): reject ConsistentRead on GSI Scan (#2931)
Query already rejected ConsistentRead=true on a global secondary index, but Scan silently performed the read. AWS returns ValidationException 'Consistent reads are not supported on global secondary indexes' for both operations. Extract the check into rejectConsistentReadOnGsi and apply it to both handlers; strongly consistent reads on tables and LSIs stay legal. Reproduced with paritysuite/dynamodb-conformance (tests/tier3/error-messages/indexReads.test.ts): the Scan case failed against 2.0.1 and passes with this change; the in-repo DynamoDbAccessPathIntegrationTest gains a wire-level Scan case plus an LSI-acceptance guard, and the Java SDK compat twin covers both ops. Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com> |
||
|
|
fad54f3c7a |
fix(stepfunctions): fail an intrinsic argument that matches nothing (#2872)
* fix(stepfunctions): fail an intrinsic argument that matches nothing
States.Format('{}', $.nope) resolved to null and the state succeeded. Real AWS
fails it with States.Runtime and names the whole expression. An index past the
end of an array is a miss here, where the same path written directly resolves
to null.
Closes #2870
* docs(stepfunctions): drop the States.Format template gap note
The gap is not fixed or caused by this change, so it is tracked on its
own issue instead of riding along in this pull request.
* test(stepfunctions): point the format template gap at issue #2927
|
||
|
|
3d3ab0023f |
fix(cloudfront): persist and echo LambdaFunctionAssociations and FunctionAssociations (#2915)
* fix(cloudfront): persist and echo LambdaFunctionAssociations and FunctionAssociations CreateDistribution accepted LambdaFunctionAssociations and then silently dropped them: the parser never read the element and the serializer hardcoded Quantity 0. A distribution meant to run a viewer-request Lambda@Edge function ended up with no function attached and no error. FunctionAssociations (CloudFront Functions) had the same bug, so it is fixed in the same change. - parseDefaultCacheBehavior + parseCacheBehaviors: read LambdaFunctionARN, EventType, IncludeBody for Lambda and FunctionARN, EventType for Functions into the existing model fields. - xmlDefaultCacheBehavior + xmlCacheBehavior: replace the two hardcoded blocks with xmlLambdaFunctionAssociations / xmlFunctionAssociations, still emitting <Quantity>0</Quantity> when empty. - Validate EventType: Lambda allows all four event types, Functions only viewer-request and viewer-response; an empty ARN or an invalid EventType returns 400 InvalidArgument. Closes #2835 * fix(cloudfront): validate association Quantity and brace association parsers Address review feedback on the LambdaFunctionAssociations / FunctionAssociations round-trip: - The parsers now read the declared <Quantity> for each association block. A malformed value returns 400 InvalidArgument; a value that differs from the number of items returns 400 InconsistentQuantities, matching the existing TrustedKeyGroups handling, instead of being silently recomputed on read-back. An omitted Quantity is still accepted. - Add braces to every conditional in the new association parsing paths, per the repository convention in AGENTS.md. |
||
|
|
5c71713cad |
fix(ec2): guard null group entries in DescribeNetworkInterfaces group-id filter (#2887)
The group-id filter dereferenced each of an interface's group entries with no null check, unlike the sibling filters in the same switch (attachment.instance-id already guards getAttachment() != null). When an interface's group list carried a null entry, matchesFilter threw a NullPointerException and DescribeNetworkInterfaces returned a 500. Terraform and Pulumi poll DescribeNetworkInterfaces filtered by group-id while deleting a security group, so the 500 turned an SG delete into an indefinite retry loop until the client timed out. Guard each entry, matching the null-tolerant style of the adjacent cases. |
||
|
|
e44df51a79 |
fix(ec2): tolerate a null groupId in the network-interface group-id filter (#2921)
The group-id filter for DescribeNetworkInterfaces resolves to matchesValue(List<String>, String), which called value.matches(...) with no null guard. A real GroupIdentifier entry whose groupId is null (a name-only association) therefore NPE'd the whole request, unlike the sibling matchesValue(String, List<String>) overload that already normalizes with Objects.toString. Normalize the value the same way so every network-interface leaf filter (group-id, subnet-id, status, private-dns-name, ...) tolerates a null field instead of failing. Adds a regression test that carries a null-groupId entry ahead of a real group on the same interface, so the null path is exercised and the real group still matches. |
||
|
|
5b3c0e01e3 |
refactor(rds): split PostgresProtocolHandler into authenticate and bridge primitives (#2913)
Extract handleAuth into authenticate(...), which returns the post-startup client Socket (or null when the handshake ended early), and a public bridge(...) that relays. RdsAuthProxy and RedshiftAuthProxy now call authenticate then bridge in sequence; RDS and Redshift relay behaviour is unchanged. This lets a later change replace the Redshift relay with an intercepting bridge without touching the handshake. |
||
|
|
660e7613bf |
refactor(ses): extract the configuration-set domain into SesConfigurationSetService (#2881)
* refactor(ses): extract the configuration-set domain into SesConfigurationSetService * refactor(ses): rename SesServiceEventDestinationTest to match its subject * fix(ses): drop em dashes from new Javadoc and pin the list-order test timestamps * docs(ses): untangle the resolveSuppressionReason Javadoc after the extraction |
||
|
|
9b582b309a | fix(lambda): apply Architectures on UpdateFunctionCode (#2907) | ||
|
|
047db09d54 |
fix(opensearch): include CognitoOptions in domain status (#2860)
Fixes #2801 |
||
|
|
77b4881fe4 |
fix(cloudformation): merge Fn::Transform AWS::Include before provisioning, and honour GetTemplate TemplateStage (#2886)
* test(cloudformation): pin Fn::Transform AWS::Include merging against the deployed template
The expected values come from a deployed stack's original and processed templates,
read with get-template, and from get-template-summary probes against real AWS.
Every assertion states its expected value as a literal, including the spliced
multi-line Fn::Sub value with its line breaks intact.
* fix(cloudformation): merge Fn::Transform AWS::Include before provisioning
The template engine evaluated ten intrinsics and Fn::Transform was not among them,
so an AWS::Include node was neither expanded nor rejected: it reached provisioning
as an ordinary key. A state machine whose DefinitionSubstitutions came from a
snippet therefore reached CreateStateMachine with a key literally named
Fn::Transform and without any of the snippet's keys, leaving every ${placeholder}
unsubstituted in the stored definition. The stack still reported CREATE_COMPLETE.
Measured against a deployed stack: 41 Fn::Transform nodes in the original template,
all Name AWS::Include, all with the same s3:// Location, all at
Resources.<id>.Properties.DefinitionSubstitutions; 0 in the processed template. At
one of those positions the six sibling keys keep their original order and the five
snippet keys are appended after them, and the spliced multi-line Fn::Sub value keeps
its line breaks: nothing is folded or re-serialized.
Three controlled get-template-summary probes settle the summary contract. A template
with no transform reports DeclaredTransforms null and its ResourceTypes; the same
template with an embedded Fn::Transform, and one with a top-level Transform, both
report DeclaredTransforms AWS::Include. GetTemplate keeps returning the body as
submitted, matching AWS's TemplateStage=Original default, while the change-set
baseline uses the merged body so a byte-identical resubmission reports no change.
* test(cloudformation): pin Fn::Transform AWS::Include rejection when Parameters is absent entirely
* test(cloudformation): pin Fn::Transform AWS::Include rejection when Location is present but blank
* fix(cloudformation): name the Fn::Transform node when AWS::Include Parameters is absent or Location is blank
* test(cfn-transform): pin AWS::Include Location error message for blank and null-Parameters shapes
Renames the existing empty-string test to name the shape it actually feeds,
adds coverage for a whitespace-only Location (which today leaks its raw
value with no quoting) and for an explicit null Parameters (which already
renders the Fn::Transform node, with no test pinning that literal).
* fix(cfn-transform): reject whitespace-only Location and stop leaking non-object Parameters
describeLocation checked isEmpty() where its own javadoc promised blank, so a
whitespace-only Location leaked its raw unquoted value into the rejection
message instead of a quoted string. It also enumerated missing and null as
the only non-mapping Parameters shapes, so a scalar or a list Parameters fell
through to Location's MissingNode and the message rendered Parameters itself
as if it were the rejected Location. Both guards now ask a single question
each: isBlank() for the Location text, and isObject() for the Parameters
shape, dropping the OR out of the second guard.
* test(cfn-transform): pin AWS::Include Location error message for scalar and list Parameters
Closes the coverage gap for defect 2: before the isObject() guard, a scalar
or list Parameters fell through to Location's MissingNode and the rejection
message rendered Parameters itself as if it were the Location, which a
reader could mistake for a valid rejected URI. Both templates go red against
the pre-hunk isMissingNode()||isNull() guard and green against isObject().
* test(cloudformation): pin GetTemplate TemplateStage selecting Processed vs Original
Processed must return the SAM-expanded, AWS::Include-merged body with no
AWS::Serverless::Function or Fn::Transform node left; Original and the
no-stage default must return the caller's raw YAML byte for byte; an
invalid stage must reject with the AWS enum ValidationError; and a plain
stack with no transform must return identical bodies for both stages and
advertise StagesAvailable on every GetTemplate call.
* fix(cloudformation): honor GetTemplate TemplateStage instead of always returning Original
GetTemplate accepted no TemplateStage, so a caller asking for Processed was
silently answered with Original. It now validates the parameter against
AWS's Original/Processed enum, returns stack.templateBody (the SAM- and
AWS::Include-merged body) for Processed and stack.originalTemplateBody
(the caller's raw submission, also the default) otherwise, and reports
StagesAvailable on every response, matching real AWS.
* test(cloudformation): pin GetTemplate TemplateStage validation ordering and empty-string rejection
Pins two AWS-measured behaviors GetTemplate does not have yet: TemplateStage
Bogus is rejected with the enum ValidationError even when the named stack was
never created, proving AWS validates the request shape before the stack
lookup; and TemplateStage="" (present but empty) is rejected the same as any
other value outside the enum, distinct from the omitted case which defaults
to Original.
* fix(cloudformation): validate GetTemplate TemplateStage before the stack lookup and reject an empty value
Two ordering and parsing gaps measured against a real account: an invalid
TemplateStage was rejected with "Stack ... does not exist" instead of the
enum ValidationError when the stack was absent, because the lookup ran
first; and TemplateStage="" (present but empty) was silently accepted as
Original instead of rejected, because isBlank() treated it the same as the
omitted case. Both are hoisted/tightened to match AWS. The two stage names
are also named once as constants instead of retyped across the enum list,
the StagesAvailable list, the stage-selection check and the default, and the
rollback comment and docs are rewritten to describe today's two-stage
behavior instead of the pre-TemplateStage one.
* docs(cloudformation): correct GetTemplate Processed-stage claim, drop a self-evident comment
The GetTemplate doc claimed AWS::LanguageExtensions, a third-party macro, and the
top-level Transform AWS::Include short form always leave Processed unexpanded.
SamTransformProcessor removes the whole Transform section unconditionally when the
template also declares the SAM transform, so any of those three shapes co-declared
with SAM is gone from Processed too; the sentence now states that condition.
Also drops the block comment above STAGE_PROCESSED/STAGE_ORIGINAL: it restated what
the constant names already show.
* docs(cloudformation): drop the CAPABILITY_AUTO_EXPAND deviation, measured as parity
A CreateChangeSet carrying an embedded Fn::Transform/AWS::Include was
accepted against a real account with CAPABILITY_IAM alone, so requiring
no capability for AWS::Include matches AWS rather than deviating from
it. The known-deviation count drops from three to two, and the
unmeasured CreateStack path is named as unmeasured.
---------
Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
|
||
|
|
f2b4c08481 |
fix(cloudformation): expand AWS::Serverless::StateMachine, and reject every unresolvable DefinitionUri on both StateMachine and HttpApi (#2885)
* test(cloudformation): pin AWS::Serverless::StateMachine expansion against the deployed template
The expected values come from a deployed stack's processed template, read with
get-template --template-stage Processed, and from change-set probes against real
AWS. Every assertion states its expected value as a literal.
* fix(cloudformation): expand AWS::Serverless::StateMachine into the native resource
The SAM transform switched on four resource types. A state machine fell through
the default arm, kept its AWS::Serverless:: type, and was stubbed by the
provisioner with a physical id of <logicalId>-<8 hex> and an attribute Arn of
arn:aws:stub:::<logicalId>. The stack reported CREATE_COMPLETE, ListStateMachines
was empty, and Fn::GetAtt on the resource handed downstream resources an ARN that
named no state machine.
Measured against a deployed stack, both template stages: 67 AWS::Serverless::StateMachine
in the original template, 67 AWS::StepFunctions::StateMachine in the processed one,
0 AWS::Serverless:: survivors. Eight properties are mapped on 67 of 67: Name to
StateMachineName, Type to StateMachineType, Role to RoleArn, DefinitionUri to
DefinitionS3Location, Logging to LoggingConfiguration, Tracing to
TracingConfiguration, DefinitionSubstitutions unchanged, and the Tags map to a list
of {Key, Value} with stateMachine:createdBy first. Every mapped value stays an
unevaluated intrinsic and tag values keep their JSON type. Metadata is carried
through, not synthesized: it is already present in the original template on 67 of 67.
Three further behaviours come from change-set probes against real AWS. A local
DefinitionUri does not raise an HTTP error: the change set is created with
Status FAILED, ExecutionStatus UNAVAILABLE, zero changes, and the transform's own
sentence in StatusReason. ExecuteChangeSet on that change set is refused with
InvalidChangeSetStatus. A DefinitionUri carrying ?versionId= is accepted and split
into a third field, Version.
* test(cloudformation): pin rejection of an intrinsic DefinitionUri on AWS::Serverless::StateMachine
An intrinsic DefinitionUri (Fn::Sub, Ref, ...) with no literal Bucket/Key
carries neither key, so samUriToS3Location passes it through unchanged and
the SAM transform accepts it silently. CloudFormation later collapses the
intrinsic into a TextNode and CloudFormationResourceProvisioner throws
"DefinitionS3Location requires Bucket and Key" at provisioning, one step
later than real AWS's own change-set-time failure.
* fix(cloudformation): reject an intrinsic DefinitionUri on AWS::Serverless::StateMachine
samUriToS3Location passes an object DefinitionUri through unchanged when it
carries neither Bucket nor Key, so an intrinsic value (Fn::Sub, Ref, ...)
reached DefinitionS3Location unresolved. CloudFormation then collapsed it
into a TextNode, and CloudFormationResourceProvisioner only caught the
missing Bucket/Key once provisioning started, one step later than real
AWS's own change-set-time failure.
expandServerlessStateMachine now accepts DefinitionS3Location only when it
resolves to a literal Bucket and Key, and rejects both the textual and the
object shape with the SAM transform's own wording, matching the FAILED
change set AWS reports for either.
Also drops the SamTransformProcessorTest case that pinned the old
pass-through behaviour for an intrinsic DefinitionUri (it asserted the
exact defect this fixes: the value surviving unsplit into
DefinitionS3Location) and adds a companion case for an object DefinitionUri
that names Bucket but not Key, closing the boundary the new guard leaves
otherwise untested.
* test(cloudformation): pin DefinitionUri rejection for a null Key, a non-string/object shape, and HttpApi
expandSamTemplate_stateMachineWithNullKeyDefinitionUriIsRejected and
expandSamTemplate_stateMachineWithArrayDefinitionUriIsRejected pin real AWS's rejection of a
DefinitionUri whose Key is an explicit null and of a DefinitionUri that is neither a string nor
an object (array, number, boolean); today's guard silently accepts both.
expandSamTemplate_httpApiWithIntrinsicDefinitionUriIsRejected replaces
expandSamTemplate_httpApiPreservesIntrinsicDefinitionUriForProvisioning:
both assert an HttpApi DefinitionUri with no literal Bucket/Key, but the one it replaces asserted
the value was preserved unresolved for the provisioner, a behaviour measured against real AWS
(us-east-1, create-change-set) to be wrong. AWS rejects it with the object-form wording, the same
one the StateMachine arm already carries.
samHttpApi_intrinsicDefinitionUriIsRejected replaces
samHttpApi_intrinsicDefinitionUriCreatesApiGatewayV2Routes: the test it replaces asserted the
opposite outcome, that routes were successfully created from a real spec uploaded to S3 and
imported through the intrinsic DefinitionUri, which real AWS does not accept for this shape.
expandSamTemplate_httpApiWithObjectDefinitionUriMissingKeyIsRejected and
expandSamTemplate_httpApiWithArrayDefinitionUriIsRejected pin the same two shapes on the HttpApi
arm; the array case is measured directly against real AWS via create-change-set.
* fix(cloudformation): reject every unresolvable SAM DefinitionUri, on both StateMachine and HttpApi
samUriToS3Location's object branch checked has("Bucket") && has("Key") on its own passthrough
copy of DefinitionUri, so a Key present as an explicit null (YAML's Key: with no value) counted
as resolved; and a DefinitionUri that was neither textual nor an object (array, number, boolean)
matched neither disjunct of the guard, so nothing was thrown and no definition was set at all.
Both callers now go through one guard, applyDefinitionUri: samUriToS3Location returns null
whenever it cannot produce a literal, non-null Bucket and Key, and applyDefinitionUri throws for
every non-null return with the wording definitionUriRejectionReason selects from the shape of
DefinitionUri, matching real AWS (measured against us-east-1 via create-change-set) for all three
JSON shapes. The predicate for "an S3 location is a Bucket and a Key" lives once, in
samUriToS3Location.
This also closes the split between the two callers: the HttpApi arm used to preserve an
unresolved DefinitionUri (an intrinsic, or an object missing Key) as BodyS3Location for the
provisioner to fail on later, or silently emit no definition at all for a non-object,
non-string DefinitionUri. It now rejects every one of those shapes at transform time, the same
as the StateMachine arm, matching AWS's own transform-time rejection (measured directly for the
array/number/boolean shape via create-change-set, not previously measured on this branch).
* test(cloudformation): pin the missing Definition/DefinitionUri mutual-exclusion cases
expandSamTemplate_stateMachineWithNeitherDefinitionNorDefinitionUriIsRejected and
expandSamTemplate_stateMachineWithBothDefinitionAndDefinitionUriIsRejected pin real AWS's
rejection (measured via create-change-set) of a StateMachine declaring neither Definition nor
DefinitionUri, and of one declaring both; today's expandServerlessStateMachine handles neither
case, emitting a definition-less resource for the first and a resource carrying both Definition
and DefinitionS3Location for the second.
expandSamTemplate_httpApiWithBothDefinitionBodyAndDefinitionUriIsRejected pins the equivalent
HttpApi rejection, with AWS's own reversed property order in the message; the else at
expandServerlessHttpApi's DefinitionBody check hides this shape today, always preferring
DefinitionBody with no error.
expandSamTemplate_httpApiWithLocalDefinitionUriIsRejected and
samHttpApi_definitionUriCreatesApiGatewayV2Routes are coverage additions, not new pins: both
pass unmodified against the previous commit's production code. The first mirrors the existing
expandSamTemplate_stateMachineWithLocalDefinitionUriIsRejected on the HttpApi arm, the most
common real shape (an unpackaged sam template) and previously untested there. The second
restores the only end-to-end proof that a literal s3://bucket/key DefinitionUri creates routes,
lost when an earlier commit on this branch replaced
samHttpApi_intrinsicDefinitionUriCreatesApiGatewayV2Routes with
samHttpApi_intrinsicDefinitionUriIsRejected.
* fix(cloudformation): enforce Definition/DefinitionUri mutual exclusion on SAM StateMachine and HttpApi
expandServerlessStateMachine copied Definition and resolved DefinitionUri independently, so a
StateMachine declaring both ended up with one native resource carrying both Definition and
DefinitionS3Location, and one declaring neither expanded to a resource with no definition at
all. Real AWS (measured via create-change-set, us-east-1) rejects both shapes before a single
resource is provisioned. expandServerlessHttpApi's DefinitionBody check silently preferred
DefinitionBody over DefinitionUri with no error when a resource declared both; AWS rejects that
too, naming DefinitionUri first, the reverse of the StateMachine wording.
Both arms now check presence of their two definition-source properties up front and share a
rejectBothDefinitionSources helper for the "not both" wording; the StateMachine arm additionally
rejects "neither". A neither-property HttpApi is left alone: measured against real AWS via
create-change-set, that shape is accepted and expands to an empty ApiGatewayV2 API, unlike the
StateMachine arm.
Renames applyDefinitionUri to resolveDefinitionUriOrThrow, naming the effect its old name left
unstated (it either sets the target property or throws), and inlines its lone-caller helper
definitionUriRejectionReason: the merged function stays a handful of decision points, well under
the cognitive-complexity budget, and reads as one "resolve or throw" unit instead of two.
Both callers now guard DefinitionUri's presence before calling resolveDefinitionUriOrThrow, so
its own absent/null guard, and the duplicate of the same guard at the top of samUriToS3Location,
were both unreachable; deletes both and rewrites the javadoc that claimed a caller-side check
already existed for the state machine arm, which it did not.
SamTransformProcessorTest fixture updates: four pre-existing StateMachine tests exercising
Metadata/DependsOn/Tags/intrinsic-property preservation declared neither Definition nor
DefinitionUri, a shape the new guard now rejects; each gains a minimal literal DefinitionUri so
its own assertions keep exercising what they always asserted.
* refactor(cloudformation): collapse rejectBothDefinitionSources booleans and duplicated presence checks
rejectBothDefinitionSources took two independent booleans read only as their
conjunction; because && is commutative, swapping them at a call site went
undetectable, while swapping the two property name strings would silently
reverse AWS's own wording. Both callers now pass the conjunction they already
compute, so the signature no longer promises a per-argument correspondence the
body never used.
copyRenamed and isPropertyPresent asserted the identical "not missing, not
null" presence check in two places; copyRenamed now delegates to
isPropertyPresent so the predicate lives once. expandServerlessStateMachine's
Definition copy re-tested a presence its own hasDefinition guard already
established; it now copies the already-known-present node directly.
Reworded the HttpApi DefinitionBody/DefinitionUri comment: "Neither X nor Y is
accepted too" read as its own opposite of the fall-through it documents, where
an HttpApi declaring neither property is accepted and still expands to a bare
AWS::ApiGatewayV2::Api and its default Stage.
Realigned two continuation lines that sat one column past their opening paren
to the file's own prevailing continuation style.
Behaviour-neutral: no assertion or error message changes.
* test(cloudformation): pin AWS::Serverless::Api DefinitionBody/DefinitionUri expansion
Pins the RestApi Body/BodyS3Location expansion an AWS::Serverless::Api's
DefinitionBody or DefinitionUri must produce, the rejection of a
local-path DefinitionUri, and that the declared Name survives a
DefinitionBody carrying a different info.title, all currently unmet.
* fix(cloudformation): materialize AWS::Serverless::Api DefinitionBody/DefinitionUri
expandServerlessApi carried only Name and Description onto the emitted
AWS::ApiGateway::RestApi, silently dropping a declared OpenAPI document
so the stack reached CREATE_COMPLETE with an API serving no method.
The transform now maps DefinitionBody to Body and DefinitionUri to
BodyS3Location, rejecting both together or a local-path DefinitionUri,
mirroring the AWS::Serverless::HttpApi arm. The REST API provisioner
resolves that document (renaming the ApiGatewayV2-only resolver into
resolveRestApiOpenApiDocument, now shared by both API Gateway
versions) and runs it through the existing putRestApi/applyOpenApiSpec
OpenAPI materializer, then re-applies the resolved Name since
putRestApi overwrites it from the document's info, which real AWS
does not do.
* test(cloudformation): pin AWS::Serverless::Api both-Definition rejection wording
Measured against real AWS, us-east-1, create-change-set: an Api
declaring both DefinitionBody and DefinitionUri is rejected with
DefinitionUri named first. Nothing pinned this sentence's property
order, so it could be transposed silently; rejectBothDefinitionSources
already enforces it, this only adds the missing regression test.
* refactor(cloudformation): rename ApiGatewayV2BodyS3Location to OpenApiBodyS3Location
parseOpenApiBodyS3Location now feeds both the ApiGatewayV2 and the
native/SAM ApiGateway RestApi provisioning paths; its return type kept
the V2-only name after the parser itself was renamed, leaving one
representation of an S3 body location claiming to be v2-only. No
behaviour changes, five sites in one file, all within this record's
own declaration and its own callers.
* test(cloudformation): pin AWS::ApiGateway::RestApi Body materialization outside SAM
A native RestApi's Body was ignored before the provisioner started
resolving it for AWS::Serverless::Api's DefinitionBody, since both
paths share provisionApiGatewayRestApi. Nothing covered the
hand-written-template shape; this pins that a declared Body's OpenAPI
document creates its resources and methods, not only a SAM-expanded
one.
* test(cloudformation): pin SAM Api Description reapply and DefinitionBody materialization together
samApi_declaredNameSurvivesDefinitionBodyTitle only proved the Name-reapply
line against a partial revert, so it passed even with the entire fix
reverted: a provisioner that never reads DefinitionBody at all trivially
never overwrites Name either. Renamed and rewritten so it also asserts the
declared Description survives putRestApi (which overwrites Description from
DefinitionBody's info exactly the way it overwrites Name) and that the
/hello method from DefinitionBody actually materializes, so a provisioner
that skips DefinitionBody cannot pass. Red against both production files
reverted to cbdebe10: item.path doesn't match, expected a collection
containing "/hello", actual [/].
* refactor(cloudformation): rename resolveRestApiOpenApiDocument to resolveOpenApiDocument
The method is also the OpenAPI-document resolver for AWS::ApiGatewayV2::Api
(reconcileApiGatewayV2BodyRoutes), never called for a RestApi in that path:
"RestApi" in the name reintroduces the exact naming defect commit 7da9a7c4
existed to fix. No caller or behavior changes.
* fix(cloudformation): reapply Description after putRestApi overwrites it from DefinitionBody
putRestApi overwrites both Name and Description from the DefinitionBody's
info, but only Name was re-applied afterward: an undeclared Name falls back
to the generated physical name (a text field, never null), while an
undeclared Description resolves to null, and Map.of rejects a null value,
so the previous single-entry patch could not carry a Description operation
at all. Reapplies both through a HashMap-backed replace op that allows null,
clearing an undeclared Description rather than leaving whatever putRestApi
last wrote. Narrows the comment above the reapply to what the create-
change-set probe actually measured (the processed template keeps Name and
Description separate from Body.info) rather than a runtime-preference claim
the probe never tested, since create-change-set never executes the change.
Isolated red (only the Description reapply removed, Name reapply and
materialization intact): item.find { it.name == '<apiName>' }.description
doesn't match, expected the declared description, actual
"description-from-document".
* style(cloudformation): drop em-dash from committed test comment
AGENTS.md:314 forbids an em-dash or en-dash on any added line, and CI does
not catch it. Comment text only, no assertion changes.
* refactor(cloudformation): extract shared DefinitionBody/DefinitionUri handling, fix stale docs
Extracts the identical DefinitionBody/DefinitionUri resolution (reject-both
check plus the Body/BodyS3Location assignment) duplicated between
expandServerlessApi and expandServerlessHttpApi into applyDefinitionSource,
called from both arms. Updates the four javadoc caller lists that named
expandServerlessHttpApi as the sole AWS::Serverless::Api-adjacent caller of
rejectBothDefinitionSources, samUriToS3Location and
resolveDefinitionUriOrThrow, now inaccurate with applyDefinitionSource as
the actual (shared) caller. Corrects the expandServerlessApi comment on an
Api declaring neither DefinitionBody nor DefinitionUri: AWS does synthesize
a default Body in that case, floci does not, and the comment now says so
while noting the runtime outcome (no method reachable) is the same either
way, rather than claiming AWS leaves Body unset.
No behavior change: both arms' existing tests pass unedited.
* docs(cloudformation): drop the corpus size from the state machine javadoc
The unhandled-properties note carried a count a reader cannot verify. State
what was measured instead.
---------
Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
|
||
|
|
7095641e25 |
fix(cloudformation): set Fn::GetAtt attributes the schemas declare (#2761)
* fix(cloudformation): set Fn::GetAtt attributes the schemas declare An attribute a provisioner never sets is invisible at runtime: GetAtt resolution returns the literal "LogicalId.Attr" when a resource has no such attribute, so a template referencing one receives that string as a value instead of failing. Auditing every migrated type against its registry schema found 24 such attributes across 15 types. Sets the three whose correct value is unambiguous: AWS::SNS::Topic gains TopicArn, the attribute aws-sns-topic.json actually declares. Arn stays alongside it, since templates written against earlier releases reference it. AWS::S3::Bucket gains DualStackDomainName, in the same form as the RegionalDomainName it already builds. AWS::CodePipeline::Pipeline gains Arn, which the schema describes as the pipeline's ARN and which is constructible from the region, account and name already in hand. The remaining 21 are recorded in getatt-attribute-gaps.tsv, each with a reason. Most are attributes Floci cannot set because it does not emulate the behaviour behind them, such as VPC CIDR associations or pipe lifecycle timestamps. A few are simply undecidable from the schema alone, and inventing a value would be worse than leaving the gap recorded. CfnSchemaCoverageTest makes the set a ratchet rather than a snapshot: closing a gap requires deleting its row, introducing one requires adding a row with a reason where a reviewer sees it, and a row that stops being real fails until it is removed. * test(cloudformation): await the async stack operations in the VPC gateway test The test asserted the results of CreateStack and DeleteStack immediately. Both are asynchronous: CloudFormationService submits them to a background executor and the HTTP call returns as soon as the work is queued, so each assertion only passed while the executor happened to win the race. The delete assertion lost that race on CI. Adding a test class elsewhere in the suite re-partitioned the deterministic CI shards, which moved this class to different neighbours and changed the timing it had been relying on. Both assertions now poll to a deadline, matching the awaitStackStatus pattern the other CloudFormation integration tests use. A genuinely unperformed detach still fails, just ten seconds later, so this removes the timing sensitivity without hiding a real regression. * fix(cloudformation): scope the GetAtt coverage scan per resource type The scan read each provisioner as a whole file, so a class serving several types credited every one of them with what any single arm sets. That is a false negative in the only direction that matters: the gap the ratchet exists to record stops being reported. It was hiding a real one. Ec2NetworkAclCfnProvisioner sets Id for NetworkAcl and never for NetworkAclEntry, whose schema declares Id as its primaryIdentifier and sole readOnlyProperty, so Fn::GetAtt on it resolved to the literal "LogicalId.Id" while the audit reported clean. Set it to the composite physical id so the attribute agrees with Ref. The scan now walks the switch on getResourceType() in provision, takes each arm plus the same-class methods it transitively calls, and adds whatever provision writes outside the switch to every type, since that is the shared path. Two shapes need the care: - Only a switch in statement position is a dispatch. A switch expression such as `boolean ingress = switch (r.getResourceType())` picks a value on one shared path. Reading its arms as per-type paths reported SecurityGroupIngress and SecurityGroupEgress Id as gaps when both are set after the switch. - A class with a dispatch switch but no arm for a type it owns now fails the scan, so an unrecognised shape cannot quietly fall back to the class-wide reading it replaced. Raised by pgermosen in review. |
||
|
|
ab26a42096 | feat(cloudformation): provision Route 53 hosted zones (#2722) | ||
|
|
961d82dda9 | fix(cloudformation): provision AWS::Scheduler::ScheduleGroup (#2796) | ||
|
|
afa5960709 |
fix(docker): PortAllocator also checks ports other containers already publish on the host (#2805)
* fix(docker): PortAllocator also checks ports other containers already publish on the host isPortFree binds a ServerSocket in floci's own process, which is the container's network namespace when floci runs containerized: a host port another container already publishes via -p looks free, the allocation succeeds, and the sibling container's start then fails with 'port is already allocated'. allocate() now also consults the Docker API's view of published host ports before committing to a candidate. The DockerClient is optional: the no-arg constructor leaves it null and keeps every existing caller's behavior unchanged, and a Docker API failure is fail-permissive, matching isPortFree's posture. * perf(docker): snapshot the container list once per allocate() The per-candidate isPortBoundByAnyContainer check made one listContainersCmd() round-trip for every candidate that passed the cheap checks, serialized inside the lock every consumer of the shared allocator blocks on. allocate() now snapshots the published host ports once per invocation and checks each candidate against that set; the snapshot was only ever as fresh as the start of allocate() anyway. Fail-permissive posture unchanged: no client or a Docker API failure still skips the check entirely. |
||
|
|
3b7ba5c687 |
feat(batch): add UpdateComputeEnvironment and DeleteComputeEnvironment (#2857)
Mirrors the existing UpdateJobQueue/DeleteJobQueue pair. DeleteComputeEnvironment requires DISABLED state and rejects deletion while still referenced by a job queue's computeEnvironmentOrder, matching AWS; updating computeResources is a partial merge (only the sent fields change), not a full replace. Both UpdateComputeEnvironment and CreateComputeEnvironment now validate state is ENABLED or DISABLED, so an invalid value can never be persisted and later block deletion. CloudFormation stack-delete wiring for AWS::Batch::ComputeEnvironment/ JobQueue/JobDefinition (currently a silent no-op on stack teardown) is left for a follow-up that migrates all of Batch's CFN handling into a per-service provisioner, rather than adding more cases to the legacy switch. Closes #2293, closes #2803. |
||
|
|
906af8c632 |
feat(ec2): support standalone network interface create/attach/detach (#2843)
* feat(ec2): support standalone network interface create/attach/detach
CreateNetworkInterface returned UnsupportedOperation unconditionally,
blocking every root that attaches a standalone ENI: the attach-eni and
override-default-eni examples in terraform-aws-server, the with-elb
example in terraform-aws-asg, and vpc-blackhole-routes in
terraform-aws-service-catalog (floci-kt9 in the floci-harness compat
survey).
Adds CreateNetworkInterface, DeleteNetworkInterface,
AttachNetworkInterface and DetachNetworkInterface, backed by a new
standalone ENI store separate from the implicit primary interface each
instance already carries. DescribeNetworkInterfaces now merges both
without double-counting. RunInstances also accepts a pre-existing
standalone ENI as an instance's primary interface via
NetworkInterface.1.NetworkInterfaceId, the shape Terraform's
network_interface { network_interface_id = ... } block sends for
override-default-eni.
* fix(ec2): keep a standalone ENI's own record when it is attached
Review found two ways the attachment state ended up recorded on only one side.
AttachNetworkInterface updated the standalone ENI and stopped there, so
DescribeNetworkInterfaces reported an attachment that DescribeInstances denied —
and the device-index conflict check, which reads the instance's own interface
list, could never see anything this operation had attached: two interfaces could
take device index 1 on the same instance. The instance now carries the interface
too, and DetachNetworkInterface removes it again.
RunInstances took the opposite approach and deleted the standalone record,
leaving the interface represented only inside the instance. Terminating that
instance then made a caller-created ENI vanish -- InvalidNetworkInterfaceID.
NotFound rather than returning to "available" -- so it could not be reused. AWS
attaches a pre-existing interface with deleteOnTermination false precisely so it
outlives the instance. The standalone record is now kept and marked attached,
and terminate releases it; describeNetworkInterfaces skips the instance-side
copy of any id the standalone store owns, so it is still reported exactly once,
from the side that knows its real attach time and its deleteOnTermination.
Also braces a single-line conditional, per AGENTS.md.
* fix(ec2): release an ENI whose instance died without TerminateInstances
TerminateInstances is not the only way an instance reaches "terminated": a
container-backed launch that fails or is cancelled ends there asynchronously,
inside Ec2ContainerManager, which has no access to the interface store. An ENI
the launch had already marked in-use therefore stayed pinned to an instance that
no longer runs, and every later attempt to reuse it failed with
InvalidNetworkInterface.InUse.
Rather than chase each terminal transition, the attachment is reconciled when
the interface is next read: an attachment naming an instance that is gone or
terminated is cleared, and the interface reports "available" again. That covers
attach, launch, delete and describe through the one path they share.
* fix(ec2): let a dead instance release its copy of a reclaimed ENI
Releasing the standalone record alone left the terminated instance still
reporting the interface, so once the ENI was reused two instance records claimed
it and nothing in DescribeInstances picks a winner. Reclaiming now clears both
sides, and the unit test asserts the instance no longer lists it.
Also drops the em-dashes from the comments and docs this branch adds, per
AGENTS.md.
* fix(ec2): drop the instance's copy on the TerminateInstances path too
The previous commit fixed only the reclaim-on-read path. TerminateInstances
released the standalone record while leaving the mirrored interface on the
terminated instance, so reusing the ENI still produced two instance records
claiming it. Both paths now clear the instance's copy, and the integration test
asserts DescribeInstances no longer mentions the interface before the same ENI
is handed to a second launch.
|
||
|
|
7828ab2430 |
fix(docker): translate misleading disk-quota error for keyring exhaustion (#2797)
* fix(docker): translate misleading disk-quota error for keyring exhaustion crun/runc report the kernel session-keyring quota (kernel.keys.maxkeys) as "join keyctl ...: Disk quota exceeded", which reads as an actual disk-space problem. Under high concurrent container counts this is common on podman machine's default Fedora CoreOS sysctls (200 keys per uid), and sends operators looking in the wrong place. Both container-start call sites in ContainerLifecycleManager now go through a shared helper that recognizes this specific OCI runtime error and rethrows with the actual cause and the sysctl fix, leaving every other DockerException untouched. Fixes floci-io/floci#2243 * fix(docker): route the shared-volume init helper through the translated start path pgermosen review on PR #2797: initSharedVolumeRoot's helper container start bypassed the keyring-quota translation, so it still surfaced the raw, misleading "Disk quota exceeded" message when this specific start call hit the crun keyring error. The failure is caught as a plain RuntimeException by ensureSharedVolume's computeIfAbsent and only logged, never rethrown, so this exact call site's routing is what decides which message ends up in that log line. startContainer is now package-private so the new test can verify this call site actually invokes it (via a spy), since the swallowed exception itself is not observable from ensureSharedVolume's public contract. |
||
|
|
bed27043ef |
fix(ec2): report a NAT gateway's addresses, not just its allocation id (#2892)
* fix(ec2): report a NAT gateway's addresses, not just its allocation id CreateNatGateway and DescribeNatGateways returned natGatewayAddressSet entries carrying an allocationId and nothing else. Real AWS also returns publicIp, privateIp, networkInterfaceId, associationId and status, and aws_nat_gateway exposes the first three as resource outputs -- Gruntwork's VPC modules re-export nat_gateway_public_ips from them, so the omission does not stop at a diff, it propagates empty values into every module downstream. A gateway now gets an interface in its subnet with a private address from the same allocator instances use, and a public one additionally reports the Elastic IP it was created with and an association id for it. A private gateway has no Elastic IP, so it reports neither publicIp nor associationId, which is what AWS returns for one. The addresses are stored on the gateway rather than derived at serialization time, so the private address and interface id stay put across reads instead of changing under a client that refreshes. A gateway restored from a store written before this change has no address list but still knows its allocation id, and reports that much rather than an empty set. * fix(ec2): refuse an Elastic IP on a private NAT gateway ConnectivityType=private with an AllocationId was accepted, and the response then reported a public IP and an association on a gateway that has no route to the internet and nothing to attach one to. AWS refuses the combination, so this does too, before the allocation is looked up or any address is minted. Also drops the em-dashes from this branch's comments, per AGENTS.md. |
||
|
|
0cf3144f5e |
feat(ec2): honour AmazonProvidedIpv6CidrBlock on a VPC (#2891)
* feat(ec2): honour AmazonProvidedIpv6CidrBlock on a VPC CreateVpc ignored the parameter, and no response carried an ipv6CidrBlockAssociationSet at all, so aws_vpc's assign_generated_ipv6_cidr_block never converged: Terraform asks for a block, reads none back, and plans the same change on every run. CreateVpc and AssociateVpcCidrBlock now both accept AmazonProvidedIpv6CidrBlock -- the provider uses the first when the flag is set at create and the second when it is turned on for an existing VPC, so implementing only one would fix half the configurations. The block is a /56 out of Amazon's pool, which is Amazon's to choose and not something a caller can predict; what a client depends on is that one comes back at all and that it is stable across reads. IPv6 associations are kept in their own set rather than joining cidrBlockAssociationSet: AWS keeps the two apart, with different member names inside each, and a client reading the IPv4 set must not find IPv6 blocks there. DisassociateVpcCidrBlock takes an association id from either set, as AWS does -- it never asks which family the id belongs to. Subnet-level IPv6 (Ipv6CidrBlock on CreateSubnet) is deliberately out of scope; this is the VPC-level association only. * style(ec2): drop em-dashes from the IPv6 association comments AGENTS.md forbids them anywhere; commas and colons instead. |
||
|
|
e8eb4f2ff0 |
feat(cloudwatch): implement the dashboard operations on both protocols (#2888)
* feat(cloudwatch): implement the dashboard operations on both protocols
CloudWatch served no dashboard operations at all, so terraform-aws-monitoring's
cloudwatch-dashboard example failed on apply with "api error UnsupportedOperation:
Operation PutDashboard is not supported by CloudWatch Query" - the Query
handler's default branch, reached because PutDashboard had no case.
Adds PutDashboard, GetDashboard, ListDashboards and DeleteDashboards, backed by
a new CloudWatchDashboardsService. Dashboards are pure metadata: the
DashboardBody is stored opaquely and returned verbatim, matching AWS. Put
overwrites an existing name, Get on a missing name is ResourceNotFound,
ListDashboards honours DashboardNamePrefix, DeleteDashboards checks every name
before deleting any so it is all-or-nothing, and responses carry DashboardArn.
Both CloudWatch protocols are wired, since which one a caller uses depends on
its SDK: the Terraform provider sends the Query protocol (form-encoded Action,
routed by credential scope through AwsQueryController), while the AWS CLI and
SDK v3 send JSON 1.0 with X-Amz-Target: GraniteServiceVersion20100801.*, routed
by AwsJsonController. The monitoring service descriptor already declared both,
so no new dispatch was needed - only the four cases in each handler, plus the
new action names in AwsQueryController's CLOUDWATCH_ACTIONS so the no-auth
action-inference path resolves them to CloudWatch too.
* fix(cloudwatch): reject a dashboard body that is not a JSON object
PutDashboard checked only that a body was present, so a malformed document was
stored and answered with success. AWS parses the body and returns
InvalidParameterInput, and the difference matters: a client that sends broken
JSON otherwise learns nothing until the dashboard renders as nothing.
The body is still stored and returned verbatim; this validates that it parses
and is an object, and does not inspect what is inside it.
* fix(cloudwatch): reject a dashboard body with trailing content
readTree stops at the end of the first value, so a body of "{} and then some"
validated as the leading object and the rest was dropped, storing a document AWS
rejects. FAIL_ON_TRAILING_TOKENS makes the reader require exactly one document.
* fix(cloudwatch): make DeleteDashboards best effort, as AWS documents it
The all-or-nothing behaviour was backwards. AWS says the opposite, verbatim: "If
there is an error during this call, the operation attempts to delete as many
dashboards as possible." Deleting ["a", "missing"] where a exists removes a and
errors on missing; this removed neither, so a caller retrying with the same
batch made no progress.
Every name is now attempted, including ones after the first miss, and the first
missing name is reported afterwards. Whether a missing name errors at all is the
part that stays uncertain: DeleteDashboards' own Errors list does not name
ResourceNotFound the way GetDashboard's does, which hints at a silent skip
without establishing one, so the error is kept as the conservative reading.
* feat(cloudwatch): support PutDashboard's Tags, and tag ops on a dashboard ARN
Tags were accepted and dropped, which is the failure mode this emulator is meant
not to have. They are now stored on the dashboard, and CloudWatch's own tag
operations reach it: ListTagsForResource, TagResource and UntagResource take one
ARN for every taggable resource CloudWatch owns, so both protocol handlers route
a dashboard ARN to the dashboards service instead of the alarm store that
answered before.
Tags apply on create only, as AWS documents. A Put that replaces an existing
dashboard keeps the tags that dashboard already had, so an update cannot retag a
resource sideways through an operation that is not a tag operation. More than 50
tags is refused.
|
||
|
|
3a212d8360 |
fix(s3): shrink getObject's lock to a cheap seqlock check, not the I/O (#2901)
|
||
|
|
9bf93b94c2 |
fix(elbv2): drop access logs from a Gateway Load Balancer's attributes
Only deletion_protection.enabled and load_balancing.cross_zone.enabled are supported by every load balancer type; access_logs.s3.* is an Application and Network Load Balancer attribute. Adding it unconditionally handed a Gateway Load Balancer a schema AWS never returns for one, which is as wrong as omitting a key that does belong. |
||
|
|
910e64e726 |
fix(elbv2): report the attribute defaults, not only what was modified
DescribeLoadBalancerAttributes and DescribeTargetGroupAttributes answered with an empty list for a resource nobody had modified: a key appeared only once something had explicitly set it. AWS always returns the full set, and a key is absent only when the resource type does not have it. The Terraform provider reads these on every refresh, into aws_lb's idle_timeout, enable_http2, enable_deletion_protection and access_logs, and into aws_lb_target_group's stickiness, deregistration_delay and load_balancing_algorithm_type, so an empty list left every one of them a permanent diff on every ALB and NLB. Which keys apply is decided the way AWS decides it, by load balancer type and target group protocol rather than one flat list: an NLB has no idle timeout, an ALB has no proxy protocol, a Lambda target group has neither. Stored values win over defaults, so a modified key still reports what it was set to. An existing test pinned the old behaviour by asserting the modified key was the only one returned; it now asserts that key is among the set, which is what it was really trying to establish. |
||
|
|
10192f05d5 |
feat(translate): add Amazon Translate mock service (#2879)
* feat(translate): add Amazon Translate mock service JSON 1.1 stub for Amazon Translate covering the three self-contained sync operations: TranslateText, TranslateDocument, ListLanguages. Follows the existing Comprehend/Textract stub pattern (stateless, echoes input, AI_MOCK_CONFIG override for TranslateText). - TranslateText echoes Text, enforces the 10,000-byte limit, allows any language pair; an auto source is reported back as en. - TranslateDocument echoes the base64 Content and enforces the English-pivot rule, the ContentType allow-list, valid base64, and the 100 KB cap (InvalidRequestException, matching the operation's error model). The encoded length is checked before decoding so an oversized payload cannot force a large allocation. - ListLanguages returns a fixed ~35-language catalog; DisplayLanguageCode is validated, pagination inputs are accepted but ignored. Untrusted request values are truncated before being echoed into error messages. * chore(translate): remove em-dashes per AGENTS.md style guide Replace em-dashes in the Translate doc page and Java comments with colons, commas, or periods, and the ellipsis in the error-message preview helper with "...". Addresses the Greptile review note on PR #2879. |
||
|
|
c32f8b5a24 |
fix(ec2): place a subnet in the zone its request names, not always az1 (#2890)
* fix(ec2): place a subnet in the zone its request names, not always az1 CreateSubnet never read AvailabilityZoneId, and hardcoded every new subnet's zone id to the region's first zone. Two consequences, and the second bites even a caller that never mentions a zone id: a subnet asked for us-east-1-az2 came back in us-east-1-az1, and a subnet placed correctly by zone *name* still reported az1, contradicting its own availabilityZone. Anything that selects subnets by zone id therefore saw one zone -- Terraform's aws_subnet.availability_zone_id, and any client that pairs subnets against the DescribeAvailabilityZones list it just read. AvailabilityZoneId is now honoured, and the zone id is derived from the zone rather than fixed. The derivation is the mapping DescribeAvailabilityZones and the seeded default subnets were already using independently; all three now come through one helper, so a subnet's zone id agrees with the zone list by construction instead of by coincidence. A zone and a zone id that disagree are refused with InvalidParameterCombination rather than silently resolved to one of them -- Terraform's aws_subnet forbids setting both, so a request carrying both contradictory values is a bug in the caller, not something to guess at. A malformed zone id is refused too. * fix(ec2): refuse a zone id this region does not publish The first version resolved any well-formed zone id, so us-east-1-az4 created a subnet in a zone DescribeAvailabilityZones does not list. That is the same inconsistency the hardcoded az1 produced, only quieter: a client pairing subnets against the published zone inventory still cannot resolve the subnet's zone. The three modelled zones are now one constant that DescribeAvailabilityZones, the seeded default subnets and this validation all read, so they cannot drift, and the error names the range rather than only rejecting. Also logs the tolerated NumberFormatException instead of swallowing it, and drops this branch's em-dashes, both per AGENTS.md. |
||
|
|
2a637d3e05 |
fix(apigatewayv2): provision integration, route and stage on quick create (#2877)
* fix(apigatewayv2): provision integration, route and stage on quick create CreateApi's `target` parameter (quick create) was accepted but silently ignored: no AWS_PROXY integration, no "$default" route, and no "$default" stage were ever created. Without a stage, ApiGatewayExecuteApiHostFilter.stageExists() throws "Stage not found", the filter returns without rewriting the request, and it falls through to whichever other virtual-hosted-style filter claims the host next (S3's, in the common case) instead of reaching the API. Provision the AWS_PROXY integration, "$default" route, and auto-deploy "$default" stage that real API Gateway creates for quick create, using the existing createIntegration/createRoute/createStage helpers. Fixes #1902 * fix(apigatewayv2): use HTTP_PROXY for HTTP URL quick-create targets Quick create hardcoded AWS_PROXY regardless of target shape, so an HTTP URL target got routed through Lambda ARN parsing and failed invocation instead of reaching the configured endpoint (spotted by review). Detect the target kind (arn: prefix vs HTTP URL) and pick AWS_PROXY/POST or HTTP_PROXY/ANY accordingly, matching real API Gateway's quick-create behavior. Also drop the em-dashes from the new comment and Javadoc per AGENTS.md's style rule, and split the single test into one covering each target kind. --------- Co-authored-by: Karan-Tekuncorked <karan@tekuncorked.com> |
||
|
|
2bf9b57bd9 |
fix(lambda): omit Environment when no variables are set (#2838)
* fix(lambda): omit Environment when no variables are set
Real AWS omits the Environment member entirely from CreateFunction,
GetFunction, GetFunctionConfiguration and ListFunctions responses when a
function has no environment variables. Floci always emitted it, as an
empty object.
The Terraform provider reads a present-but-empty Environment back as an
environment {} block in state, so any function declared without variables
plans a removal on every run and never converges. On Lambda@Edge, where
environment variables are not permitted at all, the block can never
legitimately exist and each no-op apply also republishes the function.
Layers, KMSKeyArn, FileSystemConfigs and VpcConfig in the same response
builder already omit-when-empty; Environment was the outlier.
* test(compat): correct Environment assertions to match live AWS
Three assertions in the Python and Java SDK compatibility suites required
an Environment block that real AWS does not send:
- test_get_function_configuration_environment_always_present
- test_update_environment_variables_round_trip (the cleared case)
- LambdaFunctionConfigTest.getFunctionConfigurationHasDefaults
Measured against the live service in both directions: a function created
without variables comes back with no Environment member, and clearing to an
empty Variables map removes it again. The tests encoded Floci's previous
behaviour rather than the API's, which is why they went green.
Also corrects the wording of the Java clear case. It sends an Environment
with no Variables member, which is 'leave unchanged', not 'clear' — live AWS
keeps the existing variables, as Floci already did. The assertion now pins
that instead of describing a clear that never happened.
|
||
|
|
db182b3048 |
fix(efs): implement UpdateFileSystemProtection and report protection on describe (#2842)
A file system's replication overwrite protection was missing in two ways that
compound: the operation that sets it did not exist, and the field that reports
it never reached the wire.
UpdateFileSystemProtection had no route, so the terraform AWS provider's PUT to
/2015-02-01/file-systems/{id}/protection fell through to the S3 handler and came
back as an XML error body, which the SDK reported as "deserialization failed,
invalid character '<'". Every consumer of gruntwork's terraform-aws-data-storage
EFS module hits this rather than only those who opt in, because the module emits
the aws_efs_file_system `protection` block unconditionally.
Separately, protection was never reported. createFileSystem left the field null,
and FileSystem's accessor was named getFileSystemProtectionDescription() -- the
*shape* name. Under UpperCamelCaseStrategy the accessor name is the JSON key, so
even a populated field would have gone out as FileSystemProtectionDescription
rather than the member name FileSystemProtection that FileSystemDescription
actually declares.
So:
- add UpdateFileSystemProtection (PUT .../{FileSystemId}/protection), returning
FileSystemProtectionDescription, 404 for an unknown file system
- default new file systems to ENABLED, which is what AWS documents
- apply that default on read as well, so file systems in a store written before
protection was modelled describe the same as one created today
- rename the accessor to getFileSystemProtection()/setFileSystemProtection()
Authority: efs/2015-02-01/service-2.json -- operations.UpdateFileSystemProtection,
shapes.FileSystemDescription.members.FileSystemProtection.
Verified three ways: EfsIntegrationTest 13/13; a real AWS SDK round trip
(create -> describe reports ENABLED -> update DISABLED -> describe reports
DISABLED), which only passes if the wire names match the model; and
terraform-aws-data-storage/examples/efs, previously FLOCI_UNIMPLEMENTED at
apply, now OK through destroy.
|
||
|
|
14f99a5123 |
feat(ec2): support VPC peering connections (#2654)
* feat(ec2): support VPC peering connections CreateVpcPeeringConnection was entirely unimplemented, returning UnsupportedOperation and blocking all three VPC-peering examples in terraform-aws-vpc (vpc-peering, vpc-peering-cross-accounts, vpc-peering-external). Adds CreateVpcPeeringConnection, AcceptVpcPeeringConnection, DescribeVpcPeeringConnections, ModifyVpcPeeringConnectionOptions and DeleteVpcPeeringConnection, matching the resources those examples actually use (aws_vpc_peering_connection, aws_vpc_peering_connection_accepter, aws_vpc_peering_connection_options). Connections start pending-acceptance and only move to active via an explicit accept, same as real AWS; Terraform's auto_accept convenience is provider-side, not API-side, so no same-account special-casing is needed here. CreateRoute now also accepts VpcPeeringConnectionId as a target and reports it back on DescribeRouteTables - every one of the three examples routes traffic through the peering connection via aws_route, and without this the provider would see permanent drift on the route resource it just created. * fix(ec2): enforce cross-account peering identity and fix route target bugs Addresses Greptile's 0/5 review of #2654: - AcceptVpcPeeringConnection now resolves the connection across every account's storage partition (findAnyAccountEntry, same pattern as Ec2IpamService's RAM-shared IPAM lookups) and rejects a caller that is not the connection's accepter, instead of only ever finding a connection the accepting account itself created. - DescribeVpcPeeringConnections, ModifyVpcPeeringConnectionOptions and DeleteVpcPeeringConnection get the same cross-account resolution, and Describe now filters to connections visible from the caller's account and region instead of leaking every account's connections in every region. - CreateRoute rejects a VpcPeeringConnectionId combined with another target, matching the existing EgressOnlyInternetGatewayId check. - ReplaceRoute accepts VpcPeeringConnectionId as a target, so a peering route created by CreateRoute can actually be repointed. Adds a cross-account integration test covering acceptance identity, region-scoped visibility, and the two route-target fixes. * fix(ec2): record the actual caller as peering requester, enforce region on mutations Two more issues from Greptile's re-review of #2654: - CreateVpcPeeringConnection recorded requesterVpcInfo.ownerId as the emulator's configured default account rather than the account that actually made the request. A non-default requester could never describe, modify or delete its own connection, while the unrelated default account was treated as the requester and granted those operations. Same fix applied to the accepter-owner fallback when PeerOwnerId is omitted (same-account peering). - AcceptVpcPeeringConnection, ModifyVpcPeeringConnectionOptions and DeleteVpcPeeringConnection now enforce the same regional-visibility invariant Describe already did: an endpoint in a region belonging to neither side of the connection reports it as absent instead of acting on it. Extends the cross-account integration test to cover both: the actual requester managing its own connection while the default account cannot, and mutations issued from an unrelated region being rejected. * fix(ec2): enforce per-endpoint ownership on ModifyVpcPeeringConnectionOptions Greptile's third pass on #2654: a participant that is legitimately part of a connection could still set the *other* side's DNS-resolution option, e.g. the requester setting AccepterPeeringConnectionOptions. AWS scopes each option block to that side's own VPC owner, not to participation in the connection generally. ModifyVpcPeeringConnectionOptions now checks the caller against the specific side's owner for whichever option block(s) the request actually sets, and rejects a cross-endpoint attempt with OperationNotPermitted. Adds a test covering both directions (requester setting the accepter's option and vice versa). * fix(ec2): resolve the peer VPC's real owner instead of trusting PeerOwnerId Greptile's fourth pass on #2654: CreateVpcPeeringConnection recorded the requester-supplied PeerOwnerId as the accepter's identity without checking it against the peer VPC's actual owner. Since AcceptVpcPeeringConnection authorizes against that recorded value, a requester could name another account's real VPC while claiming itself (or anyone) as PeerOwnerId and self-authorize acceptance of a connection it doesn't actually control. The peer VPC is now resolved across every account's partition, same as a peering connection's own id lookup. When it's known locally, that storage partition is authoritative and overrides any conflicting PeerOwnerId; the claim is trusted only for a genuinely external/cross-account peer this store never seeded, where there's nothing to validate against. Adds a test creating the peer VPC under a real "victim" account and confirming the forging account can't accept the connection while the real owner can. * fix(ec2): take the per-connection lock in DeleteVpcPeeringConnection Greptile's fifth pass on #2654: accept and modify already synchronized on lockFor(vpcPeeringConnectionId) before loading and saving the connection, but delete did not take that lock at all. A delete could run between one of those mutations' load and its unconditional save, and that save would resurrect the row delete just removed. Wraps delete's lookup, visibility check, and removal in the same lock. * fix(ec2): surface peeringOptions in VPC peering connection responses CreateVpcPeeringConnection, AcceptVpcPeeringConnection, and DescribeVpcPeeringConnections never echoed the DNS-resolution setting under requesterVpcInfo/accepterVpcInfo, even though it's a real field there in AWS's own examples. ModifyVpcPeeringConnectionOptions stored it correctly, but Terraform's aws_vpc_peering_connection_options resource reads the value back via Describe on every plan, not by re-issuing Modify, so a config setting DNS resolution would show permanent drift. Flagged in review: https://github.com/floci-io/floci/pull/2654#pullrequestreview-5054115075 * fix(ec2): reject a peer VPC named with the wrong PeerRegion CreateVpcPeeringConnection resolved the peer VPC only within the region the requester supplied, and treated a miss as "external peer, trust PeerOwnerId". That left the ownership forgery closed on the previous commit reachable again: name another account's real VPC, point PeerRegion at a region that VPC is not in, and the requester's own claimed PeerOwnerId is recorded unchallenged -- after which AcceptVpcPeeringConnection authorizes the requester against it. Real AWS resolves the peer VPC globally and answers InvalidVpcID.NotFound when the named region is not the one it lives in, so a lookup miss now falls back to trusting PeerOwnerId only when the id is absent from every region. A genuinely external peer VPC -- one this emulator has never seen -- behaves as before. |
||
|
|
b4aab999f7 |
fix(s3): make GetObject atomic against concurrent same-key overwrites (#2874)
* fix(s3): make GetObject atomic against concurrent same-key overwrites
A GetObject racing PutObject overwrites of the same key could return a
torn response assembled from two object versions: Content-Length, ETag,
and checksum headers from one version with body bytes from another.
When the newer body was longer than the advertised Content-Length, the
surplus bytes stayed on the wire and corrupted the keep-alive
connection's HTTP/1.1 framing (clients then log "Unsolicited response
received on idle HTTP channel", and the next request on that pooled
connection breaks). AWS S3 gives a concurrent read exactly one complete
version, never a mix.
Two gaps combined into the tear:
- S3Service.getObject read metadata and data as two unlocked reads,
while writers install them as two separate stores (objectStore, then
writeFile) under the bucket monitor. Take the same monitor around the
read pair so it can never straddle a write.
- S3Controller resolved response headers from a headObject snapshot but
streamed the body lazily at entity-write time via openObjectStream,
re-reading whatever data the key held by then. Serve both the full
and Range responses from the byte[] captured atomically with the
metadata, and fail loudly if a snapshot's data ever disagrees with
its declared size instead of corrupting the response framing.
The website index path now uses getObject so the served snapshot
carries its matching body as well.
Regression test: S3ConcurrentWriteReadTest#
concurrentOverwriteNeverPairsMetadataWithAnotherVersionsBody alternates
two fixed bodies of different lengths under concurrent readers and
asserts every read returns one complete version whose size and ETag
match its bytes. It fails on the previous code within seconds
("declared size=300 but body has 256 bytes") and passes with the fix.
Verified end-to-end with an AWS SDK Go v2 raced GET/PUT reproduction:
torn bodies, CRC checksum mismatches, and unsolicited-response warnings
on floci/floci:1.7.0; zero across 4 runs (~900k reads) on the patched
build. S3 suite: 1070/1070 green.
Change-Id: I4f4dbef49d85e0cdf13aaaca66dc8592db0fbed0
Signed-off-by: Thomas Kosiewski <tk@coder.com>
* fix(s3): serve conditional GETs and website requests from one snapshot
Review follow-ups on the torn-GET fix:
- Conditional GETs evaluated If-Match/If-None-Match/If-(Un)Modified-Since
against a separate headObject fetch and then served a later getObject
snapshot, so an overwrite landing between the two could return a
version the precondition never approved. Preconditions are now
evaluated against the same atomic snapshot that is served, making the
decision and the returned version consistent by construction.
- Website HEAD requests loaded the index document's bytes only to
discard them (headOnlyResponse strips the entity). The website
resolution carries metadata only again; the controller fetches the
atomic metadata+body snapshot just for GET renders, and HEAD builds
its headers without touching the data. Shared response-header
construction is extracted into objectResponseHeaders.
Change-Id: Ia116b6c6886febfde2bdabe3b4e2b4695617ab4f
Signed-off-by: Thomas Kosiewski <tk@coder.com>
---------
Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
||
|
|
46283f3209 | fix(rds-data): fixing empty array response from statement (#2880) | ||
|
|
19013b8b63 |
fix(ecs): apply cluster settings given on CreateCluster (#2845)
handleCreateCluster read clusterName and tags and nothing else, and EcsService.createCluster had no settings parameter, so settings sent at creation were dropped. Real AWS accepts them on CreateCluster itself, not only through UpdateClusterSettings, and handleUpdateClusterSettings two methods away already parses them the right way. The effect was permanent drift for any client that configures a cluster at creation. terraform-provider-aws sends its setting block on create, then reads DescribeClusters back without it and proposes the same change on every plan after apply, forever. Parse settings in the handler the way the update handlers do, and pass them through a new createCluster overload. The existing overloads delegate, so the CloudFormation caller is untouched. Closes #2806 |
||
|
|
90d1a19310 |
fix(elasticache): report transit encryption, not the auth-token flag (#2844)
TransitEncryptionEnabled was serialized as `authMode == PASSWORD` in both the replication-group and the member-cache-cluster views. An auth token does force encryption in transit, but the reverse does not hold: CreateReplicationGroup already accepts TransitEncryptionEnabled=true with no token and records it as AuthMode.IAM, and every read then reported that group as unencrypted in transit. Terraform's aws_elasticache_replication_group reads transit_encryption_enabled back on every plan, so such a group showed permanent drift. DescribeCacheClusters had a second, narrower version of the same problem: AtRestEncryptionEnabled was a hardcoded false on the member view, so it contradicted DescribeReplicationGroups about one group's own storage encryption. It now reports what the group stores, which is the value CreateReplicationGroup already parsed and kept. |
||
|
|
ca4c84c9e0 |
fix(lambda): delete only the named version when DeleteFunction has a Qualifier (#2824)
* fix(lambda): delete only the named version when DeleteFunction has a Qualifier DeleteFunction accepted a Qualifier and dropped it: the controller never bound the query parameter, so every call took the unqualified path and removed the function, $LATEST and every other version. A caller pruning one old version silently lost the whole function, with a success response and no warning. The qualified path now removes that version alone. Error behaviour follows the live service rather than the reference, which documents none of it: deleting $LATEST by qualifier and naming an alias are both InvalidParameterValueException, a version an alias references is a ResourceConflictException, and a version that does not exist is a silent success rather than a 404. Closes #2819 * test(lambda): cover qualified DeleteFunction through the AWS SDK The integration test drives the endpoint over raw HTTP, so nothing exercised the qualified delete through a real SDK client. Adds SDK coverage for the four cases: deleting one version leaves the function and its other versions, $LATEST cannot be deleted by qualifier, a version an alias references is refused, and an absent version is a no-op. * fix(lambda): pattern-validate the DeleteFunction qualifier Character.isDigit accepts non-ASCII decimal digits, so a full-width or Arabic-Indic digit was read as a version number and answered with a silent 204 instead of being rejected. The live service pattern-validates the qualifier before anything else and its constraint is ASCII-only; that check now runs first, and the digit test no longer relies on Character.isDigit. |
||
|
|
7473c57720 |
fix(ses): return DeliveryOptions from v1 DescribeConfigurationSet (#2841)
PutConfigurationSetDeliveryOptions already persisted the TLS policy — v2 GetConfigurationSet returned it correctly — but the v1 projection never read it back, omitting the DeliveryOptions member even when deliveryOptions was named in ConfigurationSetAttributeNames. The Terraform provider reads aws_ses_configuration_set through the v1 DescribeConfigurationSet, so the missing member made every plan re-add a delivery_options block that apply never converged. The two APIs spell the enum differently and the write path already normalises v1 Require/Optional to the stored REQUIRE/OPTIONAL; the read path converts back, so each API answers in its own casing. |