mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 18:18:02 -05:00
36c8396f259809307e4a84e66e367e2b9fe4cfd1
199
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
569f9f55e4 |
perf(build): replace quarkus-jdbc extensions with plain JDBC drivers (#3465)
* perf(build): replace quarkus-jdbc extensions with plain JDBC drivers The RDS Data API and Redshift Data API open connections with DriverManager. They never used Agroal, Narayana or the datasource layer that quarkus-jdbc-mysql and quarkus-jdbc-postgresql pull in. Depend on mysql-connector-j and postgresql directly and hand-supply the native image config the extensions provided. * perf(build): cut unused JDBC driver paths from the native image Substitute driver code that cannot be reached against the databases Floci provisions, mirroring what quarkus-jdbc-mysql did for JMX and going a step further for authentication and multi-host URLs. * perf(build): keep the MySQL cleanup thread disabled in JVM mode quarkus-jdbc-mysql set com.mysql.cj.disableAbandonedConnectionCleanup at startup in JVM mode as well as at native build time. The first commit carried only the native build argument and a surefire copy, so quarkus:dev and the JVM Docker image started Connector/J's abandoned connection cleanup thread on the first MySQL Data API call. In dev mode that thread is recreated with every restart and pins the old classloader. * fix(rdsdata): reject PostgreSQL result types the Data API does not support Aurora PostgreSQL answers a result set that holds a point, interval, money, box, circle, line, lseg, path or polygon column with UnsupportedResultException and the message "The result contains the unsupported data type POINT." Floci returned the driver's toString of the value instead. Check the column type names before reading the rows and raise the same error. json and jsonb stay supported, and a column cast to text still reads as a string, which is the workaround AWS documents. * perf(build): drop the PGobject reflection entries pgjdbc builds point, interval, money and the geometric types through reflection only when a result set holds such a column. The Data API now rejects those columns before reading a row, and json and jsonb values are plain PGobject instances the driver creates directly, so none of the ten entries can be reached. * chore(rdsdata): name the tolerated ClassNotFoundException in OpenTelemetryUnavailable * perf(build): keep PGInterval registered for the Redshift Data API Redshift tables can hold INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND columns and the Redshift Data API returns them as strings. Floci serves that path from a PostgreSQL container through pgjdbc, which builds an interval value by reflection, so the entry stays. The Redshift Data compat test now reads two interval columns on the native image. * perf(build): keep the geometric reflection entries for the Redshift Data API Redshift refuses point, box, circle, lseg, path and polygon as column types but evaluates them in a select, and its Data API returns the values as strings, checked on a real ra3.large cluster. Floci serves that path through pgjdbc, which builds those values by reflection, so the six entries stay. line stays out because Redshift rejects it, and money never reaches PGmoney because pgjdbc reads it as a double. The Redshift Data compat test selects those expressions and expects the strings Redshift returned. JdbcDriverNativeSupportTest resolves every registered class name. * fix(redshiftdata): fail statements that produce line, json or jsonb like Redshift Redshift has none of these types. A select that names one fails with "ERROR: type "line" not yet implemented" or "ERROR: type "json" does not exist", checked on a real cluster. The PostgreSQL container behind Floci's Redshift evaluates them, so the Data API now checks the result column types and fails the statement with the same text. |
||
|
|
e5bd8be405 |
feat(redshift): provision AWS::Redshift::Cluster through CloudFormation (#3427)
* feat(cloudformation): provision AWS::Redshift::Cluster (create path) * feat(cloudformation): AWS::Redshift::Cluster update and replacement * feat(cloudformation): force replacement on Redshift cluster createOnly property change * feat(cloudformation): force replacement on Redshift cluster DBName change * feat(cloudformation): provision Redshift parameter, subnet and security groups * chore(cloudformation): register Redshift provisioner in inventory and docs * test(cloudformation): end-to-end AWS::Redshift::Cluster stack * docs(redshift): document CloudFormation cluster provisioning * test(cloudformation): assert ClusterSubnetGroupNotFound error code on subnet group deletion * fix(cloudformation): correct attribute handling for Redshift security group provisioning * fix(cloudformation): apply Redshift parameter group Parameters and fix docs ClusterParameterGroup silently dropped Properties.Parameters on both create and update instead of calling ModifyClusterParameterGroup, and did not replace the entity when Description or ParameterGroupFamily changed, even though AWS marks both as replacement properties. Also remove the Id GetAtt claim from the Cluster docs: neither the provisioner nor AWS's own schema expose it for AWS::Redshift::Cluster. |
||
|
|
55ada9b8a3 |
feat(cloudformation): provision the AppSync resource types (#3424)
Adds AppSyncCfnProvisioner, serving AWS::AppSync::GraphQLApi, GraphQLSchema, DataSource, FunctionConfiguration, Resolver and ApiKey. Without it a template's AppSync resources fall to the dispatcher's stub arm, which reports CREATE_COMPLETE while creating nothing and resolves Fn::GetAtt to the literal "LogicalId.Attr". Two things are not simple property mapping. The AppSync control plane is REST-JSON with camelCase members, so every property is lower-camelised on the way in, with DynamoDBConfig as the one member that does not follow the rule (it is dynamodbConfig). And schema creation is asynchronous: while it is PROCESSING every other call for that API is refused with a 409, so the GraphQLSchema resource waits for a terminal status before completing, as CloudFormation does. Also carries the service-layer changes the provisioner needs: a PIPELINE resolver reaches its data through pipelineConfig and names no data source, which createResolver refused outright; CreateFunction and UpdateFunction now keep the runtime a JS resolver declares; and UpdateFunction applies a new name, which a CloudFormation rename goes through. |
||
|
|
10becc593f |
feat(cloudformation): provision AWS::Lambda::Url (#3423)
A function URL in a template was falling to the stub arm, so a stack exported the literal string "LogicalId.FunctionUrl" in place of a URL and nothing was listening on it. The physical id is the FunctionArn the URL is attached to, the alias ARN when Qualifier names one, which is the registry schema's primary identifier and enough to address the config again since a qualified ARN parses back into function and qualifier. TargetFunctionArn and Qualifier are create-only, so an update that moves the URL creates against the new function and removes the one it displaced. |
||
|
|
126af73141 |
fix(ecs): enforce host-volume bind-mount safety fail-closed at register and run time (#3543)
* fix: enforce host-volume bind-mount safety fail-closed at register and run time Reject volumes[].host.sourcePath by default unless an operator opts in via floci.services.ecs.host-volume-roots or allow-unsafe-host-volumes. Block the Docker socket and any ancestor directory that contains it (/var/run, /run, /var) unconditionally, even with the unsafe flag set. Extract the check into HostVolumePolicy and enforce it again immediately before each bind mount in EcsContainerManager.startTask, not only once at RegisterTaskDefinition, to narrow the window for a swapped-in symlink and to cover task definitions persisted before this policy existed. * fix(ecs): protect the Docker socket Floci actually connects to The host-volume policy only blocked the literal /var/run/docker.sock and /run/docker.sock paths, so a task definition could bind-mount the daemon socket when Floci reached it through DOCKER_HOST or an active Docker context (Colima, OrbStack, Rancher Desktop, Podman). Resolve the daemon endpoint through the same DockerClientProducer path the Docker client uses and add its unix:// socket path to the protected candidates. The literal paths stay protected as defence in depth. |
||
|
|
d90cb23c23 |
refactor(cloudformation): move the SecretsManager types into per-service provisioners (#3530)
Moves AWS::SecretsManager::Secret and AWS::SecretsManager::SecretTargetAttachment out of the monolith switch. The logic is carried over intact. What differs is the plumbing, plus the style the new files have to meet as new files: locals that were var now name their types, which matters most where an RDS and a DocumentDB lookup sit side by side returning different shapes, the inline fully-qualified ObjectMapper, ObjectNode and RandomPasswordGenerator are imported, and neither file keeps a private copy of resolveOptional now that ProvisionContext already offers the identical method the other 46 migrated provisioners call. Monolith 5,461 to 4,987 lines, legacy types 33 to 31. Two classes rather than one, because the two types do not want the same dependencies. The secret needs only SecretsManagerService. The attachment reads an RDS or DocumentDB endpoint to build the connection detail it writes into the target secret, so it needs three services and an ObjectMapper. Splitting keeps AGENTS.md's "inject only the service it wraps" true for the common case and confines the wide dependency to the type that genuinely has it. The repo already anticipated the split: SecretTargetAttachmentCfnProvisionerTest has existed for some time, named for a class that did not. This is the batch that finally takes RdsService out of the monolith. Batch 7 could not: dbInstanceConnection and dbClusterConnection were the last two rdsService call sites and both belong to the attachment. Three service fields leave with this change, SecretsManagerService, RdsService and DocDbService, along with their constructor parameters and imports, plus six RDS model imports that batch 7 left behind unused. SecretTargetAttachment is the first extracted type to leave DELETE_NEEDS_STACK_RESOURCE, which drops from 7 entries to 6. Its delete needs two create-time attributes no physical id carries: which secret fields the attachment managed, so only those are stripped, and which attachment owns the secret, so a second attachment's fields survive. That logic moves into the provisioner's delete(StackResource, String) override, and the set entry goes in the same commit because the registry is consulted first and leaving both claiming the type is exactly what CfnDeletePrecedenceTest exists to catch. The id-only delete keeps refusing the attachment with the same message, which a test asserts. The 34 SecretTargetAttachmentCfnProvisionerTest tests and the 5 attachment integration tests pass unchanged, which is the guard that the move preserved behaviour: both build through CfnProvisionerFixture, so they exercise the new provisioners without knowing they exist. Making the types provisioner-owned rather than LEGACY_SWITCH puts them under CfnSchemaCoverageTest for the first time, since it skips switch-owned types. One attribute surfaces: Fn::GetAtt Id on a secret is its ARN, which the provisioner already sets as the physical id and as Arn. It is recorded as a gap rather than set, to keep this commit a pure move. |
||
|
|
b618fa9033 |
fix(cloudformation): expose the RDS resource-id GetAtt attributes (#3527)
AWS::RDS::DBCluster declares DBClusterResourceId readOnly and AWS::RDS::DBInstance declares DbiResourceId, and RdsService already assigns both. Neither reached the stack resource, so Fn::GetAtt on either resolved to the literal "LogicalId.Attr" rather than the id, the silent failure mode Fn::GetAtt has when an attribute was never mapped. Invisible until now: the types were LEGACY_SWITCH, and CfnSchemaCoverageTest skips those. Moving them to a provisioner is what surfaced it. The other 17 attributes that surfaced with them stay recorded as gaps, because Floci does not emulate what they describe: read replicas, multi-AZ secondaries, point-in-time restore windows, RDS Custom automation. Endpoint and ReadEndpoint are recorded too, for a different reason: the dotted Endpoint.Address, Endpoint.Port and ReadEndpoint.Address are already set, and that is the form AWS's GetAtt exposes for these types. Both assertions fail against the previous commit, returning null. |
||
|
|
29e9ae9221 |
refactor(cloudformation): move the RDS types into RdsCfnProvisioner (#3459)
Moves all seven AWS::RDS types out of the monolith switch into a per-service provisioner. Method bodies are carried over unchanged except for the six master-credential call sites described below; the rest is plumbing. The seven types delete by physical id alone, so the id-only delete override serves all of them and none appears in DELETE_NEEDS_STACK_RESOURCE. Unlike the ECS, ELBv2, Cognito, EC2-networking, Events and Batch batches, this one does not take its service out of the monolith. SecretTargetAttachment is still served there and reads an instance's or cluster's endpoint through RdsService to build its connection detail, so the field, its constructor parameter and its import all stay. Four helpers the RDS block shared with other types stay too, copied into the provisioner: sameNameExistingResource, deleteRenamedResource, parseIntProp and parseCfnTags. firstNonBlank, parseBoolProp and parseOptionalIntProp had no non-RDS callers left and moved outright. Name generation now goes through ProvisionContext.generatePhysicalName rather than a copy: the two implementations were already byte-identical, down to the 12-character suffix. MasterUsername and MasterUserPassword keep the opt-out #3301 gave them. The engine resolves dynamic references for every property now, with ssm-secure rejected, so those two properties read through resolveOptionalWithoutDynamicReferences and resolve their own references with ssm-secure allowed. Reading them with the ordinary resolveOptional compiles and leaves the suite green while breaking ssm-secure on the only resource AWS permits it on, so the monolith's helper moves across with the code rather than collapsing into the ordinary path. CloudFormationRdsDynamicReferenceIntegrationTest is new and covers that, because nothing did. RdsCfnProvisionerTest builds its engine without a dynamic-reference resolver, so the general stage is off there and its assertions hold either way, and CloudFormationDynamicReferenceIntegrationTest has no RDS case. The ssm-secure test fails with ROLLBACK_COMPLETE when the opt-out is reverted, and the plain ssm test guards the other direction. The 69 existing RdsCfnProvisionerTest tests and the 2 integration tests pass unchanged, which is the guard that the move preserved behaviour: both build through CfnProvisionerFixture, so they exercise the new provisioner without knowing it exists. The fixture's CfnDynamicReferences wiring had to move ahead of the registry build, since the provisioner takes it as a constructor argument. Making the types provisioner-owned rather than LEGACY_SWITCH puts them under CfnSchemaCoverageTest for the first time, which the switch was exempt from. The 19 attributes it found are recorded as gaps here, unchanged from what the switch set. Two of them are closable and a follow-up PR closes them, kept out of this one so it stays a pure move; Endpoint and ReadEndpoint are recorded rather than set because the dotted sub-attributes already carry them, which is the form AWS's GetAtt actually exposes. Monolith 5,942 to 5,458 lines, legacy types 39 to 32. |
||
|
|
a985773611 |
feat(bcm-pricing-calculator): emulate workload estimates (#3441)
* feat(bcm-pricing-calculator): emulate workload estimates * fix(bcm-pricing-calculator): serialize timestamps as epoch seconds * fix(bcm-pricing-calculator): align idempotency and errors |
||
|
|
a0fd815366 |
feat(oam): emulate observability access manager (#3440)
* feat(oam): emulate observability access manager * fix(oam): honor explicit deny statements |
||
|
|
128d3ef181 |
feat(datasync): add the DataSync management plane (#3377)
* feat(datasync): add the DataSync management plane Emulates the AWS DataSync management API over JSON (X-Amz-Target FmrsService.<Action>, signing name datasync): agents, the eleven CreateLocation/DescribeLocation/UpdateLocation trios plus the shared ListLocations and DeleteLocation, tasks, and resource tagging. Each DescribeLocation* projects the create request that produced the location, so the configuration that went in is the configuration that comes back, and LocationUri is derived from that request per the scheme AWS documents for the type. DescribeAgent reports ONLINE and DescribeTask reports AVAILABLE from the first read, which is what the Terraform provider's aws_datasync_task waits on. Credential members (Password, SecretKey, SasConfiguration, the Kerberos files and the nested Protocol.SMB.Password) are dropped before the configuration is stored, as AWS never reads them back either. Errors use InvalidRequestException, the only client error the DataSync model declares. The task-execution data plane (StartTaskExecution, DescribeTaskExecution, ListTaskExecutions, CancelTaskExecution, UpdateTaskExecution) transfers real bytes between real storage systems and keeps raising UnknownOperationException rather than a stub success. * fix(datasync): default VerifyMode from the task mode The DataSync model documents two VerifyMode defaults, not one: POINT_IN_TIME_CONSISTENT for a BASIC task and ONLY_FILES_TRANSFERRED for an ENHANCED one, which also cannot use POINT_IN_TIME_CONSISTENT at all. CreateTask applied the BASIC default to every task, so an ENHANCED task created without an explicit VerifyMode read back wrong. The default now follows TaskMode, and a VerifyMode the mode does not support is rejected with InvalidRequestException, the only client error this API declares. UpdateTaskRequest carries no TaskMode, so a task keeps the mode it was created with and UpdateTask applies the same rule against the stored mode. An unrecognized TaskMode is rejected rather than silently treated as BASIC. * test(datasync): add the SDK compatibility test Drives an agent, an S3 and an NFS location, both task modes and the tag round trip through the AWS SDK v2 DataSync client, which is the one piece of real-SDK verification the RestAssured tests do not cover. It asserts the VerifyMode default for a BASIC and an ENHANCED task, and that an ENHANCED task rejects POINT_IN_TIME_CONSISTENT on create and on update. --------- Co-authored-by: lex00 <artigues.dev@gmail.com> |
||
|
|
e096e08690 |
test(cloudformation): record the ACM Certificate Id GetAtt gap (#3452)
The registry schema declares readOnlyProperties ["/properties/Id"] for AWS::CertificateManager::Certificate, but AcmCfnProvisioner sets only CertificateArn, and no row recorded the difference. The type is inventory-owned rather than LEGACY_SWITCH, so CfnSchemaCoverageTest audits it and fails naming exactly that attribute. CI never saw it. The check needs the schema corpus, which lives under the gitignored local/aws, and schemasAvailable() returns early when it is absent. It failed only for contributors holding the corpus, which is why a local run of the gate has been red on this one row since #3114. Recorded as a gap rather than setting Id, following the CodeBuild::Project and CodePipeline precedent for the same shape: the schema gives Id no description, Ref on an ACM certificate returns the ARN, and the legacy spec gives the type no attributes, so any value here would be a guess. |
||
|
|
cae8f9a013 |
feat(bedrock): add guardrail lifecycle and versions (#3380)
* feat(bedrock): add guardrail lifecycle and versions
Amazon Bedrock control plane over REST JSON: CreateGuardrail through
DeleteGuardrail, CreateGuardrailVersion, ListGuardrails with pagination, and
resource tagging on /tagResource, /untagResource and /listTagsForResource.
Guardrails report READY on the first read, so the Terraform provider's status
poll for aws_bedrock_guardrail completes without a transition.
The control plane and bedrock-runtime both sign as "bedrock". The runtime
descriptor keeps that credential scope, and the new descriptor routes through
its resource class, which ServiceEnabledFilter checks first.
Policy blocks are stored under the read-shape member names, so a *Config
submitted on create or update reads back unsuffixed. ListGuardrails honours
maxResults and nextToken, and DeleteGuardrail rejects a guardrailVersion that
is not a GuardrailNumericalVersion.
* fix(bedrock): enforce guardrail length caps and resolve kmsKeyId to a key ARN
The AWS model caps description at 200 characters and both blockedInputMessaging
and blockedOutputsMessaging at 500, each with a minimum of 1. None of those were
checked, so an over-long value was stored and read back. name was already bounded
by its [0-9a-zA-Z-_]{1,50} pattern.
kmsKeyId on CreateGuardrail and UpdateGuardrail is a KmsKeyId: a key id, a key
ARN, an alias name or an alias ARN. kmsKeyArn on the read shapes is a KmsKeyArn,
which is only ever the full key ARN. The request value was echoed back verbatim,
so a bare key id or an alias produced a response that does not match the shape
GetGuardrail declares. It now resolves through KmsService.describeKey, the same
way RDS, DocDB and ElastiCache already resolve their KmsKeyId, and a key that is
missing, disabled or pending deletion is rejected with ValidationException.
* test(bedrock): drive the guardrail lifecycle from the AWS SDK v2 client
Adds the bedrock SDK module to the compatibility project, a BedrockClient
factory on TestFixtures, and a BedrockGuardrailTest covering create, read,
update, versioning, listing, tagging and delete. The test also submits kmsKeyId
as a bare key id and as an alias and asserts both read back as the same full KMS
key ARN.
* fix(bedrock): enforce the guardrail tag caps from the AWS model
The AWS model gives TagList a max of 200 items, and that shape backs the tags
member of both CreateGuardrail and TagResource. TooManyTagsException, declared
on both operations, documents a separate limit of 50 tags per resource counted
over the tags already on the resource together with the ones in the request.
parseTagList now rejects an array over 200 items with ValidationException, and
it moved to BedrockService so both entry points share it. CreateGuardrail and
TagResource raise TooManyTagsException once the total the guardrail would be
left holding passes 50, carrying resourceName as the model declares.
|
||
|
|
137a39add3 |
feat(appintegrations): add data and event integrations (#3379)
* feat(appintegrations): add data and event integrations
Amazon AppIntegrations over REST JSON, registered under the app-integrations
signing name: event integrations on /eventIntegrations, data integrations on
/dataIntegrations, and resource tagging through the shared /tags/{resourceArn}
dispatcher. Terraform's aws_appintegrations_event_integration and
aws_appintegrations_data_integration now round-trip against Floci instead of
failing on an unimplemented signing scope.
Event integrations are keyed by name, data integrations by generated id, and
both accept their own ARN wherever the API takes an identifier. The two PATCH
operations apply only the members present in the request body, matching how AWS
treats an optional member the caller did not send. Both tag writes answer 200,
which is what the 2020-07-29 model gives them.
* test(appintegrations): add an SDK compatibility test
Adds the appintegrations AWS SDK v2 module, a TestFixtures client factory,
and an AppIntegrationsTest that drives both integration types and the tag
round trip through the real SDK client.
|
||
|
|
2e79f5c766 |
feat(globalaccelerator): add the Global Accelerator management plane (#3378)
* feat(globalaccelerator): add the Global Accelerator management plane Emulates the AWS Global Accelerator management plane over JSON 1.1 under the GlobalAccelerator_V20180706 target prefix, signing name globalaccelerator: accelerators, listeners, endpoint groups, accelerator attributes and resource tags, 22 actions in all. Global Accelerator is a global service, so ARNs carry an empty region segment and listener and endpoint group ARNs extend the accelerator ARN. Nothing is keyed by the signing region, so a caller that signs outside us-west-2 sees the same accelerators. Accelerators report DEPLOYED and endpoints HEALTHY from the first read, so SDK and Terraform waiters complete on their first poll. Enum and range members are validated against the API model, and UpdateAcceleratorAttributes rejects an update that would leave FlowLogsEnabled true with no destination bucket. * fix(globalaccelerator): enforce the list caps and HealthCheckPath format from the API model The scalar ranges were already checked against globalaccelerator/2018-08-08, but the array-count caps were not. PortRanges, EndpointConfigurations and PortOverrides each declare max 10, and IpAddresses declares max 2 for the BYOIP case. All four were unbounded. HealthCheckPath declares max 255 and the pattern ^/[-a-zA-Z0-9@:%_\+.~#?&/=]*$, which was not checked at all. The new failures reuse InvalidArgumentException and the message shape the existing scalar validations already use, so they are indistinguishable in kind from those. * test(globalaccelerator): add the SDK compatibility test Adds the globalaccelerator SDK module, a TestFixtures client factory and a GlobalAcceleratorTest that drives accelerator, listener and endpoint group lifecycles through the AWS SDK v2 client, including the new PortRanges cap. --------- Co-authored-by: lex00 <artigues.dev@gmail.com> |
||
|
|
6b17ef2b1c |
feat(redshift): emulate GetClusterCredentials and GetClusterCredentialsWithIAM (#3273)
* feat(redshift): add RedshiftCredentialBroker for short-lived Db credentials * refactor(rds-proxy): widen PasswordValidator to a three-value AuthResult The wire-level password check the PostgreSQL/MySQL proxy handlers take now returns REJECT / PASSTHROUGH / MASTER_EQUIVALENT instead of a boolean, so a caller can tell the proxy to open the backend leg as the cluster master for a client it has vouched for. RdsAuthProxy keeps its own boolean master-password callback, renamed MasterPasswordCheck to free the PasswordValidator name, and adapts it at the handler boundary (non-master stays PASSTHROUGH). * feat(redshift): auth proxy accepts live GetClusterCredentials credentials passwordValidatorFor now returns AuthResult and consults RedshiftCredentialBroker: the master pair and any live minted credential resolve to MASTER_EQUIVALENT, a known broker user with a stale password is REJECTed, everyone else PASSTHROUGH. * feat(redshift): add default-credential-duration-seconds config * feat(redshift): implement GetClusterCredentials action Mints a short-lived DbUser/DbPassword pair via RedshiftCredentialBroker and returns it as Query-protocol XML. AutoCreate prefixes IAM: on the DbUser, DbGroups are echoed, DurationSeconds is validated to 900-3600 (default from the new config key), and an unknown ClusterIdentifier propagates ClusterNotFound. The two credential actions are registered in AwsQueryController.REDSHIFT_ACTIONS and the Query dispatch now forwards the Authorization header to the handler. * feat(redshift): implement GetClusterCredentialsWithIAM action Derives the DbUser from the caller's IAM identity resolved via the Authorization header: an IAM user maps to IAM:<name>, an assumed role to IAMR:<role>, and an unresolvable caller to the IAMR:floci fallback with a WARN so local and CI flows are not blocked. Any DbUser request parameter is ignored. * feat(redshift-data): resolve non-master DbUser via GetClusterCredentials resolveViaDbUser now accepts a DbUser that has a live credential in RedshiftCredentialBroker, connecting to the container as the cluster master (the minted DbUser is nominal). An unknown non-master DbUser still fails with ValidationException. * test(redshift): end-to-end GetClusterCredentials + Data API non-master DbUser Docker-gated: mints a credential for a non-master DbUser via GetClusterCredentials then runs SELECT 1 through the Data API as that DbUser, asserting the result. * test(compat): SDK coverage for Redshift GetClusterCredentials Adds getClusterCredentials and getClusterCredentialsWithIAM assertions to the AWS SDK Redshift compatibility test. * docs(redshift): document GetClusterCredentials and GetClusterCredentialsWithIAM Regenerates the redshift.md action table (excluding the DbGroups member-name switch label), fills the two new descriptions, updates the wire-auth and redshift-data.md DbUser notes, and bumps the Service Matrix count to 23. * fix(redshift): reject a wrong master password instead of passing it through passwordValidatorFor only treated the master pair as MASTER_EQUIVALENT and let everything else fall to the broker. A request with the master username but a wrong password is unknown to the broker, so it classified as PASSTHROUGH; the wire proxy then opened the backend leg as master (isMaster is username-only) and the client authenticated with the wrong password. Now the master username is decided on its own password: match to MASTER_EQUIVALENT, mismatch to REJECT. * fix(redshift): reject proxy logins when the cluster row is gone; strip IAM user path passwordValidatorFor fell through to the broker when the cluster was absent from the account partition, classifying an unknown user as PASSTHROUGH; the wire proxy reads isMaster from its own start-time config, so that still opened the backend as master for the master username with any password. Return REJECT when there is no cluster row to validate against. RedshiftIamDbUserResolver now strips an IAM path prefix from a user ARN (user/team/alice -> alice), matching how AWS names the DbUser. * fix(redshift): keep concurrent credentials, revoke on delete, bound the config default Addresses PR review (greptile): - RedshiftCredentialBroker now holds every unexpired credential per DbUser instead of one slot, so a reissue no longer invalidates a still-live password (matches AWS, which keeps each issued credential valid to its own expiry). - Add revokeCluster(); RedshiftService calls it on deleteCluster and at the start of createCluster, so a cluster recreated with the same identifier does not inherit master-equivalent access from a stale credential. - resolveDurationSeconds now holds the YAML default to the same 900-3600 bounds as a request value, falling back to 900 with a WARN instead of minting a credential that is already expired or over-range. * fix(redshift): revoke temp credentials on createCluster rollback too The greptile review asked for revocation on 'relevant rollback paths'. Both createCluster failure branches that delete the cluster row now also call credentialBroker.revokeCluster, so a credential issued by a concurrent GetClusterCredentials while the row briefly existed cannot outlive it. * fix(redshift): correct GetClusterCredentials AutoCreate prefix AWS prefixes the returned DbUser with IAM: when AutoCreate is false and IAMA: when it is true. The handler returned IAM: when true and no prefix when false, so a client using the returned name could not authenticate and the value diverged from GetClusterCredentialsWithIAM, which already issues prefixed identities. The broker keys on the returned name, so the proxy and Data API now expect the prefixed DbUser. Tests and the redshift docs are updated to match. * test(redshift): give compat GetClusterCredentials tests distinct @Order Three methods shared @Order(2), leaving their relative order undefined. Number the two credential tests 3 and 4 and move testDeleteCluster to 5. |
||
|
|
2d51259120 |
feat(verifiedpermissions): add full service emulation (#3128)
* feat(verifiedpermissions): add full service emulation * fix(verifiedpermissions): harden OIDC and schema validation * test(verifiedpermissions): add service layer coverage * fix(verifiedpermissions): support native Cedar runtime * fix(verifiedpermissions): package Cedar native FFI * fix(verifiedpermissions): register Cedar deserializers for native * fix(verifiedpermissions): bound JWKS refreshes * fix(verifiedpermissions): avoid Cedar entity reflection * fix(verifiedpermissions): register Cedar native reflection * fix(verifiedpermissions): refresh rotated OIDC keys safely * fix(verifiedpermissions): retry failed JWKS refreshes * refactor(verifiedpermissions): isolate Cedar in sidecar * fix(verifiedpermissions): harden Cedar sidecar runtime * fix(verifiedpermissions): build cedar sidecar in compatibility CI * fix(verifiedpermissions): remove stale cedar jni config * fix(verifiedpermissions): recover cedar sidecar * fix(verifiedpermissions): bound OIDC document responses * fix(verifiedpermissions): start cedar sidecar in native sdk CI |
||
|
|
cbfa034470 |
feat(identity-center): complete IAM Identity Center emulation (#3331)
* feat(ssoadmin): add region operation * feat(ssoadmin): attach customer managed policies * feat(ssoadmin): create applications * feat(ssoadmin): create application assignments * feat(ssoadmin): create account instances * feat(ssoadmin): create ABAC configuration * feat(ssoadmin): create trusted token issuers * feat(ssoadmin): delete account assignments * feat(ssoadmin): delete applications * feat(ssoadmin): delete application access scopes * feat(ssoadmin): delete application assignments * feat(ssoadmin): delete application authentication methods * feat(ssoadmin): delete application grants * feat(ssoadmin): delete identity center instances * feat(ssoadmin): list principal account assignments * feat(ssoadmin): provision permission sets * feat(ssoadmin): list provisioned permission sets * feat(ssoadmin): list accounts for provisioned permission set * feat(ssoadmin): describe permission set provisioning status * feat(ssoadmin): list permission set provisioning status * feat(ssoadmin): describe account assignment deletion status * feat(ssoadmin): list account assignment creation status * feat(ssoadmin): list account assignment deletion status * feat(ssoadmin): delete permission sets * feat(ssoadmin): detach customer managed policy references * feat(ssoadmin): list customer managed policy references * feat(ssoadmin): get inline permission set policies * feat(ssoadmin): put permission set boundaries * feat(ssoadmin): get permission set boundaries * feat(ssoadmin): delete permission set boundaries * feat(scim): create groups * feat(scim): create users * feat(scim): delete groups * feat(scim): delete users * feat(scim): get groups * feat(scim): get users * feat(scim): list groups * feat(scim): list users * feat(scim): get schemas * feat(scim): list schemas * feat(scim): list resource types * feat(scim): add service provider config * feat(scim): patch groups * feat(scim): patch users * feat(scim): put users * feat(ssoadmin): delete ABAC configuration * feat(ssoadmin): delete trusted token issuers * feat(ssoadmin): describe applications * feat(ssoadmin): describe application assignments * feat(ssoadmin): describe instances * feat(ssoadmin): describe ABAC configuration * feat(ssoadmin): describe regions * feat(ssoadmin): describe trusted token issuers * feat(ssoadmin): describe application providers * feat(ssoadmin): list application assignments * feat(ssoadmin): list principal application assignments * feat(ssoadmin): list applications * feat(ssoadmin): list application providers * feat(ssoadmin): list regions * feat(ssoadmin): list trusted token issuers * feat(ssoadmin): put application access scopes * feat(ssoadmin): get application access scopes * feat: support listing application access scopes * feat(ssoadmin): get application assignment configuration * feat(ssoadmin): put application assignment configuration * feat(ssoadmin): get application authentication methods * feat(ssoadmin): put application authentication methods * feat(ssoadmin): list application authentication methods * feat(ssoadmin): get application grants * feat(ssoadmin): put application grants * feat(ssoadmin): list application grants * feat(ssoadmin): get application session configuration * feat(ssoadmin): put application session configuration * feat(ssoadmin): list resource tags * feat(ssoadmin): tag resources * feat(ssoadmin): untag resources * feat(ssoadmin): remove regions * feat(ssoadmin): update applications * feat(ssoadmin): update instances * feat(ssoadmin): update ABAC configuration * feat(ssoadmin): update trusted token issuers * feat(ssooidc): register clients * feat(ssooidc): start device authorization * feat(ssooidc): create public client tokens * feat(ssooidc): create IAM-authenticated tokens * feat(ssoportal): list assigned accounts * feat(ssoportal): list assigned account roles * feat(ssoportal): issue assigned role credentials * feat(ssoportal): invalidate portal sessions * docs(ssoadmin): report complete operation count * fix(identity-center): repair CI validation * fix(identity-center): harden auth and native build * fix(ssooidc): disambiguate RestAssured query parameter * fix(identity-center): resolve CI compatibility failures * fix(identity-center): address maintainer review * fix(ssoadmin): preserve application provider partition * fix(identity-center): repair Java compatibility tests * fix(identity-center): trust local TLS in browser flows * fix(identity-center): register refresh token grant in SDK test |
||
|
|
50fa334dc5 | feat(marketplace-catalog): emulate AWS Marketplace Catalog API (#3338) | ||
|
|
9a2a89399a |
feat(firehose): convert JSON records to Parquet via the floci-duck sidecar (#3333)
* feat(firehose): convert JSON records to Parquet via the floci-duck sidecar Deliver data-format-converting streams for real: each flushed record is parsed and type-checked in Java against the stream's Glue table schema (per-record ParseError/MalformedData routing with AWS's probed message shapes), valid rows are staged as normalized NDJSON and written to the destination as Parquet by DuckDB's COPY, and failed records go to the evaluated ErrorOutputPrefix as AWS-shaped NDJSON error lines. Batch-level failures (missing Glue table, unsupported schema, sidecar errors) route every record to the error output instead of dropping them. Adds the floci.services.firehose.staging-bucket setting and replaces the PR-1-era unconverted-delivery warning. * fix(firehose): deliver a scheduled flush as the stream's own account A scheduled flush runs on the flusher thread, where no request context is active, so the Glue lookup, the staging writes, the destination writes and the sidecar all resolved the default account instead of the stream's owner. A stream owned by another account had its Glue table missed and its objects written to the wrong partition. The delivery now runs under RequestScopes, which the CUR scheduler already uses for the same reason, so every store the delivery touches agrees on the owner. The unconverted path gets this too. Cleanup failures in the compatibility test are logged rather than swallowed, per the repository rule on tolerated exceptions. * fix(firehose): cap the staging buffer size hints rows.size() * 128 overflows an int at about 16.7 million records, so a batch of many small records failed before writing any of them, and short of that it asked for a multi-gigabyte array. Both hints are computed as a long and capped at 8 MiB; the streams grow as needed, so this only affects the first allocation. * docs(firehose): state what a failed error-output write actually guarantees The comment claimed a failure of the error-output write leaves the converted rows in the staging bucket, but the enclosing finally removes the staged object however the method exits, and the Parquet bytes are read into memory before either destination write, so nothing is retained to recover from. What holds is that nothing is delivered and the flush fails as a whole, which is what it says now, along with where recovery does live: the source, which a Kinesis-backed stream has and a DirectPut buffer does not. The reverse ordering is documented rather than claimed away: the two destination writes are not atomic, so an error object can land and the Parquet write then fail, reporting the failed records while the converted ones are gone. |
||
|
|
82eaaaeee7 |
refactor(cloudformation): move the Batch types into BatchCfnProvisioner (#3285)
* refactor(cloudformation): move the Batch types into a per-service provisioner AWS::Batch::ComputeEnvironment, JobQueue and JobDefinition move out of the legacy monolith into BatchCfnProvisioner, continuing the decomposition. The three provisioning methods and the three helpers only they called (computeEnvironmentOrder, containerProperties, retryStrategy) move across unchanged; the generic property helpers they leaned on have other callers and stay behind, re-expressed here against ProvisionContext, which already offers resolveOptional, generatePhysicalName and resolveTags. Behaviour preserving: same request shapes, same physical ids, same Fn::GetAtt attributes. The defects these arms carry (nothing is deleted on stack delete, updates re-create rather than update, Priority is defaulted although the schema requires it) are left exactly as they were and are fixed in the commits that follow, so this move stays reviewable on its own. BatchService was the monolith's only remaining use of the field, so the field, its constructor parameter and its import go too. Batch is absent from DELETE_NEEDS_STACK_RESOURCE, so that set is untouched. The inventory rows move from LEGACY_SWITCH to BatchCfnProvisioner and the test fixture gains the inferred wiring; without the latter a fixture test naming Batch would fall through to the stub arm and pass on a fake id. docs-sync reports the generated table already current, and the schema-coverage gate finds no new attribute gaps: each type's only top-level read-only property is its ARN, which was already set. Monolith 6,457 to 6,292 lines, legacy types 47 to 44. * fix(cloudformation): delete Batch resources when their stack is deleted The legacy switch had no AWS::Batch arm in any of its delete paths, so deleting a stack left the compute environment, job queue and job definition behind. The stack reported DELETE_COMPLETE over resources that were still there, and a re-created stack then failed on the names it had supposedly released. Batch refuses to remove a running entity, as AWS does: DeleteJobQueue rejects an ENABLED queue, and DeleteComputeEnvironment rejects one that is not DISABLED or is still referenced by a queue. So each delete disables first and then removes, which is what the real resource handlers do. CloudFormation already tears down in reverse dependency order, so a queue is gone before the environment it points at. A job definition is deregistered, which is AWS's own semantic for that type: the revision goes INACTIVE rather than disappearing. Deliberately not CfnDeletes.safeDelete. Every BatchService failure carries the same ClientException code, so tolerating it would be the catch-all AGENTS.md rules out: a genuine refusal such as "still associated with a job queue" would be swallowed into a green stack delete instead of surfacing as DELETE_FAILED. Already-gone is handled by looking first instead, which also keeps the disable step from throwing on a resource removed out of band, and makes a repeated delete idempotent. That check matters most for the job definition, the one call of the three that throws when its target is missing. Nine unit tests cover the ordering, the idempotent repeat, and that a refused delete propagates rather than being swallowed. * fix(cloudformation): update Batch resources in place instead of re-creating them provision runs again on every UpdateStack, and the legacy switch always created. That broke both ways. A named compute environment or job queue called create a second time under the same name, and createComputeEnvironment and createJobQueue both reject a duplicate, so the stack update failed. An unnamed one generated a fresh random name each time, creating a second entity and orphaning the first. An update that keeps the name now goes through UpdateComputeEnvironment or UpdateJobQueue, the schemas' update handlers, and keeps the prior physical id. Only the properties those handlers accept are pushed through: the names, Type and JobQueueType are createOnly, so a change there is a replacement the engine drives rather than something to force into an update. A job definition needs no update branch, because RegisterJobDefinition on an existing name records a new revision, which is exactly how AWS updates one. The name is kept steady by reading the attribute recorded at create time, the way SqsCfnProvisioner reads QueueName beside the queue URL. ProvisionContext's stablePhysicalName and reusesPriorEntity do not fit here: both fall back to the prior physical id, which for Batch is an ARN rather than a name, so they would feed an ARN back in as a name. Their javadoc says as much. For a stack created before that attribute was recorded, the name is recovered from the prior ARN so those stacks update in place too rather than duplicating. Six more unit tests: in-place update for both types, a rename creating instead of updating, an unnamed resource keeping its generated name, the ARN fallback, and a job definition re-registering under the same name. * fix(cloudformation): enforce the Batch schemas' required properties Three properties the registry schemas mark required were optional here, so a template missing one applied cleanly against floci and then failed on AWS, which is the divergence the emulator exists to prevent. AWS::Batch::JobQueue requires Priority; the switch substituted 1, so the service's own "priority is required" check could never fire. ComputeEnvironment and JobDefinition both require Type; an absent one reached the service as a null and JobDefinition additionally defaulted to "container". All three now fail the resource with the repo's ValidationError wording, matching how Ec2NetworkCfnProvisioner reports a missing required property. Also drops the Revision attribute from AWS::Batch::JobDefinition. Revision is not a property of that type in the registry schema, and the legacy resource spec gives the type no attributes at all, so Fn::GetAtt on it fails on AWS. Offering it let a template pass here and break there. Nothing in the repo reads it. The physical id stays the job definition ARN despite the schema's primaryIdentifier naming JobDefinitionName, because the legacy spec and the type's documented Ref both point at the ARN; changing it would be visible to existing templates on evidence that does not agree with itself. The integration test now covers the two stack-level defects end to end: an update that changes only updatable properties keeps both physical ids and moves the queue's priority, and a stack delete leaves neither entity behind. Both assertions fail without the preceding two commits. * fix(cloudformation): clean up the Batch entity a replacing update displaces Renaming a compute environment or job queue creates the replacement and leaves the original live in Batch forever. The provisioner recorded nothing, so the engine was never told a replacement had happened: no DELETE_IN_PROGRESS event, no cleanup phase, and nothing to delete the displaced entity even under the default UpdateReplacePolicy. Wired to the shared ReplacementCleanup the way CloudFrontCfnProvisioner does it rather than re-derived: attributesBefore is copied as the first statement of provision, and record runs at the end of each arm once the new physical id is assigned, which is what lets it compare the prior id against the new one. The four hooks delegate straight through. An in-place update keeps the prior ARN, so it records nothing and stays outside the cleanup path. AWS::Batch::JobDefinition is deliberately not wired the same way. The registry schema gives it primaryIdentifier JobDefinitionName, not the ARN, and registering revision 2 does not retire revision 1 on AWS: the prior revision stays ACTIVE and a running job may still name it. Every registration mints a new ARN, so treating a changed physical id as a replacement here would have the cleanup deregister a live revision. Only a changed name replaces the definition, and that decision is taken before the register call overwrites the recorded name, since the check reads that attribute. Five unit tests: a renamed environment recording its predecessor, completeUpdate actually deleting it, an in-place update owing nothing, a revision bump owing nothing, and a renamed definition owing its predecessor. Mutation checked by dropping the record call, which fails the first two and nothing else. * fix(cloudformation): restore an in-place Batch update when the stack rolls back An in-place compute environment or job queue update committed and then could not be undone. Without a rollbackUpdate hook the resource fell to "Rollback is not implemented for AWS::Batch::JobQueue", which is not a quiet gap: CloudFormationService adds it to the rollback failures, so the whole stack reports UPDATE_ROLLBACK_FAILED and the committed template is not restored either. A stack whose Batch resource sat anywhere ahead of the failing one could not roll back at all. Snapshot the entity before the update call and put it back, following LambdaEventInvokeConfigCfnProvisioner: replacement first through the cleanup record, then the snapshot for the in-place case. The describe is the only source, because the template holds the desired state rather than the current one. The snapshot is spent only once the restore succeeded, so a restore that throws leaves it for the next attempt instead of reporting a rollback that never happened, and a resource this update never touched carries none and answers false rather than claiming one. Simpler than the Events rule this pattern comes from: each Batch update is a single service call, so a throw leaves nothing half-applied and no in-provision restore arm is needed. A job definition instead names the revision the failed update registered, which is deregistered on rollback while the resource points at the prior one again. Snapshotting is best effort. An entity the describe cannot find leaves none, and rollbackUpdate then answers false rather than restoring a guess; failing the update there would break a working update over missing rollback insurance. The integration test is the one that proves the hook is reached: a stack whose later resource cannot provision now reaches UPDATE_ROLLBACK_COMPLETE with the queue back on its original priority. Reverting rollbackUpdate puts it back to UPDATE_ROLLBACK_FAILED, reason "The following resource(s) failed to roll back: [Queue, Compute]". * fix(cloudformation): reject a Batch job queue Priority that is not a valid integer Priority reached Integer.parseInt unguarded on both the create and the update path, so a template carrying "high", or a Ref resolving to something that is not a number, threw NumberFormatException out of the provisioner. The stack surfaced that as a 500 rather than the failed validation it is, while every other bad property in this class raises ValidationError with a 400. Parsed through a helper that raises the same ValidationError instead, and bounded while there: the registry schema types AWS::Batch::JobQueue Priority as integer with minimum 0 and maximum 1000, so a value outside that is as invalid as a non-numeric one and AWS rejects both. This is the same schema-sourced enforcement the required-properties commit already applies, reaching the one property it left parsing unchecked. Three unit tests: a non-numeric value on create, the same on the update path, and an out-of-range one. Mutation checked by restoring Integer.parseInt, which fails all three and nothing else. * docs(cloudformation): say why the Batch deletes cannot use CfnDeletes.safeDelete The javadoc already said safeDelete was deliberate, but not enough to stop the question being asked again: it read as a limitation of BatchService rather than of the API. It is the API. Batch declares exactly two errors on DeleteComputeEnvironment, DeleteJobQueue and DeregisterJobDefinition, ClientException at 400 and ServerException at 500, and no not-found code anywhere in the service model. safeDelete takes the specific already-gone code by design, so there is none here to pass it. Tolerating ClientException instead would be the catch-all AGENTS.md rules out, swallowing a real refusal such as "Cannot delete compute environment still associated with a job queue" into a green stack delete. Giving Batch a Floci-only not-found code to satisfy the pattern would put a code on the wire AWS never sends, which is the wire contract this emulator exists to keep. Also names EcsCfnProvisioner, which does tolerate a blanket ClientException for its task-definition arm, so the divergence reads as deliberate rather than as an oversight. Comments only. No behaviour change, so the existing tests are what prove it inert. * docs(cloudformation): record what a Batch rollback cannot undo A compute-environment rollback restores every value the environment already carried and cannot remove one the failed update introduced. The snapshot holds what the describe returned, so a serviceRole or computeResources key that was absent beforehand is absent from the snapshot, the restore call omits it, and UpdateComputeEnvironment leaves an omitted field alone while merging computeResources rather than replacing it. The value survives a rollback the stack reports as successful. That cannot be closed here. UpdateComputeEnvironment is the only way to put the environment back and its request shape has no removal: every member other than computeEnvironment is an optional set-value, and the partial-merge semantics are AWS's own. So this is disclosed on rollbackUpdate and pinned by a test, the way CognitoCfnProvisioner records its own in-place rollback limitation, rather than worked around. Job queues are not affected. updateJobQueue assigns computeEnvironmentOrder wholesale rather than merging it, and state and priority are always present, so that restore is exact. The test asserts the surviving value rather than only that the rollback returned true, so it goes red if the merge semantics ever change without this note changing with them. Mutation-checked: making the restore send an empty serviceRole fails it. |
||
|
|
d44a3fef62 |
fix: bound CloudTrail delivery retries (#3298)
* fix: bound CloudTrail delivery retries * fix(cloudtrail): reserve limits for failed deliveries * fix(cloudtrail): reserve in-flight retry capacity * fix: preserve per-trail CloudTrail flush isolation * test: make CloudTrail burst assertions deterministic * test: preserve CloudTrail delivery order coverage * chore: rerun CI * chore: rerun CI |
||
|
|
460aa0718e |
feat(cloudwatch): provision AWS::CloudWatch::Dashboard (#3231)
* feat(cloudwatch): provision AWS::CloudWatch::Dashboard The dashboard name is the physical id, generated when the template gives none and kept across updates. An update with the same name puts the body again and drives the tags to the template's set, since PutDashboard leaves an existing dashboard's tags alone. A changed name creates the new dashboard and leaves the displaced one to the ReplacementCleanup record, which deletes it once the update commits or restores it on rollback. The body may be written as a JSON object in the template and is stored as the string the API takes. The CloudWatch docs now list the dashboard and tag actions the handlers already serve. * fix(cloudwatch): roll back in-place dashboard updates and replace a dashboard whose explicit name is dropped An in-place update keeps the body and tags it replaces on the resource, or the fact that the dashboard did not exist, and a failed stack update puts them back in full. The name mode is recorded as the Logs provisioner does, so a template that drops an explicit DashboardName gets a generated name and a replacement, as on AWS, while an unnamed dashboard keeps its generated name. The Tags list is checked against the schema's cap of 50 on every provision, since the tag operations an update reconciles through do not enforce it. The integration test reads stack events with XmlParser. * fix(cloudwatch): keep the dashboard rollback snapshot until the restore succeeds A restore that throws left no snapshot behind, so the next rollback attempt reported success without restoring anything. The snapshot is now spent only after the body and tags are back. * fix(cloudwatch): unwind a dashboard update that failed after it changed the body An in-place update puts the body and then reconciles the tags. When the tag calls failed, the exception left the dashboard carrying the new body while CloudFormationService put the resource the stack held before the attempt back in its place. That object never carried the snapshot taken by the attempt, so the walker marked it restored and skipped rollbackUpdate: the stack reported a completed rollback over a dashboard that still had the update's body, or a half reconciled set of tags. The mutating calls now unwind themselves through rollbackUpdate, the way IotDomainConfigurationCfnProvisioner unwinds a replacement, and report the resource restored. An unwind that cannot put the body back keeps the snapshot and records the failure on the resource, so the stack ends in UPDATE_ROLLBACK_FAILED rather than claiming the prior dashboard is intact, and the original failure is still what the stack reports. Tests: anInPlaceUpdateThatFailedOnItsTagsPutsTheBodyBack, anUnwoundInPlaceUpdateIsMarkedRestored, anUnwindThatCannotRestoreIsReportedAsARollbackFailure. * fix(cloudwatch): record a dashboard unwind failure before joining it to the update failure The unwind repeats the tag call the update just made, so a service that keeps failing hands the unwind the very exception that interrupted the update. Throwable.addSuppressed rejects a throwable suppressed under itself, and that IllegalArgumentException escaped the unwind before the rollback failure was recorded: the dispatcher reported "Self-suppression not permitted" as the resource failure, no failure attribute reached the stored resource, and the stack ended UPDATE_ROLLBACK_COMPLETE over a dashboard whose tags were never put back. The failure attribute is now written first and the two exceptions are joined only when they differ, as PipesCfnProvisioner does. Two stack-level tests drive the whole path through CloudFormationService with a spied CloudWatchDashboardsService, the way CloudFormationPipesCleanupIntegrationTest does: a one-off tag failure ends in UPDATE_ROLLBACK_COMPLETE with the prior body and tags live, a persistent one in UPDATE_ROLLBACK_FAILED naming the dashboard and carrying the unwind's reason. Tests: anUnwindThatFailsWithTheUpdatesOwnExceptionIsStillRecorded, anUpdateThatFailedOnItsTagsPutsTheDashboardBackAndTheStackRollsBackCleanly, aFailedRestoreLeavesTheStackInUpdateRollbackFailedNamingTheDashboard. |
||
|
|
2d5a8f705b |
fix(amazonmq): add configuration for AMQP and console host port ranges (#3315)
Signed-off-by: Matheus André <matheusandr2@gmail.com> |
||
|
|
cf1aabce39 |
feat(ec2): back each VPC with a real Docker network in RFC 1918 space (#3272)
* feat(ec2): back each VPC with a real Docker network in RFC 1918 space An instance's private IP was a plausible-looking number nothing could connect to. Every VPC now gets its own Docker network, created lazily on the first launch into it, with the VPC CIDR as the network's IPAM pool and each subnet allocating static addresses from its own slice. The address Floci reports is one the container actually holds, and instances in different VPCs sit on different bridges. One network per VPC, not per subnet: subnets inside a VPC route to each other in AWS, so a network per subnet would manufacture a partition AWS does not have and break the two-tier app/database topologies this corpus is full of. The declared CIDR is used verbatim wherever it can be. It cannot be when it is absent, malformed, outside RFC 1918, or already claimed on the Docker daemon, which includes another Floci VPC: two VPCs may legally declare the same CIDR in AWS but one daemon cannot route two identical ranges. Only then is an equivalent block drawn from the configured fallback pool, and the substitution is logged at WARN. A reported private IP that does not mean what the caller declared is either true or it is in the log. Leases are given back on every exit: a launch that never attaches, a launch that fails, and terminate. Detach precedes release, because Docker holds the address while the endpoint stands and would refuse the next launch handed the same one. Startup reconciles this emulator's own orphaned networks first (scoped by API port, so instances sharing a daemon never touch each other's), then re-declares the plan from persisted VPCs and subnets and re-reserves the addresses restored instances still hold. Between-VPC isolation is the Docker daemon's, not Floci's, and OrbStack does not enforce it. On such a host the VPC boundary is an addressing boundary only. docs/services/ec2.md says so. Off with FLOCI_SERVICES_EC2_VPC_NETWORKS_ENABLED=false, and off whenever ec2 mock is on. * fix(ec2): do not adopt a leftover VPC network that routes another range materialise() treated any network under the VPC's own name as its own: a successful inspect set created=true and returned. A network left by a previous run that declared a different CIDR was therefore adopted, after which addresses were handed out of vpc.effective while the bridge routed something else entirely. Compare the leftover's IPAM subnet to vpc.effective. A match is adopted as before. A mismatch is removed and recreated on the planned range rather than re-planned onto the leftover's subnet: by the time materialise runs, addresses have already been allocated from vpc.effective, and after a restart some are leases held by live containers, so the plan cannot move under them. The network name carries this emulator's own port and region, so recreating it cannot destroy a user's network. If the removal fails the instance stays on the shared bridge, which is a documented degradation, instead of holding an address nothing routes. Also make small blocks work or refuse out loud. FIRST_HOST_OFFSET was a flat 10, so a /29 (eight addresses) and a /30 (four) allocated nothing at all and said nothing about it, and fallback-prefix-length had no upper bound to stop a /30 being configured. The offset now scales down to 2 for blocks that cannot spare ten addresses, a block with no room for a host is refused at plan time with a WARN, and the fallback prefix is clamped into the range that can serve hosts. * fix(ec2): keep the IMDS source address current across start and restore Ec2MetadataServer resolves an instance from the source address of the request, and a container's default route is the bridge, so a VPC-attached instance's metadata requests arrive from its bridge address rather than from the VPC address Floci reports. launch() registered both. start() and restoreMetadataRegistration() registered only the address getContainerBridgeIp returns, which for a VPC-attached container is the VPC address: neither refreshed imdsSourceIp nor registered the bridge. Docker hands out a fresh bridge address when a stopped container starts again, and an emulator restart rebuilds the registration map empty, so after either the instance's IMDS requests arrived from an address nothing knew about, while the address from the previous run stayed registered. Both paths now unregister the stale source address and register the current one. A bridge-only instance is unaffected: its reported address and its bridge address are the same, so there is no second registration. * fix(ec2): keep the IMDS source registration when inspect fails bridgeNetworkIp swallowed every inspect failure and returned null, the same answer it gives for a container that genuinely has no bridge address. refreshImdsSourceRegistration acts on that null by unregistering the instance's recorded IMDS source address, so one transient Docker hiccup permanently dropped a healthy instance's registration and put nothing in its place: its metadata requests stopped resolving until some later start or restore happened to succeed. Split the two answers apart. bridgeNetworkIp now lets the exception propagate, so null means only "no bridge address"; refreshImdsSourceRegistration catches it and returns early, leaving the existing registration exactly as it was. * docs(ec2): drop the em dashes this branch added AGENTS.md forbids em dashes in all content. The enforcing check runs with --diff-filter=A, so it only scans files a PR adds and stayed green on these, but a check that cannot see a violation is not a licence for it. Six of them are in lines this branch adds: four in docs/services/ec2.md, one in an Ec2ContainerManager javadoc, one in an Instance javadoc. Replaced with colons and commas. Wording is otherwise unchanged, and the em dashes already present in these files are left alone: they predate this branch, and rewriting them here would bury the actual change in unrelated churn. |
||
|
|
895adce214 |
fix(cloudformation): provision CloudFront policies and origin access controls (#3228)
* fix(cloudformation): provision CloudFront policies and origin access controls AWS::CloudFront::ResponseHeadersPolicy, CachePolicy, OriginRequestPolicy and OriginAccessControl had no provisioner, so the dispatcher's stub arm reported CREATE_COMPLETE with a synthetic id and a distribution that referenced it failed with "The specified response headers policy does not exist." A new CloudFrontCfnProvisioner creates each type through CloudFrontService: the physical id is the service id, Fn::GetAtt exposes Id and LastModifiedTime (Id only for the origin access control, per the registry schemas), updates go through the service's etag-guarded update, and deletes tolerate only the type's own not-found code so an in-use policy fails the stack delete as on AWS. The response headers configuration is reshaped into the flattened form the service's codec stores through the new ResponseHeadersPolicyConfigCodec.fromItemsTree. Closes #2441 * fix(cloudfront): reject deleting a cache or origin request policy in use DeleteCachePolicy declares CachePolicyInUse and DeleteOriginRequestPolicy declares OriginRequestPolicyInUse, both 409 sender faults, and both are documented as refusing the delete while the policy is attached to a cache behavior. Floci checked only two of the four policy-shaped types: deleteResponseHeadersPolicy and deleteOriginAccessControl raised their in-use errors, while these two deleted unconditionally once the etag matched. A policy still referenced by a distribution could be removed, leaving that distribution pointing at something that no longer existed. Both now raise the modeled error after the etag check, matching the ordering the other two deletes already use. Cache, origin request and response headers policies all hang off the same two places, a distribution's default cache behavior and its ordered ones, so the three near-identical scans collapse into one helper that differs only in which id it reads. The per-distribution association count keeps its own entry point, since it asks about one config at a time and can be handed a distribution with none. Found while reviewing the CloudFormation provisioner in this PR, which was already written for this: its delete tolerates only NoSuch<Type>, so it fails the stack correctly now that the service raises the in-use error. The CloudFormation integration test covers that end to end: it attaches both policies to a distribution and still deletes the stack cleanly, because CloudFormation removes the distribution before the policies it references. Four tests: a cache policy attached to a default behavior and to an ordered one, an origin request policy in use, and an unattached policy still deleting. * test(cloudformation): parse stack outputs with XmlParser The CloudFront policies integration test pulled Outputs out of the DescribeStacks response with two regular expressions over <member> and <OutputValue> blocks. XmlParser.extractPairs already does exactly this, and seventeen sibling CloudFormation integration tests define the same one-line helper over it, so the twelve-line version was reinventing a shared utility. It also matches the repo's rule against parsing XML with regex. Behaviour is unchanged, including the failure message that names the missing key. * fix(cloudformation): roll back a recreated CloudFront policy on a failed update When an update finds the prior policy or origin access control already deleted out of band, the provisioner recreates it under a new physical id. If a later resource then failed the stack update, the rollback left that new object behind: the engine only deletes resources the update ADDED, inside the previous == null branch of rollbackUpdatedResources, so an existing resource that merely acquired a new physical id fell through to the "Rollback is not implemented" arm, which deletes nothing. ReplacementCleanup already models exactly this, and CognitoCfnProvisioner wires it for the same situation, so the provisioner records the displaced entity after each provision and delegates the cleanup hooks and rollbackUpdate to it. A rollback now names the prior id again with the attributes it carried and deletes the object the failed update created. The physical id changes here only when the prior object was already gone, since prior() returns the entity whenever the service still knows it, so the recorded displaced entity is always one that no longer exists and its cleanup delete is a no-op tolerated by the type's not-found code. The hooks are still needed, or a recorded entity would stay owed a delete forever. An in-place update keeps its physical id, so nothing is recorded and rollbackUpdate answers false: putting a committed in-place change back needs a configuration snapshot this provisioner does not keep, the same limitation AWS::Cognito::UserPool has. A test pins that so it stays a decision. Raised by the review on this PR. My first reply argued the finding did not hold, generalising from the create path; that was wrong for this one, and the correction is on the thread. |
||
|
|
3218d2404e |
refactor(cloudformation): move the Events types into EventsCfnProvisioner (#3286)
* refactor(cloudformation): move the Events types into a per-service provisioner AWS::Events::Rule, EventBus and EventBusPolicy move out of the legacy monolith into EventsCfnProvisioner, continuing the decomposition. The block was already contiguous and self-contained: 18 methods and five constants, none of them referenced from outside, and EventBridgeService was the monolith's only user, so the field, its constructor parameter and both imports go too. Behaviour preserving. The event bus arm in particular already carried real logic worth keeping intact: rollback ownership, the created-time check that refuses to delete a bus recreated out of band, managed tag and policy tracking, and the rejection of an unsupported mutable update. All of it moves unchanged. Rule and EventBus were listed in DELETE_NEEDS_STACK_RESOURCE because deleting them needs stored attributes rather than the physical id alone: a rule remembers the custom bus it lives on, and a bus remembers the creation time proving the stack still owns it. That logic moves into the provisioner's delete(StackResource, String) override and both entries leave the set, which is what CfnDeletePrecedenceTest gates. EventBusPolicy keeps the id-only form, its composite busName|statementId id being enough. The four existing Events test classes needed no changes: they build the provisioner through CfnProvisionerFixture, so wiring the new provisioner there is all it took for them to exercise it. 40 tests across them still pass, and the schema-coverage gate finds no new attribute gaps. Monolith 6,457 to 5,954 lines, legacy types 47 to 44. * fix(cloudformation): keep an Events rule's identity and targets across an update provision runs again on every UpdateStack, and the rule arm got both halves of that wrong. An unnamed rule generated a fresh physical name each time, so the second update created a second rule and left the first behind, still matching events and still delivering to its targets. Name is createOnly and a rule's physical id is its name, so ctx.stablePhysicalName applies directly here, unlike the Batch types whose physical id is an ARN and which need the name read from a stored attribute. Targets were never driven to the template's desired state. PutTargets upserts by id and removes nothing, so a target dropped from the template stayed on the rule and kept receiving events indefinitely. The desired set is now reconciled after the put, which also covers a template that declares no Targets at all: that means no targets, so the sweep runs either way. The Targets property is checked for being an array before it is iterated. Five unit tests: an unnamed rule keeping its name, an explicit name still winning, a dropped target being removed, a cleared Targets list removing all of them, and an unchanged set removing nothing. * fix(cloudformation): surface a failed Events policy removal instead of hiding it Deleting an AWS::Events::EventBusPolicy wrapped the whole removal in a bare catch (Exception) that logged at debug and returned. Every failure was hidden: the statement stayed on the bus while the stack reported DELETE_COMPLETE, which is the outcome AGENTS.md rules out for deletes, since a real failure has to reach the stack as DELETE_FAILED. RemovePermission distinguishes its failures, unlike the Batch services where a single ClientException covers everything. It raises ResourceNotFoundException both when the bus is gone and when the statement is not on it, and those are the two cases that genuinely mean "already deleted". So the removal now goes through the shared CfnDeletes.safeDelete tolerating only that code, and anything else, a malformed statement id for instance, propagates. Two unit tests: an already-gone statement counting as deleted, and a ValidationException reaching the caller rather than being swallowed. * fix(cloudformation): drop the em dash from the moved Events javadoc The javadoc came across from CloudFormationResourceProvisioner verbatim. That file holds 30 em dashes but is an existing file, and the doc-style gate only scans the files a PR adds, so moving the prose into a new file is what surfaced a violation that was always there. * fix(cloudformation): read the prior event bus id from the provision context provision serves create and update, and it assigns the new physical id as it runs, so a resource-derived identity check can flip mid-method. The moved code read the prior bus name off the resource. It was captured before the assignment so the behaviour was right, but the convention exists precisely so the next edit cannot quietly break it. * fix(cloudformation): validate the Events policy StatementId The registry schema for AWS::Events::EventBusPolicy and the botocore model agree that StatementId is [a-zA-Z0-9-_]+, 1 to 64 characters, but nothing checked it, so an AWS-invalid value was accepted. It also made the physical id ambiguous. This provisioner keys a policy statement as "<bus name>|<statement id>" and the delete splits on the last separator. Neither the modeled bus-name pattern nor the statement-id one admits a pipe, so holding the value to the model closes that at source rather than by guessing at the split. * fix(cloudformation): restore rule targets when a stack update rolls back The reconciliation sweep this branch added can delete a live target, which nothing could put back: without a rollbackUpdate hook the resource fell to "Rollback is not implemented for AWS::Events::Rule", so a failed stack update left the rule no longer delivering to it and the stack reported UPDATE_ROLLBACK_FAILED. Before the sweep, targets were only ever upserted and there was nothing to restore. Snapshot the rule's targets before the first target call of an update and put them back on failure, following PipesCfnProvisioner: the snapshot is spent by whichever end the update reaches, restoring inside provision when this rule's own reconciliation failed and through rollbackUpdate when a later resource did. The restore is exact rather than additive, so a target the failed update added does not survive it. A restore that fails itself is recorded on the resource instead of thrown, so the stack reports the original failure. The snapshot carries the rule name, its bus and the region because the rollback hook is handed the stack resource alone, and a rule on a custom bus is keyed by that bus. This restores targets, not the rule's own properties, which putRule overwrites on the same path. That gap predates this branch. * refactor(cloudformation): hold the Events provisioner to a single injected service AGENTS.md requires a CloudFormation provisioner to inject only the service it wraps. This one also took an ObjectMapper, carried over from PipesCfnProvisioner when its rollback snapshot was modelled on that class. The package already has a second convention for exactly this job, and it is the one that satisfies the rule: LambdaEventInvokeConfigCfnProvisioner, the other snapshot-based rollback provisioner, holds a private static mapper and injects only its service, as do LambdaEventSourceMappingCfnProvisioner, Ec2NetworkCfnProvisioner and ReplacementCleanup. The configured mapper adds a 100 MB string limit and lenient empty-bean serialization. Neither reaches this code: EventBridge caps a bus policy near 10 KB and a target's Input at 8192 characters, both far under Jackson's default, and every type serialized here has real properties. No behaviour changes, so the existing tests are what prove the swap is inert. |
||
|
|
9d4e71f8a2 |
feat(securityhub): add organization configuration operations (#3161)
* feat(securityhub): add organization configuration operations * fix(securityhub): complete organization configuration contracts * fix(securityhub): harden organization contracts * test(securityhub): log tolerated organization state * test(securityhub): clean organization fixture state * test(securityhub): isolate organization cleanup failures * fix(securityhub): return modeled invalid access error |
||
|
|
fd3c4d9ab6 |
feat(cloudtrail): support AdvancedEventSelectors and CloudFormation Trail provisioning (#2720)
* feat(cloudtrail): support AdvancedEventSelectors in PutEventSelectors and S3 capture Adds AdvancedEventSelector/AdvancedFieldSelector models, JSON wiring through PutEventSelectors/GetEventSelectors, mutual-exclusivity enforcement against basic EventSelectors, and field-selector evaluation (Equals/NotEquals/StartsWith/NotStartsWith/EndsWith/NotEndsWith) in the S3 data-event capture path. Lets a trail exclude its own log-delivery bucket via resources.ARN NotStartsWith, avoiding the CloudTrail circular-logging cost problem. Basic-selector behavior is unchanged. * feat(cloudtrail): add CloudFormation provisioner for AWS::CloudTrail::Trail Handles create/update/delete of AWS::CloudTrail::Trail via CloudTrailService, applies EventSelectors or AdvancedEventSelectors (mutually exclusive, same JSON shapes as PutEventSelectors), starts logging when IsLogging is true, and sets the trail ARN as the resource's physical id and Arn attribute. Delete is idempotent when the trail is already gone. * feat(cloudtrail): implement ListTrails and trail tagging Adds ListTrails (returns Name/TrailARN/HomeRegion for trails visible in the region, including multi-region trails), plus AddTags/ListTags backed by per-trail stored state, keyed by trail name or ARN. * fix(cloudtrail): emit data events for the trail's own log deliveries CloudTrailLogWriter.flushTrail() wrote delivered log files via a direct S3Service.putObject() call, bypassing S3Controller.emitCloudTrailEvent() - the only place that recorded an S3 data event. A trail whose selector matched its own destination bucket (the exact circular-logging config from upstream issue #1192 / PR #1194) never saw its own deliveries, so the emulator could prove the dangerous config was live but not reproduce the loop it causes. flushTrail now calls cloudTrailService.emitS3DataEvent() after each delivery, so internal writes are evaluated against selectors identically to API-driven ones. Closes issues/0034. * docs: mark issue 0034 fixed * fix(cloudtrail): resources.type reflects actual S3 resource, not hardcoded object Advanced selector matching hardcoded resources.type to AWS::S3::Object for every event, so an object-scoped AdvancedEventSelectors exclusion (the real-world fix for the issue 0034 self-delivery loop) still let bucket-level calls like ListObjects through against the excluded bucket. Now derived per event from whether an object key is present. Live-verified on 1160-ct: loop confirmed unbounded and compounding with external writes, then confirmed stopped by the real AdvancedEventSelectors remediation, with this gap found and closed in the same pass. Details in issues/0034 and issues/0035. * docs(0034): add raw delivery-size timeline from 1160-ct verification Per-cycle size data showing the burst-compounding and the fix-stop point concretely, not just summarized. * fix(cloudtrail): match delete() to current CfnResourceProvisioner signature Upstream/main dropped the accountId parameter from CfnResourceProvisioner.delete() since this branch was originally authored; the provisioner never used accountId in its body, so the fix is a straight signature match with no behavior change. * docs(cloudtrail): regen action table and register CFN Trail resource type New ListTrails/AddTags/ListTags actions and the CloudFormation AWS::CloudTrail::Trail resource type need doc entries per the repo's docs-check gate. * fix(cloudtrail): enforce AddTags 200-tag list limit Botocore's AddTagsRequest.TagsList models a 200-item max (service-2.json, cloudtrail 2013-11-01); the handler accepted an unbounded list. RED test added first (addTagsRejectsMoreThanTwoHundredTags), confirmed failing (200 instead of 400), then fixed by rejecting oversized lists with TagsLimitExceededException, matching AWS's modeled error for AddTags. * fix(cloudformation): close two audit-control gaps in CloudTrailCfnProvisioner Local code review flagged two HIGH findings in the new CFN provisioner: - physicalId was only set after selector validation and startLogging succeeded, so a create that failed on the mutually-exclusive EventSelectors/AdvancedEventSelectors check left a real trail with no recorded physical id for the engine to clean up. Now set immediately after createTrail returns. - update only called startLogging when IsLogging was explicitly true, never stopLogging when it was explicitly false, so a template setting IsLogging: false on a currently-logging trail silently left logging enabled. RED tests confirmed both failures against the pre-fix code, then GREEN after the fix (6/6 provisioner tests, 51/51 CloudTrail suite). * docs(issues): ledger deferred CloudTrail local-review findings MEDIUM/LOW findings from the local code-review pass, plus a few inherited-not-ours items on code this branch didn't touch, that are real but out of scope for the CFN provisioner / advanced-selectors PR. * style(cloudtrail): brace unbraced conditionals in ListTrails and event-matching traversal Per AGENTS.md style rule (always use braces in conditionals). * fix(cloudtrail): avoid NPE on List.of(trailName) when TrailName is missing PutEventSelectors/GetEventSelectors called List.of(trailName) with a possibly-null trailName before findTrailOrThrow could validate it, throwing an NPE (500 InternalFailure) instead of the modeled TrailNotFoundException. Guard the lookup so the null flows through to the existing validation. * fix(cloudtrail): do not re-queue records on self-delivery emission failure flushTrail wrapped the self-delivery emitS3DataEvent call in the same try/catch as the S3 write. A failure there re-queued records that were already durably written, causing the next flush to redeliver the same batch. Split the write and the emission into separate try blocks so only a write failure triggers requeue. * docs(cloudformation): register AWS::CloudTrail::Trail in the resource-type inventory CfnResourceInventoryTest and the docs-sync resource-type table both derived from supported-resource-types.tsv, which never picked up CloudTrailCfnProvisioner's registration. * docs(issues): drop fork-local ledger files from the PR Per maintainer review, the issues/ ledger entries are fork-local tracking notes and are kept out of the upstream contribution. * fix(cloudformation): wire CloudTrailCfnProvisioner into CfnProvisionerFixture CfnProvisionerFixtureTest.everyProvisionerIsReachableThroughThePublicBuilderOrExplicitlyExempt failed because CloudTrailCfnProvisioner had no field, setter, or construction arm in the test fixture, so a test naming CloudTrailService would silently fall through to the stub arm instead of exercising the real provisioner. Add cloudTrailService field, cloudTrail(CloudTrailService) setter, and the discovered.add(new CloudTrailCfnProvisioner(...)) construction arm, mirroring the existing Route53Service wiring. * fix(cloudtrail): drop em-dashes from new test comments per AGENTS.md style check * fix(cloudtrail): reject mixed basic and advanced selectors with InvalidEventSelectorsException PutEventSelectors does not model InvalidParameterCombinationException; the error it declares for an invalid selector combination is InvalidEventSelectorsException (botocore cloudtrail/2013-11-01). Both the JSON handler and the AWS::CloudTrail::Trail provisioner now throw that code, and the integration test pins it. Also braces the remaining one-line conditionals in matchesAdvancedFieldSelector. |
||
|
|
af42564cb3 |
feat(lambda): provision AWS::Lambda::EventInvokeConfig (#3230)
* feat(lambda): provision AWS::Lambda::EventInvokeConfig The physical id is the registry schema's composite FunctionName|Qualifier identifier. A create puts the configuration, an update with the same identity applies the template's settings through the merge-style update call, and a changed function or qualifier is a replacement whose displaced configuration the ReplacementCleanup record deletes once the update commits or restores on rollback. The schema's MaximumRetryAttempts and MaximumEventAgeInSeconds bounds are checked before any call, as CloudFormation validates them before the handler runs. The Lambda docs now list the five event invoke config operations, which the page wrongly called not implemented, and say that asynchronous invocations do not yet apply the settings. * fix(lambda): update the event invoke config in place for equivalent names and roll back in-place changes A short name and the function's ARN address one configuration, so an update that changes between them updates in place under the prior physical id instead of recording a replacement whose cleanup would delete that one configuration. An in-place update keeps the settings it replaces on the resource, and a failed stack update puts them back in full. DestinationConfig is resolved before it is looked at, so a conditional that resolves to AWS::NoValue is omitted rather than sent as an empty destination set. The integration test reads stack events with XmlParser. * fix(lambda): keep the event invoke config rollback snapshot until the restore succeeds A restore that throws left no snapshot behind, so the next rollback attempt reported success without restoring anything. The snapshot is now spent only after the settings are back. |
||
|
|
725577416d |
refactor(cloudformation): move the EC2 networking types into Ec2NetworkCfnProvisioner (#3223)
* refactor(cloudformation): move the EC2 networking types into Ec2NetworkCfnProvisioner Batch 4 of the CloudFormationResourceProvisioner split. AWS::EC2::Subnet, InternetGateway, RouteTable, Route, NatGateway, EIP and SubnetRouteTableAssociation move into a new Ec2NetworkCfnProvisioner that injects only Ec2Service; the seven arms, their switch cases and type-list entries leave the monolith (SecurityGroup and Instance stay for now). Behaviour is preserved: same physical ids (the EC2 id, a generated one for a Route, the public IP for an EIP), same attribute keys, no delete arm (the switch had none for these types, so stack teardown still leaves them alone; that follows separately), and the same re-create-on-update path. The one addition is the Route's CidrBlock attribute, the read-only property the registry schema declares, set to the destination the route was created with. The read-only attributes Floci does not emulate (Subnet NetworkAclAssociationId, Ipv6CidrBlocks, BlockPublicAccessStates; NatGateway EniId, AutoProvisionZones, AutoScalingIps, RouteTableId) are recorded in getatt-attribute-gaps.tsv with reasons, since the coverage gate starts auditing these types once they leave the switch. The unit test covers each type's physical id and exact attribute set with a mocked service. * fix(cloudformation): delete the EC2 networking resources a stack created The legacy switch had no delete arm for Subnet, InternetGateway, RouteTable, Route, NatGateway, EIP or SubnetRouteTableAssociation, so DeleteStack logged "No delete implemented" and left all seven behind. Ec2NetworkCfnProvisioner now deletes each through its own Ec2Service call, tolerating only that type's not-found code (InvalidSubnetID.NotFound, InvalidInternetGatewayID.NotFound, InvalidRouteTableID.NotFound, InvalidRoute.NotFound, NatGatewayNotFound, InvalidAllocationID.NotFound, InvalidAssociationID.NotFound); a DependencyViolation still fails the stack delete, as on AWS. A Route's physical id becomes <RouteTableId>|<destination>, the registry primary identifier and what Ref returns on AWS; the generated LogicalId-<random> id identified nothing, so a route could never have been deleted. An id without the separator, from a stack created under the switch, is left alone rather than guessed at. An EIP's Ref is its public IP, so the release uses the AllocationId recorded at create time and falls back to a lookup by address. CloudFormationEc2NetworkingIntegrationTest provisions a public/private networking stack the way CDK lays one out, checks the Ref and Fn::GetAtt shapes, and asserts the delete removes every id from the EC2 describe calls. * fix(cloudformation): keep EC2 networking resources across stack updates instead of re-creating them provision runs again on every UpdateStack, and the switch created a new subnet, gateway, route table, route, NAT gateway, EIP and association each time, re-pointing the stack at the copies and leaving the originals behind. Ec2NetworkCfnProvisioner now describes the prior entity and keeps it when its create-only properties are unchanged (Subnet: VpcId, CidrBlock, AvailabilityZone; RouteTable: VpcId; NatGateway: SubnetId, AllocationId; association: both; Route: table and destination; InternetGateway and EIP: nothing a template can change), applying the mutable ones in place (MapPublicIpOnLaunch, a route's target through ReplaceRoute). A changed create-only property creates the replacement, and the ReplacementCleanup record deletes the displaced entity once the update commits or restores it on rollback, as CloudFormation does; a prior entity gone out of band is created anew. The end-to-end test deploys the same template twice and asserts every id survives, then changes the public subnet's CIDR and asserts the subnet and the NAT gateway inside it are replaced and the displaced ones removed. The VPC is created through the EC2 API and passed in as a literal, since Ec2VpcCfnProvisioner still re-creates a VPC on every update (#3033). * fix(cloudformation): apply Tags to EC2 networking resources The switch ignored the Tags property on Subnet, InternetGateway, RouteTable, NatGateway and EIP, so a tagged template produced untagged resources and DescribeSubnets and friends showed no tagSet. Ec2NetworkCfnProvisioner now writes the resolved tags through CreateTags on create (a NAT gateway takes them on its own create call) and reconciles them on an in-place update: keys the template dropped are removed with DeleteTags, the rest rewritten. A template with no Tags property leaves whatever the entity carries, as before. * fix(cloudformation): honour ConnectivityType on a CloudFormation NAT gateway The switch created every AWS::EC2::NatGateway as public, whatever the template said, so a private NAT gateway (no EIP, the shape a private-only VPC uses) came out public with no address. The provisioner now passes ConnectivityType through, defaulting to public as the schema does, validates the pairing the way AWS does (a public gateway requires AllocationId, a private one must not carry one) with ValidationError, and treats ConnectivityType as the create-only property it is: a change replaces the gateway. * fix(cloudformation): validate the required properties of the EC2 networking types A template that omitted VpcId on a Subnet or RouteTable, RouteTableId or SubnetId on an association, or RouteTableId or a single destination on a Route passed the null through to Ec2Service, which answered with its own parameter errors or a NullPointerException. The provisioner now fails the resource with ValidationError using the repo's wording ("AWS::EC2::Subnet requires VpcId"; a Route requires exactly one of the three destination properties), before any service call, so the stack event names the property. * fix(cloudformation): never orphan an EC2 networking entity when a step after its create fails Tags were applied before the resource had its physical id, and the replacement record is only written when provision returns, so a CreateTags failure after the EC2 create left the new subnet, gateway, route table or EIP behind: the engine deletes a failed create only when it can see the id (and the rollback-owned marker), and on a failed update it restores the previous resource metadata and forgets what the attempt made. The provisioner now writes the id and attributes right after the create and runs the following steps under a guard that, when this provision created the entity, deletes it again before the failure propagates; a reused entity is left as it is. * fix(cloudformation): roll back in-place changes to EC2 networking resources rollbackUpdate answered true for a reused gateway, route table, NAT gateway or EIP on the grounds that nothing about them is mutable, which stopped being true once Tags were applied in place: a later resource failing produced UPDATE_ROLLBACK_COMPLETE with the failed template's tags still on the entity. A subnet or route changed in place reported not rolled back and stayed changed. The provisioner now snapshots what an in-place update is about to change on a reused entity (the prior tags and the keys it writes, a subnet's prior MapPublicIpOnLaunch, a route's prior target) into an internal __FlociEc2NetworkPrior attribute before the change, and rollbackUpdate restores it: keys the update added are removed and the prior tags written back, the subnet attribute and the route target put back through ModifySubnetAttribute and ReplaceRoute. completeUpdate and clearUpdate drop the snapshot. Every one of the seven types now rolls back for real; the one case left is the resource whose own provision failed mid-way, whose previous metadata the engine restores before any rollback runs, as for every provisioner. The end-to-end test flips a route table tag and a subnet's MapPublicIpOnLaunch next to a resource that cannot be created and asserts UPDATE_ROLLBACK_COMPLETE leaves both as before. * fix(cloudformation): require SubnetId on a CloudFormation NAT gateway The registry schema declares no required properties for AWS::EC2::NatGateway, but CreateNatGateway cannot do anything without a subnet and Ec2Service answered a missing one with InvalidSubnetID.NotFound for "null". The provisioner now fails the resource with the repo's ValidationError wording before any service call, as it does for the other required properties. Also bounds the test helper's varargs loop so an odd argument count cannot read past the array, which CodeQL flagged. * fix(cloudformation): key a CloudFormation route by the canonical CIDR the service stores Ec2Service canonicalises an IPv4 destination on CreateRoute (10.40.0.18/24 is stored as 10.40.0.0/24), but the provisioner built the physical id, the CidrBlock attribute and the reuse check from the template's raw value. A template with a non-canonical destination therefore missed its own route on every unchanged update and tried to create it again, which RouteAlreadyExists refused, and Ref exposed a string AWS would never return. The provisioner now runs the IPv4 destination through the same CidrCanonicalizer before using it as an identifier; IPv6 and prefix-list destinations are unchanged, and the create and replace calls still pass the raw value, which the service canonicalises again. * fix(cloudformation): undo a partial in-place change when an EC2 networking update fails mid-way The in-place snapshot lived only on the attempted StackResource. When the update of a reused entity failed after its first change (DeleteTags done, CreateTags refused), the engine discarded that object, restored the previous metadata and never called rollbackUpdate, so the entity kept the partial change under an UPDATE_ROLLBACK_COMPLETE. The guard that already undoes a create when a later step throws now also restores a reused entity from its snapshot before the failure propagates, and the NAT gateway's reuse-path tags and the route's in-place re-target run inside it. The engine's metadata restore then matches the entity again. * fix(cloudformation): report a failed compensation on an EC2 networking resource instead of hiding it When the undo inside the guard failed too (the delete of an entity this provision created, or the restore of a reused one from its snapshot), the failure was only attached as suppressed, the snapshot was already gone, and the engine, seeing no failure marker on the attempted resource, restored the previous metadata and reported UPDATE_ROLLBACK_COMPLETE over a partially updated entity or a leaked create. The guard now uses the engine's contract for exactly this, as IotCfnProvisioner and IamRoleCfnProvisioner do: a created entity carries __FlociRollbackOwned while the steps run, so a failed undo leaves it for the engine's create rollback to delete and report; a reused entity keeps its snapshot when the restore fails, and the reason goes into __FlociUpdateRollbackFailure, which the engine copies onto the committed resource so the rollback walker reports UPDATE_ROLLBACK_FAILED with it. A successful undo or restore clears both markers; the original failure still propagates. * fix(cloudformation): keep a replacement that a failed update could not remove owed to the next cleanup During a replacement update, when a step after the EC2 create failed and the undo delete of the new entity failed too, the rollback-owned and failure markers sat on the attempted resource, which the engine discards while restoring the previous one: the stack reported UPDATE_ROLLBACK_FAILED, correctly, but the new entity's id went with the attempt and nothing would ever retry deleting it. The entity is now listed as a non-retainable entry in the ReplacementCleanup record (new recordOrphan), and the engine's mergeFailedUpdateResourceTracking hook, which so far carried only ApiGatewayV2 tracking, merges the attempt's record onto the restored resource (new mergeDisplaced), for every provisioner that uses the helper. The engine already runs that record before every committed update and before a stack delete, retrying up to three times and reporting the failure otherwise, so the orphan is removed at the next opportunity. ReplacementCleanupTest pins the helper; the merge hook is covered next to its existing case. |
||
|
|
4944764fa3 |
feat(inspector2): add organization configuration operations (#3162)
* feat(inspector2): add organization configuration operations * fix(inspector2): complete organization contracts * fix(inspector2): scope organization account state * test(inspector2): log tolerated organization state * test(inspector2): isolate organization cleanup |
||
|
|
d99675a512 |
feat(controlcatalog): add control lookup operations (#3130)
* feat(controlcatalog): add control lookup operations * fix(controlcatalog): complete control lookup contracts * test(controlcatalog): verify pagination continuation * fix(controlcatalog): move control model to package * fix(controlcatalog): integrate service storage lifecycle |
||
|
|
b9039fef1d |
feat(redshift-data): emulate the Amazon Redshift Data API (#3186)
* feat(redshift-data): resource resolver, connection factory, statement store, service registration * feat(redshift-data): field mapper, column metadata, SQL parameter binding * feat(redshift-data): execute, describe, and paged result retrieval * feat(redshift-data): batch execution, list statements, cancel * feat(redshift-data): schema introspection operations * test(redshift-data): end-to-end Data API over a real cluster plus SDK compatibility test * docs(redshift-data): document the Redshift Data API surface * fix(redshift-data): address code review findings - rejectMultiStatement now reuses the SQL tokenizer so a semicolon inside a comment, string literal, or dollar-quoted block no longer rejects a valid single statement - GetStatementResultV2 gains unit coverage for the typed and CSV envelopes - CSV output is RFC 4180 quoted (embedded comma, quote, CR, LF) - batch rollback is asserted transactionally in the integration test - RedshiftDataFieldMapper logs a swallowed blob-read SQLException - RedshiftPid/RedshiftQueryId use a non-negative hash - NextToken that decodes to a negative offset is rejected - CancelStatement leaves a FAILED statement FAILED - DescribeTable paginates ColumnList and emits NextToken - DbUser is echoed on the SecretArn path - the statement store no longer builds its sweeper executor in the test constructor * fix(redshift-data): address PR #3186 review findings - SQL scanner handles PostgreSQL escape strings (E'...'): a backslash-escaped quote no longer ends the literal and mis-detects a following :name as a bind marker; plain '...' literals still treat backslash as an ordinary character - ListStatements clamps MaxResults to 1..100 so MaxResults=0 no longer emits the same NextToken forever - DescribeTable matches Table / Schema exactly (=) instead of LIKE, so a name containing _ or % cannot merge other tables' columns into ColumnList - register the service in the README category table - drop a stray em dash from the neighbouring services.yaml comment * fix(redshift-data): bind string parameters untyped so real PostgreSQL infers the column type CI ran the integration test against a real Redshift (PostgreSQL 15) cluster and parameterisedStatement failed: a string bound to an int column via setString raised "operator does not exist: integer = character varying". H2 in PostgreSQL mode coerces it, so the unit test missed it. - RedshiftDataConnectionFactory adds stringtype=unspecified to the JDBC URL, so setString sends the value untyped and the server infers the target type, matching how AWS binds Redshift Data API parameters - ListStatements now rejects MaxResults above 100 with ValidationException instead of silently clamping (PR #3186 re-review) - RedshiftDataOperationsTest uses JBoss Logging, not java.util.logging (PR #3186 re-review) * fix(redshift-data): back the statement store with StorageFactory The store held a bare ConcurrentHashMap outside the configured storage and lifecycle model. It now obtains an account-aware backend through StorageFactory ("redshift-data", statements.json), the same as Athena's query store, resolved to the global storage mode via the catalog descriptor. Default mode stays memory, so statements are still lost on restart as documented; the 24h TTL sweep now walks every account partition and deletes per account since the sweep thread has no request context. StoredStatement is annotated for reflection and field-visible serialization so persistent modes round-trip it. * test(redshift-data): cover StoredStatement serialization round-trip and values() The StorageFactory-backed store serializes StoredStatement in persistent modes. Adds a round-trip test through the exact mapper PersistentStorage builds, covering the ArrayNode, enum, Instant, and nested sub-statement fields plus the field-visibility annotation, and a values() test. * fix(redshift-data): register the nested Status enum for reflection PersistedModelReflectionTest walks every type reachable from a StorageFactory persistence root; StoredStatement.status pointed at an unregistered enum, so native-image deserialization of a persisted statement would fail on restart. |
||
|
|
5864b013d2 |
feat(detective): add organization member operations (#3190)
* feat(detective): add organization member operations * fix(detective): align organization operations with AWS * docs(detective): clarify member listing * fix(detective): enforce organization administration contracts |
||
|
|
2541f1b68d |
refactor(cloudformation): move the ElasticLoadBalancingV2 types into ElbV2CfnProvisioner (#3115)
* refactor(cloudformation): move the ElasticLoadBalancingV2 types into ElbV2CfnProvisioner AWS::ElasticLoadBalancingV2::LoadBalancer, TargetGroup, Listener and ListenerRule leave the legacy switch together with the ELBv2-only helpers (ELB-safe name generation, full-name derivation, matcher, certificates, action and rule-condition parsing). The monolith no longer depends on ElbV2Service; its constructor loses that parameter and CfnProvisionerFixture passes one argument less. Behaviour is unchanged except where the move fixes it. An unnamed load balancer or target group keeps the name its first execution generated, read back from the LoadBalancerName / TargetGroupName attribute since the physical id is the ARN; the switch generated a fresh name on every pass and left the previous resource behind. Listener and ListenerRule branch create-vs-update on the provision context, and a listener moved to another load balancer or a rule moved to another listener (both create-only properties) is created as a replacement instead of being modified under the old parent; one removed out of band is created again. A non-integer Port or Priority is a ValidationError instead of an uncaught NumberFormatException. Deletes call the service directly: it already returns silently for an unknown ARN, and its refusals (ResourceInUse, OperationNotPermitted) must keep failing the stack delete. Fn::GetAtt follows the registry schemas' readOnly properties. The five load balancer attributes, ListenerArn, RuleArn and IsDefault are as before; TargetGroup gains LoadBalancerArns (comma-joined, empty until a listener forwards to the group), which the switch never set and the schema coverage test now requires. CloudFormationIntegrationTest keeps asserting the stack outputs end to end; ElbV2CfnProvisionerTest covers the four types against a mocked ElbV2Service. The whole CloudFormation test package passes on this tree apart from the pre-existing ACM schema-gap row. * refactor(cloudformation): clean up the ELBv2 entity a replacing update displaced Review found that a listener moved to another load balancer, or a rule moved to another listener, was created anew while the displaced one kept running, holding its target groups in use and never appearing in the stack's cleanup. The same was true of a renamed load balancer or target group. Every replacing update of the four types now enters the replacement-cleanup lifecycle the engine already runs (UPDATE_COMPLETE_CLEANUP_IN_PROGRESS, DELETE_IN_PROGRESS on the prior ARN, three attempts, UpdateReplacePolicy Retain honoured). ReplacementCleanup is the plain bookkeeping for provisioners without a rollback snapshot, beside the richer record PipesCfnProvisioner keeps; the provisioner delegates the four interface hooks to it and deletes through its own delete arm. The direct service deletes stay as they were: ElbV2Service returns silently for an unknown ARN, so there is no already-gone code for CfnDeletes.safeDelete to tolerate, and its refusals (ResourceInUse, OperationNotPermitted) must keep failing the stack delete. * refactor(cloudformation): roll an ELBv2 replacement back and clean up dependents first Review found two gaps in the replacement handling. A replacement this provisioner produces (a listener moved to another load balancer, a rule moved to another listener, a renamed load balancer or target group) could not be rolled back when a later resource failed the stack update: rollbackUpdate had no implementation, so the engine reported "Rollback is not implemented", left the replacement running and the stack in UPDATE_ROLLBACK_FAILED. And the committed-update cleanup walked resources in creation order, so a target group renamed in the same update as its listener was moved would be deleted while the old listener still forwarded to it, fail ResourceInUse three times and be left behind. ReplacementCleanup now keeps the attributes the resource carried before the provision alongside the prior physical id, and rollback() puts both back and deletes the replacement through the provisioner's own delete arm, spending the record before the delete so a failing delete cannot put the restored prior on the next cleanup's list. The provisioner records once, in provision(), and delegates rollbackUpdate. A load balancer or target group without a record has nothing to put back, every property being create-only and the update having only described the existing entity, so it rolls back as complete; a listener or rule modified in place keeps the engine's existing handling, as under the switch. CloudFormationService's committed cleanup walks resources in reverse creation order, as every other teardown walk does. CloudFormationElbV2ReplacementIntegrationTest drives both through the engine: a renamed target group plus a moved listener end with DELETE_COMPLETE events on both prior ARNs and neither entity left, and a moved listener followed by a failing resource lands the stack in UPDATE_ROLLBACK_COMPLETE with the prior listener restored and the replacement gone. * refactor(cloudformation): order replacement cleanup by the template and keep an orphaned replacement owed Two gaps in the replacement lifecycle, both found in review. The committed cleanup walked the resource map reversed, but the map is insertion order and a resource a later update added sits after the resources that depend on it, so a target group added after its listener would still be deleted first, fail ResourceInUse three times and be left behind. The cleanup now walks resourcesInCreationOrder reversed, the template's dependency order, exactly as DeleteStack does; a resource the template no longer names sorts last. And a rollback whose delete of the replacement failed forgot the replacement: the record was cleared before the delete, so nothing could remove that entity later even though UPDATE_ROLLBACK_FAILED is updatable here and both the next committed update and DeleteStack run the cleanup first. The record is now a list of every entity owed a delete: a replacement whose rollback delete fails is listed in the prior's place, never retained (a failed update created it), and the prior's own id and attributes are kept beside the list only while this update's replacement can still be rolled back. Every listed entity gets its attempt on every cleanup call, so one that keeps failing does not leave the others untried. The load balancer and target group rollback note now says what is true: this provisioner never modifies an existing one, so an update that kept the name has nothing to put back (in-place changes to their updatable properties are not applied, as under the switch). CloudFormationElbV2ReplacementIntegrationTest gains the appended-dependency case: a target group added by a later update than its listener, then both replaced, ends with both prior ARNs DELETE_COMPLETE. * refactor(cloudformation): keep a displaced entity owed until its own attempts are used up Review found that once any listed entity reached three failed deletes, the engine's give-up cleared the whole record, forgetting entities that still had attempts left. clearUpdate now drops only the entries that used up their attempts (and the rollback fields), and the cleanup result reports the lowest attempt count among what remains, naming that entity, so the engine keeps retrying until every remaining entity has had its own three attempts. * refactor(cloudformation): tolerate the ELBv2 not-found codes on delete and name one entity per cleanup The four ELBv2 deletes go through CfnDeletes.safeDelete with the not-found code ElbV2Service defines for each type (LoadBalancerNotFound, TargetGroupNotFound, ListenerNotFound, RuleNotFound), the convention every other per-service provisioner follows. The service's delete paths return silently on an unknown ARN today, so nothing changes in behaviour; its refusals (ResourceInUse, OperationNotPermitted) are not in the list and keep failing the stack delete. The replacement cleanup picks the entity it works on through one rule, the owed entry with the fewest attempts, for both the physical id it announces (DELETE_IN_PROGRESS) and the one it reports on failure (DELETE_FAILED), so a cleanup's progress and failure events name the same thing. The unused parameter on the record's region lookup goes. |
||
|
|
7a5ae965e5 |
feat(budgets): add full service emulation (#3165)
* feat(budgets): add budget and notification operations * feat(budgets): complete service emulation * fix(budgets): enforce account and action contracts |
||
|
|
0321ae0ac8 |
refactor(cloudformation): move Cognito UserPool and UserPoolClient to CognitoCfnProvisioner (#3164)
* refactor(cloudformation): move Cognito UserPool and UserPoolClient to CognitoCfnProvisioner
Batch 3 of the CloudFormationResourceProvisioner split. AWS::Cognito::UserPool and
AWS::Cognito::UserPoolClient join the provisioner that already owns UserPoolDomain;
the two arms, their switch cases, the type-list entries, the Cognito-only
resolveStringMapOrNull helper and the CognitoService dependency leave the monolith.
Behaviour is preserved except for what the split's conventions require:
- the create/update branch reads ctx.isUpdate() instead of the resource's physical
id, which provision overwrites as it runs
- deletes go through CfnDeletes.safeDelete tolerating only ResourceNotFoundException;
a pool that still has a domain keeps failing the stack delete with
InvalidParameterException, as on AWS
- the client also exposes Name, the read-only attribute the registry schema declares
(ClientName stays for now), so CfnSchemaCoverageTest needs no gaps row
- the ReplacementCleanup hooks are wired for both types; nothing replaces yet, so
they are inert until create-only properties are honoured
The unit test covers both types with a mocked service: request map and generated
names, update carrying the prior id, the exact attribute sets, positional client
arguments, and delete tolerance. The domain delete path now branches on type first,
since a pool resource also carries a UserPoolId attribute.
* fix(cloudformation): replace a Cognito user pool client when its create-only properties change
UserPoolId and GenerateSecret are createOnlyProperties in the AWS::Cognito::UserPoolClient
registry schema: on AWS a change to either creates a new client and deletes the old one
after the update commits. The provisioner passed the new pool id to UpdateUserPoolClient,
which fails with ResourceNotFoundException because a client is only found through the
pool that owns it, and a changed GenerateSecret was silently ignored since the update
call has no such parameter.
The provisioner now looks the prior client up by id, updates in place only when both
create-only properties are unchanged, and otherwise creates the replacement; the
ReplacementCleanup record deletes the displaced client once the update completes or
restores it on rollback. A prior client that is already gone is created anew. The by-id
describeUserPoolClient overload is new on CognitoService, mirroring its delete pair.
* fix(cloudformation): resolve Cognito UserPoolTags as the map the schema declares
AWS::Cognito::UserPool.UserPoolTags is an object (the type's tagProperty), not the
[{Key, Value}] list most types carry. The provisioner parsed it with the list helper,
which yields nothing for a map, so the tags only reached the service through the raw
property map, where a non-string tag value arrives as a number. The tags are now
resolved as a string map and put explicitly, on create and on update.
* fix(cloudformation): give Fn::GetAtt ProviderName on a Cognito user pool AWS's shape
The attribute returned the pool name. On AWS it is cognito-idp.<region>.amazonaws.com/<pool id>,
the value templates feed into an identity pool's CognitoIdentityProviders (CDK derives the
same string in UserPool.fromUserPoolArn). ProviderURL deliberately stays Floci's local
issuer, <base-url>/<pool id>, since that is the iss of the tokens Floci mints and a template
wiring it into a JWT authorizer must validate locally; the generated resource-type table
now says so.
* fix(cognito): apply PoolName on UpdateUserPool so a CloudFormation rename takes effect
UpdateUserPoolRequest carries PoolName in the service model and AWS::Cognito::UserPool
lists UserPoolName as updatable in place, but updateUserPool only ran populateUserPool,
which never sets the name, so a renamed pool kept its old name through both the API and
a stack update. The service now applies a non-blank PoolName.
The provisioner sends PoolName on update only when the template names the pool: an
unnamed pool keeps the name its first execution generated instead of being renamed to a
freshly generated one on every update.
* fix(cloudformation): expose only the schema's attributes on a Cognito user pool client
The AWS::Cognito::UserPoolClient registry schema declares ClientId, Name and ClientSecret
as its read-only properties. ClientName is a request property, not an attribute; on AWS
Fn::GetAtt Client.ClientName fails template validation, so no working template depends on
it. It is dropped in favour of Name.
* fix(cloudformation): validate Cognito user pool client properties instead of dropping them
A non-integer AccessTokenValidity, IdTokenValidity or RefreshTokenValidity was parsed to
null and silently ignored, so the template's intent was lost without a word. The
provisioner now fails the resource with ValidationError "Value of property X must be an
integer.", as the ECS provisioner does for DesiredCount. UserPoolId, the schema's one
required property, is likewise rejected when missing rather than passed through as null.
* test(cloudformation): cover Cognito user pool client replacement end to end
Through the CloudFormation API: a client moved to another pool and one whose
GenerateSecret flips are each replaced, with the displaced client gone once the update
completes; a rename updates the client in place; Fn::GetAtt Name and the pool's
ProviderName carry their AWS shapes; deleting the stack removes client and pools.
* fix(cloudformation): drop a stale ClientSecret attribute when a replacement client has none
The engine hands an update the prior attributes, and the provisioner only wrote
ClientSecret when the new client had one, so replacing a secret-bearing client with
GenerateSecret: false left the displaced client's secret readable through Fn::GetAtt.
The attribute is now removed when the client has no secret; rollback still restores it
from the cleanup record's snapshot.
* fix(cloudformation): refuse a Cognito client replacement that would reuse the prior client id
AWS client ids are random, so a replacement never collides with the client it replaces.
Under Floci's floci:override-cognito-client-id tag the id follows the client name, and a
replacement that kept the name (a GenerateSecret flip, or a move to a pool with the same
override) was created under the prior id: the store overwrote the prior client, the cleanup
record saw an unchanged id and recorded nothing, and the update could not be rolled back.
Neither overwriting nor delete-then-create can preserve the prior client, so the update is
now refused with ValidationError before anything changes and the stack rolls back intact.
CognitoService gains deterministicClientIdFor(userPoolId, clientName), sharing the id rule
with createUserPoolClient; the provisioner compares it with the prior id in the replacement
branch only.
* fix(cloudformation): refuse a Cognito client whose derived id another client already holds
The round-1 guard compared the derived id only with the client being replaced. Under
floci:override-cognito-client-id the store is keyed by client id alone, so a name whose
derived id belongs to any other client, in this pool or another, would overwrite that client
on create, and neither the cleanup record nor rollback knows about it. The guard now refuses
whenever an existing client holds the derived id, on a fresh create as well as a replacement.
* fix(cloudformation): make the deterministic Cognito client-id guard atomic and ignore orphaned records
Two gaps in the round-2 guard. CloudFormationService runs stack operations on a cached
thread pool and CognitoService's client store write is unconditional, so two stacks could
both find a derived id free and the later create overwrote the earlier stack's client; the
existence check and the create now run under one lock whenever the id is derived from the
name. And deleting a user pool does not remove its clients yet (#2949 adds that), so a client
of a deleted pool kept its derived id and the guard refused a legitimate create in another
pool; a holder whose pool no longer exists is now treated as a stale record the create may
take over. Random ids take neither path.
|
||
|
|
631df1dc01 |
feat(cloudformation): provision AWS::Backup::BackupVault (#3125)
Per-service provisioner over BackupService. Ref and Fn::GetAtt BackupVaultName are the vault name and Fn::GetAtt BackupVaultArn its ARN. The name is the physical id and createOnly, so an unnamed vault keeps its generated name across updates instead of getting a second vault, and a rename is refused as a replacement. EncryptionKeyArn is createOnly as well. BackupVaultTags are driven to the template's set on update, untagging dropped keys since TagResource only adds. Stack deletion deletes the vault and leaves the non-empty-vault refusal to surface as on AWS. The docs generator gains a label and row position for the new AWS::Backup namespace. Ported from lex00/floci#118. Tracked in lex00/floci#192. |
||
|
|
3a4982c294 |
feat(cloudformation): provision AWS::ApiGateway::UsagePlan and UsagePlanKey (#3123)
* feat(cloudformation): provision AWS::ApiGateway::UsagePlan and UsagePlanKey Per-service provisioner over ApiGatewayService. A plan's Ref and Fn::GetAtt Id are the plan id. Every plan property is mutable, so an update patches name and description in place and adds or removes API stages as the template moves them. Tags are driven to the template's desired state through the new replaceUsagePlanTags. A key's Ref and Fn::GetAtt Id are <keyId>:<usagePlanId>, as on AWS. All three of its properties are createOnly, so a change to any of them is refused as a replacement rather than re-associating a different key under the old id. The composite id is what lets delete find the association without scanning every plan. Stack deletion removes the plan and the association and tolerates either being gone already. Ported from lex00/floci#118. Tracked in lex00/floci#192. * fix(cloudformation): validate usage plan key properties and survive a recreated plan An association only counts as still there while its plan does. deleteUsagePlan leaves associations behind, and a plan recreated after an out-of-band delete has a new id, so the stale association no longer reads the new UsagePlanId as a rename. KeyType must be API_KEY and both ids must be present, per the registry schema, and a non-list ApiStages is refused instead of read as empty. replaceUsagePlanTags strips the reserved id-override tags the way createUsagePlan does rather than refusing them. * fix(cloudformation): check a usage plan key's KeyId even while recovering drift The createOnly checks sat behind the association lookup, so a template that changed KeyId while its plan was missing created an association for the new key instead of refusing the change. KeyId is checked against the prior composite id either way now. UsagePlanId stays conditional, since a plan recreated after an out-of-band delete legitimately has a new id. |
||
|
|
6264b09a28 |
feat(identitystore): add full service emulation (#3159)
* feat(identitystore): add groups users and memberships * feat(identitystore): add full service emulation * fix(identitystore): validate update attribute paths |
||
|
|
ee2f55b784 |
feat(iot): MQTT over TLS listener on 8883 (#3142)
* feat(iot): floci.services.iot.mqtt.tls-port (default 8883) * feat(iot): key manager that follows the TLS registry's current default certificate * feat(iot): MQTT over TLS listener on 8883 Second MqttServer sharing the plaintext handlers, opened when floci.tls.enabled is true. Its key material is the TLS registry's default configuration through a reloading key manager, so a server certificate reissued for a learned hostname is presented on the next handshake without rebuilding the listener. Client certificates are requested and carried through the handshake, not yet verified. * docs(iot): MQTT over TLS on 8883 * feat(iot): keep retired server key material readable for the life of a handshake A retired generation of ReloadingKeyManager stays readable for 60 seconds after its replacement, longer than Vert.x's 10 second handshake timeout, and is dropped on the next reload after that. Any number of reloads between JSSE choosing an alias and reading its key and chain now resolve to matching material. * fix(iot): wait for a failed MQTT listener to close before reporting the start failure |
||
|
|
d80734e6de |
feat(account): add alternate contact operations (#3118)
* feat(account): add alternate contact operations * fix(account): complete alternate contact contracts |
||
|
|
17af9590c7 |
feat(cloudformation): provision AWS::AutoScaling::ScalingPolicy (#3124)
* feat(cloudformation): provision AWS::AutoScaling::ScalingPolicy Per-service provisioner over AutoScalingService. Ref and Fn::GetAtt Arn are the policy ARN and Fn::GetAtt PolicyName the generated name, since the type has no PolicyName property. PutScalingPolicy is an upsert keyed by group and name, so an update reuses the name recorded at create time and rewrites the policy in place. AutoScalingGroupName is createOnly, so moving the policy to another group is refused as a replacement rather than left behind on the old group. Omitted ScalingAdjustment and Cooldown take the Query handler's defaults. Ported from lex00/floci#118. Tracked in lex00/floci#192. * fix(cloudformation): scope the scaling policy lookup to its group Policy names are unique only within a group. The update path now looks for the recorded name on the template's group first and treats a same-named policy on another group as a move only when it is not there, so an unrelated group's policy cannot block a valid update. * fix(cloudformation): take a scaling policy's identity from its recorded group Finding the recorded name on the group the template asks for read the destination group's own same-named policy as this resource, so a move overwrote that policy and orphaned the original. The group is recorded on the resource at create time and compared directly instead, which drops both DescribePolicies lookups. A resource provisioned before the attribute existed has no prior group and keeps the previous behaviour. |
||
|
|
cbde58f238 |
feat(cloudformation): provision AWS::ApiGateway::ApiKey (#3122)
* feat(cloudformation): provision AWS::ApiGateway::ApiKey Per-service provisioner over ApiGatewayService. Ref and Fn::GetAtt APIKeyId both yield the key id. Description, Enabled and Tags update in place. Name, Value and GenerateDistinctId are createOnly, so a change to any of them is refused as a replacement rather than applied to the existing key. A template that omits Name keeps its generated name across updates instead of minting a second key. Stack deletion deletes the key and tolerates one already gone. ApiGatewayService gains replaceApiKeyTags so an update can drop a tag the template no longer declares. Ported from lex00/floci#118. Tracked in lex00/floci#192. * fix(cloudformation): keep an API key's create-time reserved tags across updates replaceApiKeyTags checked the whole desired map against the reserved list, so a key created with a reserved floci tag could never change an ordinary tag afterwards. Only a reserved tag that is new or changed is an update-time override attempt and is refused now. Adds a test that dropping Description from the template clears it on the key. |
||
|
|
ba3dd657b6 |
feat(cloudformation): provision AWS::SNS::TopicPolicy (#3126)
Adds the type to SnsCfnProvisioner beside Topic and Subscription. A topic policy is not an entity of its own: it writes the Policy attribute of every topic the template lists, so re-applying on UpdateStack is what an update means. The document goes through resolveJsonAttribute like FilterPolicy, so a Ref to a topic inside Resource resolves to the ARN. The physical id is synthetic and stays put across updates, as AWS::SQS::QueuePolicy does, and Ref and Fn::GetAtt Id both return it. An empty Topics list or a missing PolicyDocument is refused. Delete touches nothing, as with QueuePolicy. Ported from lex00/floci#118. Tracked in lex00/floci#192. |
||
|
|
d45c64545d |
feat(iot): evaluate the SQL subset of topic rules (#3021)
* feat(iot): evaluate the SQL subset of topic rules Topic rules only extracted the FROM topic filter and sent the whole payload to every action. The SELECT list and the WHERE clause were ignored, so a rule fired on every matching topic and its actions never received the projected document. Add a small hand written parser and evaluator under services/iot/rules for the SELECT/FROM/WHERE subset AWS rules use most: '*', dotted field paths, topic() and topic(n) with optional AS aliases, and a WHERE of startswith, endswith, comparison operators, AND, OR, NOT and parentheses. A missing field or a mismatched type is Undefined as in AWS, so an undefined predicate never fires the rule. A statement outside the subset is not rejected. It is stored as sent and keeps its previous behaviour, firing on every matching topic with the whole payload, and logs one WARN naming the token that could not be parsed. floci.services.iot.rule-sql-strict, off by default, rejects it with SqlParseException the way AWS does. Each rule is parsed once: the result is held on the rule object as a transient field that is never persisted and is rebuilt on the first publish after a restart. * fix(iot): count real tokens in the rule SQL limit and compare numbers exactly The token limit counted the end marker, so a statement with exactly 1000 tokens was rejected and the error named the end of input. Mixing a whole number with a decimal literal went through double, so 9007199254740993 compared equal to 9007199254740992.0. * fix(iot): keep rule SQL decimal literals exact Double.parseDouble rounded a decimal literal before evaluation, so level = 9007199254740993.0 matched a payload holding 9007199254740992. * fix(iot): treat a rule SQL number too large for a double as Undefined Comparing an infinity, which Jackson produces for a JSON number wider than a double, converted both operands to the same infinity and made distinct values compare equal. * fix(iot): follow the AWS IoT SQL operator tables and harden the rule parser The comparison and logic semantics did not match the operator tables in the AWS IoT SQL reference: = and <> on mismatched types are false and true rather than Undefined, JSON null is a value that equals only NULL, the ordering operators convert numeric strings, AND, OR and NOT accept the strings "true" and "false" and give Undefined for anything else instead of three valued logic, and startswith and endswith convert non-string arguments. String literals may use double quotes, as AWS's own examples do, and an unsupported function is named before its arguments are parsed so the WARN reports the function rather than a token inside it. Add a corpus of AWS reference statements sorted into parsed and unparsed, a deterministic mutation fuzz that requires the parser to raise nothing but RuleSqlParseException and the evaluator nothing at all, and tables for keyword prefixed field names, spacing, associativity, unicode and literal forms. * fix(iot): treat a rule SQL numeric string with an overflowing exponent as Undefined A payload string such as "1e-2147483648" matches the numeric string form but BigDecimal cannot hold its exponent, and the NumberFormatException escaped the publish path. It now evaluates as Undefined, and the fuzz payloads carry such strings. * docs(iot): name the AWS null functions, not IS NULL, in the rule SQL limitations * fix(iot): read rule SQL payload numbers exactly instead of through a double Jackson read payload floats as doubles, so 9007199254740993.0 arrived as 9007199254740992, 1e-400 as 0 and 0.30000000000000004 as 0.3 before the evaluator compared them against an exact literal, and a predicate could fire or stay silent for the wrong reason. The representability guard only caught the infinity case of that loss. Payload numbers are now read as BigDecimal, kept as written, so every comparison is exact at any size or precision as AWS's Decimal is, a projected number keeps its text, and the infinity handling is gone because no double is ever produced. * docs(iot): awsIotSqlVersion is stored and echoed, only its array semantics are not modelled |
||
|
|
7b5c6e272d |
fix(cloudformation): delete AWS::IAM::User on stack deletion (#3076)
* fix(cloudformation): delete AWS::IAM::User on stack deletion (#2490) * fix(cloudformation): reconcile IAM user updates and verify user identity * fix(cloudformation): log intentionally tolerated errors during IAM user deletion * fix(cloudformation): use context helpers and assert Fn::GetAtt in IAM user provisioner * test(cloudformation): add AWS SDK compatibility test for IAM user * test(cloudformation): log tolerated exception during IAM user test cleanup * test(cloudformation): use Logger for cleanup in IAM user SDK test * test(cloudformation): use JBoss Logging for cleanup in IAM user SDK test * fix(cloudformation): address review feedback on IAM user provisioner --------- Signed-off-by: Vũ Thế Huy <31652864+vuthehuyht@users.noreply.github.com> |
||
|
|
9df197f3af |
refactor(cloudformation): move AWS::ECS::Cluster, TaskDefinition and Service into EcsCfnProvisioner (#3114)
* refactor(cloudformation): move AWS::ECS::Cluster, TaskDefinition and Service into EcsCfnProvisioner Three more arms leave the legacy switch, together with the ECS-only parsers (container definitions, port mappings, environment, secrets, load balancers, network configuration) and the three idempotent delete helpers. The monolith no longer depends on EcsService at all; its constructor loses that parameter and CfnProvisionerFixture passes one argument less. Behaviour is unchanged except where the move fixes it: an unnamed cluster keeps the name its first execution generated (ctx.stablePhysicalName), where the switch generated a fresh name and created a second cluster on every UpdateStack. Create-vs-update for a service branches on ctx.isUpdate() and the stored Name attribute, since the physical id is the ARN; a renamed service is created as a replacement, with the prior one left behind as every replacement in the switch does today. A non-integer DesiredCount is a ValidationError instead of an uncaught NumberFormatException. Deletes go through CfnDeletes.safeDelete tolerating only the service's own not-found codes, so a ClusterContainsTasksException still fails the stack delete (#1634). Fn::GetAtt keys are unchanged (Cluster Arn, TaskDefinition TaskDefinitionArn, Service Name and ServiceArn), matching the registry schemas' readOnly properties, and CloudFormationIntegrationTest keeps asserting them end to end. EcsCfnProvisionerTest covers the three types against a mocked EcsService. The whole CloudFormation test package passes on this tree apart from the pre-existing ACM schema-gap row. * refactor(cloudformation): treat an ECS service's cluster as create-only and clean up replacements Review found that a service moved to another cluster while keeping its name took the in-place update path: updateService was called against the new cluster, which either fails with ServiceNotFoundException or mutates a same-named service the new cluster already has. Cluster is create-only on AWS::ECS::Service, so the update now compares the requested cluster (a name, an ARN's last segment, or the default) with the one embedded in the prior service ARN and creates a replacement when they differ. A replacement, here and for a renamed service or a task definition's new revision, now enters the replacement-cleanup lifecycle the engine already runs (UPDATE_COMPLETE_CLEANUP_IN_PROGRESS, DELETE_IN_PROGRESS on the prior id, three attempts, UpdateReplacePolicy Retain honoured) instead of leaving the displaced entity behind. ReplacementCleanup is the plain bookkeeping for provisioners without a rollback snapshot, beside the richer record PipesCfnProvisioner keeps; the provisioner delegates the four interface hooks to it and deletes through its own idempotent delete arm. Deregistering the displaced task-definition revision after commit is what CloudFormation does on AWS and stops revisions accumulating on every update. * refactor(cloudformation): roll an ECS replacement back when a later resource fails Review found that a replacement this provisioner produces (a service moved or renamed, a task definition's new revision) could not be rolled back: when a later resource failed the stack update, rollbackUpdate had no implementation, so the engine reported "Rollback is not implemented", left the replacement running and the stack in UPDATE_ROLLBACK_FAILED. ReplacementCleanup now keeps the attributes the resource carried before the provision alongside the prior physical id, and rollback() puts both back and deletes the replacement through the provisioner's own delete arm; the record is spent before the delete so a failing delete cannot put the restored prior on the next cleanup's list, as PipesCfnProvisioner reasons for its rename. The provisioner records once, in provision(), after the type switch, and delegates rollbackUpdate. In-place updates owe no record and keep the engine's existing handling. The committed-update cleanup in CloudFormationService now walks resources in reverse creation order, as every other teardown walk does: a displaced service has to go before the displaced cluster it runs in, and a displaced listener before the target group it forwards to, or that delete fails three times and leaves the entity behind. * refactor(cloudformation): order replacement cleanup by the template and keep an orphaned replacement owed Two gaps in the replacement lifecycle, both found in review. The committed cleanup walked the resource map reversed, but the map is insertion order and a resource a later update added sits after the resources that depend on it, so a cluster added after its service would still be deleted first. The cleanup now walks resourcesInCreationOrder reversed, the template's dependency order, exactly as DeleteStack does; a resource the template no longer names sorts last. And a rollback whose delete of the replacement failed forgot the replacement: the record was cleared before the delete, so nothing could remove that entity later even though UPDATE_ROLLBACK_FAILED is updatable here and both the next committed update and DeleteStack run the cleanup first. The record is now a list of every entity owed a delete: a replacement whose rollback delete fails is listed in the prior's place, never retained (a failed update created it), and the prior's own id and attributes are kept beside the list only while this update's replacement can still be rolled back. Every listed entity gets its attempt on every cleanup call, so one that keeps failing does not leave the others untried. * refactor(cloudformation): keep a displaced entity owed until its own attempts are used up Review found that once any listed entity reached three failed deletes, the engine's give-up cleared the whole record, forgetting entities that still had attempts left. clearUpdate now drops only the entries that used up their attempts (and the rollback fields), and the cleanup result reports the lowest attempt count among what remains, naming that entity, so the engine keeps retrying until every remaining entity has had its own three attempts. |
||
|
|
dec348d382 |
feat(iot): provision AWS::IoT::Thing, Policy and TopicRule (#3014)
* feat(iot): provision AWS::IoT::Thing, Policy and TopicRule CloudFormation now creates, updates and deletes things, policies and topic rules through the existing IoT operations. Ref returns the name; Fn::GetAtt returns the thing ARN and id, the policy ARN and id (the name, as on AWS) and the rule ARN. Attribute payloads are replaced in place, a changed policy document becomes a new default version, a rule is replaced in place, and a rename replaces the entity. The topic rule payload is handed to the service in the API's own shape. A policy is detached from its principals before it is deleted. * test(iot): keep policy variables verbatim in a stack-created policy * fix(iot): cap a policy at five versions and prune the oldest on a stack update CreatePolicyVersion refuses a sixth version with VersionsLimitExceededException (HTTP 409), as AWS does, and every policy version write runs under one lock so racing creates cannot slip past the check. A stack update with a changed document now does what the AWS CloudFormation handler does when the service refuses: it deletes the oldest version, after moving the default to the newest when the oldest is the default, and creates the new version again. Before this change the versions of a policy updated by a stack piled up without limit. * fix(iot): keep pruning when another version fills the slot before the retry The prune and the retry are separate calls, so another client could create a version between them and the single retry failed the stack update. The provisioner now prunes and tries again, up to as many times as a policy has versions, before it gives up. * fix(iot): delete the oldest policy version in one step under the version lock A stack update pruning a full policy selected the oldest version, moved the default and deleted it in separate service calls, so a direct client could delete or promote that version in between and the stale delete failed the update. The selection, the default move and the delete are now one step in IotService under the version lock; the provisioner only asks for it and retries. * fix(iot): make room for a policy version in one step and lock the policy delete A policy persisted before the cap can hold more than five versions, and the one-version prune then needed one failed stack update per four surplus versions. The service now deletes the oldest versions until one more fits, in one step under the lock, and the provisioner asks for that. DeletePolicy takes the same lock: a version created in the middle of a delete used to put the policy back after the delete had returned. The limit error now carries the message AWS sends, and the tolerated limit error is logged at debug level. * docs(cloudformation): regenerate the resource-type table after the rebase onto main |