Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

release v1.5.2 (#1545)

Nahuel Nucera5a19f0ff295d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d134e81f..6dfbe9fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,15 +5,26 @@ All notable changes to MiniStack will be documented here.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Versioning follows [Semantic Versioning](https://semver.org/).
-## [Unreleased]
-
-### Fixed
-- **EventBridge Pipes — a DynamoDB stream reaches a Step Functions target** — the poller delivered to SNS and to nothing else, so a pipe whose target was a state machine reported `RUNNING`, advanced no position and moved no records, with no error and no log line: the CDK `DynamoDbSource` → `StateMachineTarget` pipe every stream-driven workflow uses simply never fired. A `states` target now gets one `StartExecution` per batch, carrying the records as the JSON array `$states.input` reads, which is the shape Pipes delivers on AWS. A pipe's stream position advances only once the whole batch has reached its target, so a `StartExecution` that fails and a target this poller cannot serve (SQS, Lambda, Kinesis, …) both leave the records on the stream for the next poll to retry, and log a warning naming the pipe.
-### Added
-- **Cognito — `AddCustomAttributes`, and a user pool that reports its schema (`SchemaAttributes`)** — `DescribeUserPool` never returned the pool's attribute schema (the create request's `Schema` was stored under that request-shaped key and no `SchemaAttributes` was ever produced), so a client that diffs its desired schema against the pool saw every attribute as missing. Terraform re-planned an `aws_cognito_user_pool` as changed immediately after creating it and then failed the follow-up apply with `InvalidAction: Unknown Cognito IDP action: AddCustomAttributes`, because that is the operation the provider uses to reconcile added schema items. A pool now carries the full standard attribute set (`sub`, `email`, `email_verified`, `phone_number`, `updated_at`, ... with AWS's data types, mutability, and constraints), a request's `Schema` entries are stored under their `custom:` (or `dev:`) prefix and override a standard entry field-for-field when they redefine one, and `AddCustomAttributes` adds 1-25 attributes per call with `InvalidParameterException` for a duplicate, a standard attribute name, or more than 50 custom attributes, and `ResourceNotFoundException` for an unknown pool. Pools restored from an older snapshot rebuild their schema on load. Also fixed two adjacent read-back gaps that showed up as permanent drift: `EmailConfiguration` now reports `EmailSendingAccount: COGNITO_DEFAULT` when the request omitted it, and `GetUserPoolMfaConfig` no longer invents a disabled `SoftwareTokenMfaConfiguration` for a pool that never configured MFA.
-
-### Fixed
-- **EventBridge — an input template no longer needs quotes around a string variable** — AWS documents that quotes are optional for a variable holding a string and adds them itself so the transformed input stays valid JSON, quoting neither an object nor an array. MiniStack pasted every value in verbatim, so the documented form `{"detail": <detail>, "groupId": <groupId>}` produced `"groupId": some-value` and the target received a body that would not parse, forcing consumers to hand-quote the placeholder. Substitution is now aware of where the placeholder sits: a string variable in a JSON value position is quoted, a variable inside a string literal is interpolated raw as before, and an object or array spliced into a string has its internal quotes stripped the way AWS does.
+## [1.5.2] — 2026-08-26
+
+### Added
+- **Cognito — `AdminLinkProviderForUser` / `AdminDisableProviderForUser`** — both actions answered `InvalidAction`, so a federated identity could not be linked to a local user. Linking records the identity in the user's `identities` attribute (up to 5 per user, `AliasExistsException` when the identity is already linked) and a hosted-UI federated sign-in resolves to the linked user; disabling removes the link, and with `ProviderName=Cognito` it deactivates the local user's password sign-in (`NotAuthorizedException`) while the profile stays. Reported by @rsimples.
+- **Cognito — `AddCustomAttributes`, and a user pool that reports its schema (`SchemaAttributes`)** — `DescribeUserPool` never returned the pool's attribute schema and `AddCustomAttributes` answered `InvalidAction`, so Terraform re-planned an `aws_cognito_user_pool` as changed right after creating it and failed the follow-up apply. A pool now carries the full standard attribute set with AWS's data types, mutability and constraints, a request's `Schema` entries override a standard entry field-for-field under their `custom:`/`dev:` prefix, and `AddCustomAttributes` adds 1-25 attributes per call with the documented errors; a `Required` custom attribute is refused `InvalidParameterException`, as real Cognito refuses it. Contributed by @jgrumboe.
+- **S3 — `ListBuckets` pagination (`MaxBuckets`, `ContinuationToken`, `Prefix`)** — every call returned the full bucket list and ignored the paging parameters; they are now honored, with `ContinuationToken` alone signalling a further page, per the S3 model. Contributed by @gaul.
+- **S3 — `CRC32C` checksums** — a put carrying `x-amz-checksum-crc32c` was refused as unsupported; CRC32C is now computed in-process (table-driven, no new dependency), verified on upload (`BadDigest` on mismatch) and surfaced on reads with checksum mode enabled, completing all five S3 checksum algorithms. Contributed by @gaul.
+
+### Fixed
+- **Step Functions — `CreateStateMachine` is idempotent** — repeating a create with the same name refused `StateMachineAlreadyExists` even when the request was identical, which AWS answers with the existing machine's ARN. An identical create (definition, role, type, logging, publish and version description) now succeeds, only a differing one is refused, and `DescribeStateMachine` no longer leaks internal version-bookkeeping fields. Contributed by @bandle.
+- **EventBridge — an input template no longer needs quotes around a string variable** — AWS adds the quotes itself when a string variable sits in a JSON value position, so the documented form `{"detail": <detail>, "groupId": <groupId>}` rendered a body that would not parse. A string variable in a value position is now quoted, a variable inside a string literal interpolates raw, and an object or array spliced into a string has its internal quotes stripped, as AWS does. Contributed by @ppettitau.
+- **EventBridge Pipes — a DynamoDB stream reaches a Step Functions target** — the poller delivered to SNS and to nothing else, so a pipe targeting a state machine reported `RUNNING`, advanced no position and moved no records, with no error and no log line. A `states` target now gets one `StartExecution` per batch carrying the records as a JSON array, and a batch that fails to reach its target stays on the stream for the next poll to retry, logging a warning naming the pipe. Contributed by @facuparedes.
+- **EC2 — `DescribeSnapshots` evaluates `Filters`** — filters were ignored entirely, so every filtered call returned every snapshot in the account; the documented filter names (`snapshot-id`, `volume-id`, `status`, `owner-id`, `encrypted`, the `tag` forms, ...) now narrow the result. Contributed by @bandle.
+- **EC2 — two invented operations removed** — `DescribeInstanceMaintenanceOptions` and `DescribeInstanceAutoRecoveryAttribute` do not exist in the EC2 API; both handlers answered invented shapes and are gone.
+- **S3 — `CopyObject` applies `x-amz-acl`, and `UploadPartCopy` honors the copy-source conditions** — a canned ACL on a copy was dropped, so a copy addressed `public-read` landed private with no way to tell but reading the ACL back, and `UploadPartCopy` ignored all four `x-amz-copy-source-if-*` headers. A copy now permissions the destination as a put does (an unknown value refuses the request), a copy without an ACL leaves the destination private rather than inheriting the replaced key's, and both copy operations judge the source conditions the same way. Contributed by @gaul.
+- **S3 — the versioning edges answer the way S3 answers them** — `DeleteBucket` deleted a bucket that still held versions or delete markers (now `BucketNotEmpty` until they are removed by version id); reading a delete marker by its version id answered 200-empty on GET and `NoSuchVersion` on HEAD (now `405 Method Not Allowed` with `x-amz-delete-marker`, `Last-Modified` and `Allow: DELETE`); an ACL or tag operation naming a version that never existed read back the default policy (now `NoSuchVersion`); and `ListObjectVersions` honors `delimiter`, grouping keys into `CommonPrefixes`. Contributed by @gaul.
+- **S3 — the directory-bucket delete conditions are refused** — `x-amz-if-match-size` and `x-amz-if-match-last-modified-time` (and the `Size` / `LastModifiedTime` members in a `DeleteObjects` entry) were silently ignored on a general-purpose bucket; they now answer `NotImplemented`, as live S3 does. Reported by @gaul.
+- **CodeBuild — `BatchDeleteBuilds` reports `buildsNotDeleted` as structures** — an id that could not be deleted was reported as a bare string where the API models `{id, statusCode}`, crashing SDK parsers; it now answers the documented structure.
+- **Lambda — `InvokeWithResponseStream` returns an HTTP-level error unframed** — a `ResourceNotFoundException` (and any other non-200) was wrapped in the eventstream envelope, which SDK parsers cannot read; the error now returns as plain JSON, and only a 200 streams.
+- **s3tables — the delete operations answer `204 No Content`** — `DeleteTableBucket`, `DeleteNamespace` and `DeleteTable` answered `200 {}` where AWS answers an empty 204.
## [1.5.1] — 2026-08-25
diff --git a/README.md b/README.md
index dd928f5b..4aaa7078 100644
--- a/README.md
+++ b/README.md
@@ -215,7 +215,7 @@ use1.list_tables()["TableNames"] # → ["users"]
euw1.list_tables()["TableNames"] # → [] — eu-west-1 is independent
```
-**Region-isolated services:** as of 1.5.1, every regional service is region-isolated except S3 and Aurora DSQL (the isolation migrations rolled out service by service from 1.4.0 to 1.4.12 — see the CHANGELOG for the per-release history; services introduced later, like AWS Config and the Cloud Control API in 1.4.14, were born region-scoped).
+**Region-isolated services:** as of 1.5.2, every regional service is region-isolated except S3 and Aurora DSQL (the isolation migrations rolled out service by service from 1.4.0 to 1.4.12 — see the CHANGELOG for the per-release history; services introduced later, like AWS Config and the Cloud Control API in 1.4.14, were born region-scoped).
Cross-resource references resolve in the referenced ARN's own account and region (SNS→SQS fanout, EventBridge targets, event source mappings), and cross-region references that real AWS rejects return the same errors AWS returns — e.g. invoking a `eu-west-1` Lambda from a `us-east-1` Step Functions task fails with `Functions from 'eu-west-1' are not reachable in this region`, exactly as on AWS.
@@ -1216,7 +1216,7 @@ pip install boto3 pytest duckdb docker cbor2
# Start MiniStack
docker compose up -d
-# Run the full test suite (1,400+ tests across all services)
+# Run the full test suite (5,700+ tests across all services)
pytest tests/ -v
```
diff --git a/ministack/services/s3.py b/ministack/services/s3.py
index d024c6c0..a3c8a832 100644
--- a/ministack/services/s3.py
+++ b/ministack/services/s3.py
@@ -1238,10 +1238,9 @@ def _crc32c(body: bytes) -> int:
def _compute_s3_checksum(algorithm: str, body: bytes) -> str | None:
"""Return base64-encoded checksum for the given AWS S3 algorithm name.
- SHA256 / SHA1 / CRC32 come from the stdlib and CRC64NVME from the table
- above. CRC32C is the one left: it needs the optional native `google-crc32c`
- that isn't bundled, so we return None for it and the caller refuses the
- request rather than storing a value it could never verify.
+ SHA256 / SHA1 / CRC32 come from the stdlib; CRC64NVME and CRC32C from the
+ tables above. An algorithm outside those five returns None and the caller
+ refuses the request rather than storing a value it could never verify.
"""
algo = (algorithm or "").upper().replace("_", "")
if algo == "SHA256":
@@ -1270,12 +1269,9 @@ def _resolve_object_checksums(body: bytes, headers: dict):
- `x-amz-sdk-checksum-algorithm: ALG` asks the server to compute that
algorithm; the resulting value is returned alongside the response.
- Ministack-specific: CRC32C requires an optional native library that the
- "no new dependencies" rule forbids us from adding. Rather than silently
- accept an unverifiable checksum (which would round-trip on Get without ever
- being validated against the body — a worse failure mode than refusing the
- request), we reject the put with a clear error. SHA256 / SHA1 / CRC32 /
- CRC64NVME work end-to-end.
+ An algorithm we cannot compute is refused up front: silently accepting an
+ unverifiable checksum would round-trip on Get without ever being validated
+ against the body — a worse failure mode than refusing the request.
Returns ``(checksums_dict, error_response_or_None)``.
"""
@@ -1298,11 +1294,9 @@ def _resolve_object_checksums(body: bytes, headers: dict):
return {}, _error(
"InvalidRequest",
(
- f"Checksum algorithm not supported in this ministack build: "
+ f"Checksum algorithm not supported: "
f"{', '.join(sorted(unverifiable))}. Supported: SHA256, SHA1, "
- f"CRC32, CRC64NVME. CRC32C requires an optional native "
- f"dependency that ministack does not bundle; use CRC64NVME "
- f"instead, or omit the checksum header."
+ f"CRC32, CRC32C, CRC64NVME."
),
400,
)
@@ -1920,8 +1914,9 @@ def _list_buckets(query_params=None):
SubElement(b, "BucketArn").text = f"arn:aws:s3:::{name}"
if prefix:
SubElement(root, "Prefix").text = prefix
+ # ListBucketsOutput has no IsTruncated member (botocore s3 model): a
+ # further page is signalled by ContinuationToken alone.
if is_truncated:
- SubElement(root, "IsTruncated").text = "true"
SubElement(root, "ContinuationToken").text = page[-1] if page else ""
return 200, {"Content-Type": "application/xml"}, _xml_body(root)
@@ -4182,6 +4177,9 @@ def _delete_marker_read_refused(version: dict) -> tuple:
headers = dict(headers)
headers["x-amz-delete-marker"] = "true"
headers["x-amz-version-id"] = version["version_id"]
+ # AWS also stamps the marker's creation time on the 405.
+ if version.get("last_modified"):
+ headers["Last-Modified"] = iso_to_rfc7231(version["last_modified"])
headers["Allow"] = "DELETE"
return status, headers, body
diff --git a/pyproject.toml b/pyproject.toml
index b0f37be3..13f69404 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ministack"
-version = "1.5.1"
+version = "1.5.2"
description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"
readme = "README.md"
license = { file = "LICENSE" }
diff --git a/tests/test_s3.py b/tests/test_s3.py
index 3a7c40a2..9aa35d71 100644
--- a/tests/test_s3.py
+++ b/tests/test_s3.py
@@ -4636,25 +4636,102 @@ def test_s3_versioned_get_returns_stored_checksum(s3):
s3.delete_bucket(Bucket=bucket)
-def test_s3_put_object_rejects_unsupported_crc32c_explicitly(s3):
- """CRC32C requires an optional native library ministack doesn't bundle.
- Rather than silently accept-without-validation, the put must fail loudly
- so clients see the gap. Issue #831 follow-up: no silent failures."""
- import base64
- import os
+def test_s3_list_buckets_paginates(s3):
+ """ListBuckets honors Prefix, MaxBuckets and ContinuationToken; a further
+ page is signalled by ContinuationToken alone (ListBucketsOutput has no
+ IsTruncated member)."""
+ names = [f"qa-lbp-{c}" for c in "abc"]
+ for n in names:
+ s3.create_bucket(Bucket=n)
+ try:
+ page1 = s3.list_buckets(Prefix="qa-lbp-", MaxBuckets=2)
+ assert [b["Name"] for b in page1["Buckets"]] == names[:2]
+ assert page1["Prefix"] == "qa-lbp-"
+ assert "ContinuationToken" in page1
+ page2 = s3.list_buckets(
+ Prefix="qa-lbp-", MaxBuckets=2,
+ ContinuationToken=page1["ContinuationToken"],
+ )
+ assert [b["Name"] for b in page2["Buckets"]] == names[2:]
+ assert "ContinuationToken" not in page2
+ finally:
+ for n in names:
+ s3.delete_bucket(Bucket=n)
+
+def test_s3_delete_object_refuses_directory_bucket_conditions(s3):
+ """x-amz-if-match-size / x-amz-if-match-last-modified-time are directory-
+ bucket features; a general-purpose bucket answers NotImplemented and the
+ object stays."""
+ bucket = "qa-del-cond-bucket"
+ s3.create_bucket(Bucket=bucket)
+ s3.put_object(Bucket=bucket, Key="k", Body=b"x")
+ with pytest.raises(ClientError) as exc:
+ s3.delete_object(Bucket=bucket, Key="k", IfMatchSize=1)
+ assert exc.value.response["Error"]["Code"] == "NotImplemented"
+ with pytest.raises(ClientError) as exc:
+ s3.delete_object(
+ Bucket=bucket, Key="k",
+ IfMatchLastModifiedTime=datetime(2026, 1, 1),
+ )
+ assert exc.value.response["Error"]["Code"] == "NotImplemented"
+ assert s3.get_object(Bucket=bucket, Key="k")["Body"].read() == b"x"
+ s3.delete_object(Bucket=bucket, Key="k")
+ s3.delete_bucket(Bucket=bucket)
+
+
+def test_s3_delete_objects_refuses_size_and_mtime_conditions(s3):
+ """A DeleteObjects entry carrying Size or LastModifiedTime draws a per-key
+ NotImplemented error while unconditional entries in the batch delete."""
+ bucket = "qa-del-batch-cond-bucket"
+ s3.create_bucket(Bucket=bucket)
+ s3.put_object(Bucket=bucket, Key="cond", Body=b"x")
+ s3.put_object(Bucket=bucket, Key="plain", Body=b"y")
+ resp = s3.delete_objects(
+ Bucket=bucket,
+ Delete={
+ "Objects": [
+ {"Key": "cond", "Size": 1},
+ {"Key": "plain"},
+ ],
+ "Quiet": False,
+ },
+ )
+ assert [e["Key"] for e in resp.get("Deleted", [])] == ["plain"]
+ errors = resp.get("Errors", [])
+ assert len(errors) == 1
+ assert errors[0]["Key"] == "cond"
+ assert errors[0]["Code"] == "NotImplemented"
+ assert s3.get_object(Bucket=bucket, Key="cond")["Body"].read() == b"x"
+ s3.delete_object(Bucket=bucket, Key="cond")
+ s3.delete_bucket(Bucket=bucket)
+
+
+def test_s3_put_object_validates_crc32c(s3):
+ """CRC32C is computed in-process: a wrong client value draws BadDigest,
+ a correct one is stored and surfaced when checksum mode is enabled."""
from botocore.exceptions import ClientError
- bucket = "checksum-crc32c-reject-bucket"
+ bucket = "checksum-crc32c-validate-bucket"
s3.create_bucket(Bucket=bucket)
- fake_crc32c = base64.b64encode(os.urandom(4)).decode()
with pytest.raises(ClientError) as exc:
s3.put_object(
Bucket=bucket, Key="k", Body=b"x",
ChecksumAlgorithm="CRC32C",
- ChecksumCRC32C=fake_crc32c,
+ ChecksumCRC32C="AAAAAA==",
)
- assert exc.value.response["Error"]["Code"] == "InvalidRequest"
+ assert exc.value.response["Error"]["Code"] == "BadDigest"
+
+ good = "qTxfkw==" # CRC32C(b"x"), big-endian, base64
+ s3.put_object(
+ Bucket=bucket, Key="k", Body=b"x",
+ ChecksumAlgorithm="CRC32C",
+ ChecksumCRC32C=good,
+ )
+ got = s3.get_object(Bucket=bucket, Key="k", ChecksumMode="ENABLED")
+ assert got["ChecksumCRC32C"] == good
+ assert got["Body"].read() == b"x"
+ s3.delete_object(Bucket=bucket, Key="k")
s3.delete_bucket(Bucket=bucket)