Skip to content

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

release v1.3.55 (#769)

Nahuel Nucera1e040e92b133
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5393de8..8a1eb4dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,21 @@ Versioning follows [Semantic Versioning](https://semver.org/).
---
+## [1.3.55] — 2026-06-01
+
+### Added
+- **AWS Elemental MediaConnect — control-plane stub** — `CreateFlow`, `DescribeFlow`, `ListFlows`, `UpdateFlow`, `ListTagsForResource` at `/v1/flows[/{FlowArn}]` and `/tags/{ResourceArn}`. `ListFlows` returns the slimmer AWS `ListedFlow` projection (no Outputs/Sources/Entitlements); `UpdateFlow` is narrow to the AWS-allowed top-level fields (`SourceFailoverConfig`, `Maintenance`, `SourceMonitoringConfig`, `NdiConfig`); flow records use the wire-form camelCase keys per the AWS REST-JSON model. No real streaming/transcoder — flows are control-plane metadata, enough to integration-test services that wrap the MediaConnect API. Reported by @tashif-hoda.
+- **EKS `AssociateEncryptionConfig` + OIDC discovery / JWKS for IRSA** — new `POST /clusters/{name}/encryption-config/associate` returns an `update` envelope and rejects re-association (matches AWS, which only allows adding encryption to a cluster that has none). Cluster `identity.oidc.issuer` now points at a ministack-hosted URL (`/oidc/id/{32-char-id}`) instead of the real `oidc.eks.{region}.amazonaws.com` (unreachable from clients); `GET <issuer>/.well-known/openid-configuration` and `GET <issuer>/keys` are served at the AWS-shape paths, with `authorization_endpoint: "urn:kubernetes:programmatic_authorization"` and `claims_supported: ["sub","iss"]` matching the real EKS discovery document. A single RSA keypair is generated lazily on first request and shared across clusters — sufficient for Terraform's `aws_iam_openid_connect_provider` to fetch the document. Reported by @b-rajesh.
+
+### Fixed
+- **API Gateway v2 Lambda-proxy — `Set-Cookie` from `headers` and the `cookies` array now both ship** — observed real-AWS behavior is to emit the array entries first followed by any `Set-Cookie` carried in `headers`; the earlier supersede approach silently dropped the header cookie. Case-insensitive on the header key.Contributed by @rmlasseter.
+- **API Gateway v2 Lambda-proxy — `isBase64Encoded` honored in both directions** — request bodies for binary content types are now base64-encoded with `isBase64Encoded: true`; response bodies marked `isBase64Encoded: true` are decoded to raw bytes (HTTP API v2 has no `binaryMediaTypes` negotiation — it's unconditional). The text/binary split for the request body (only `text/*` and `application/json` / `application/xml` / `application/javascript` arrive as UTF-8 strings; everything else, including a missing `Content-Type` and `application/x-www-form-urlencoded`, is base64) matches the AWS-observed behavior. Contributed by @rmlasseter.
+- **API Gateway v1 Lambda-proxy — `binaryMediaTypes` is now wired** — request bodies whose `Content-Type` matches a configured `binaryMediaType` are delivered base64-encoded with `isBase64Encoded: true`; response bodies with `isBase64Encoded: true` are decoded to raw bytes only when the request `Accept` also matches a `binaryMediaType`. `binaryMediaTypes` was stored on the API record but inert at invocation before this. Wildcards (`*/*`, `type/*`) honored on the configured side; a request value of `*/*` does NOT auto-match specific configured types — verified against real AWS. Contributed by @rmlasseter.
+- **API Gateway v2 Lambda-proxy — case-insensitive header override** — a lowercase `content-type` (or any case-mismatched header) from a Lambda response now replaces ministack's seeded default rather than shipping a duplicate header. HTTP field names are case-insensitive per RFC 9110 §5.1. Contributed by @rmlasseter.
+- **API Gateway v1 Lambda-proxy — case-insensitive header override** — same fix on the `headers` merge for REST APIs: the v1 builder previously case-folded only the `multiValueHeaders` merge, so a lowercase `content-type` shipped twice; it now overrides the default and is emitted once. Contributed by @rmlasseter.
+
+---
+
## [1.3.54] — 2026-05-30
### Added
diff --git a/README.md b/README.md
index b949954f..a32d611c 100644
--- a/README.md
+++ b/README.md
@@ -511,7 +511,7 @@ Unsupported resource types fail with `CREATE_FAILED` (or `ROLLBACK_COMPLETE` if
| **Transfer Family** | CreateServer, DescribeServer, DeleteServer, ListServers, StartServer, StopServer, CreateUser, DescribeUser, DeleteUser, ListUsers, ImportSshPublicKey, DeleteSshPublicKey | 12 operations; **real SFTP listener** on `:2222` (override with `SFTP_PORT`) backed by S3 — `ls`, `put`, `get`, `mkdir`, `rename` work end-to-end against the local S3 emulator; `SFTP_PORT_PER_SERVER=1` allocates one port per `CreateServer` from `SFTP_BASE_PORT` (default 2300); SSH key auth scans every user across every server and account; `LOGICAL` and `PATH` home-directory mappings; host key persists across restarts when `PERSIST_STATE=1` |
| **IoT Core** | CreateThing, DescribeThing, ListThings, UpdateThing, DeleteThing, CreateThingType, CreateThingGroup, AddThingToThingGroup, ListThingsInThingGroup, CreateKeysAndCertificate, RegisterCertificate, UpdateCertificate, DeleteCertificate, AttachThingPrincipal, DetachThingPrincipal, ListThingPrincipals, ListPrincipalThings, CreatePolicy, CreatePolicyVersion, AttachPolicy, DetachPolicy, ListAttachedPolicies, ListTargetsForPolicy, DescribeEndpoint, Publish (HTTP), MQTT-over-WebSocket pub/sub | 24 operations + **real MQTT 3.1.1 over WebSocket** on the gateway port — clients use the address returned by `DescribeEndpoint`; local CA signs `CreateKeysAndCertificate` certificates (CA persists across restarts when `PERSIST_STATE=1`); multi-tenancy via transparent topic prefixing (same pattern as Transfer Family's shared SFTP listener); no plain TCP 1883 (real AWS IoT requires TLS or SigV4 on every connection); local CA cert available at `GET /_ministack/iot/ca.pem` for SDK trust configuration; IoT policies are stored but **not enforced** on the data plane |
| **EventBridge Scheduler** | CreateSchedule, GetSchedule, UpdateSchedule, DeleteSchedule, ListSchedules, CreateScheduleGroup, GetScheduleGroup, DeleteScheduleGroup, ListScheduleGroups, TagResource, UntagResource, ListTagsForResource | 12 actions; schedule groups with cascading deletes; `rate()`, `cron()`, `at()` expressions; group/prefix/state filters on list; default group auto-created; CFN `AWS::Scheduler::Schedule` and `AWS::Scheduler::ScheduleGroup` supported |
-| **EKS** | CreateCluster, DescribeCluster, ListClusters, DeleteCluster, CreateNodegroup, DescribeNodegroup, ListNodegroups, DeleteNodegroup, CreateAddon, DescribeAddon, ListAddons, UpdateAddon, DeleteAddon, TagResource, UntagResource, ListTagsForResource | `CreateCluster` spawns a real **k3s** container (75 MB) with a full Kubernetes API server; `kubectl`, Helm, and any K8s tooling work out of the box; cascading delete removes nodegroups and k3s container; addon CRUD (e.g. `vpc-cni`, `coredns`, `kube-proxy`, `aws-ebs-csi-driver`) at `/clusters/{name}/addons` flips status to `ACTIVE` on create / update; CFN `AWS::EKS::Cluster` and `AWS::EKS::Nodegroup` supported |
+| **EKS** | CreateCluster, DescribeCluster, ListClusters, DeleteCluster, CreateNodegroup, DescribeNodegroup, ListNodegroups, DeleteNodegroup, CreateAddon, DescribeAddon, ListAddons, UpdateAddon, DeleteAddon, AssociateEncryptionConfig, TagResource, UntagResource, ListTagsForResource | `CreateCluster` spawns a real **k3s** container (75 MB) with a full Kubernetes API server; `kubectl`, Helm, and any K8s tooling work out of the box; cascading delete removes nodegroups and k3s container; addon CRUD (e.g. `vpc-cni`, `coredns`, `kube-proxy`, `aws-ebs-csi-driver`) at `/clusters/{name}/addons` flips status to `ACTIVE` on create / update; `AssociateEncryptionConfig` at `/clusters/{name}/encryption-config/associate` records KMS encryption config (rejects re-association, AWS-shape `update` envelope); OIDC discovery + JWKS served at the cluster's `identity.oidc.issuer` URL so Terraform's `aws_iam_openid_connect_provider` (IRSA) works against ministack; CFN `AWS::EKS::Cluster` and `AWS::EKS::Nodegroup` supported |
| **OpenSearch Service** | CreateDomain, DescribeDomain, DescribeDomains, DeleteDomain, ListDomainNames, UpdateDomainConfig, DescribeDomainConfig, DescribeDomainChangeProgress, ListVersions, GetCompatibleVersions, AddTags, ListTags, RemoveTags | Management plane on `/2021-01-01/*` (`boto3.client("opensearch")`, SigV4 scope `es`). Default data plane is a stub endpoint (`<domain>.ministack.local:9200`) — set `OPENSEARCH_DATAPLANE=1` to spawn one real `opensearchproject/opensearch` container per `CreateDomain` (same pattern as ElastiCache/RDS); `DescribeDomain.Endpoint` then points at that container and `_cluster/health`/`/_search` work end-to-end. Add `OPENSEARCH_DASHBOARDS=1` (with dataplane on) to also spawn a per-domain `opensearch-dashboards` sidecar; `DescribeDomain.DashboardEndpoint` is populated. ARNs follow `arn:aws:es:<region>:<account>:domain/<name>`; Terraform `aws_opensearch_domain` resource compatible. |
| **Organizations** | DescribeOrganization, ListRoots, ListAccounts, ListAccountsForParent, DescribeAccount, CreateOrganizationalUnit, DescribeOrganizationalUnit, DeleteOrganizationalUnit, ListOrganizationalUnitsForParent | Single-master-account org auto-initialised on first call; nested OUs with `Path` field (additive 2026-03 AWS change); `FeatureSet=ALL` |
| **Account** | GetAccountInformation, GetContactInformation, ListRegions, GetRegionOptStatus | rest-json `/getAccountInformation`, etc.; returns `AccountState=ACTIVE` (additive 2026-04 AWS change); 31-region opt-in matrix |
diff --git a/ministack/services/apigateway.py b/ministack/services/apigateway.py
index 85275019..4505dc50 100644
--- a/ministack/services/apigateway.py
+++ b/ministack/services/apigateway.py
@@ -1040,17 +1040,19 @@ async def _invoke_lambda_proxy(
del resp_headers[existing]
resp_headers[k] = v
# Payload format 2.0 delivers cookies via the top-level `cookies` array,
- # which AWS turns into one Set-Cookie header per entry. The array is the
- # documented cookie mechanism — AWS guidance is "don't manually add
- # set-cookie headers; use the cookies array" (Lambda Function URLs / HTTP
- # API v2 docs) — so when it is present it supersedes any Set-Cookie carried
- # in `headers` (the structured source wins, as in #750's v1 collision rule).
- # _send_response expands the list into one Set-Cookie line per entry.
+ # which AWS turns into one Set-Cookie header per entry. Observed AWS
+ # behavior when both `cookies` and a `Set-Cookie` in `headers` are
+ # returned: both ship, with the array's entries emitted first followed by
+ # any header Set-Cookie. Merge case-insensitively on the header key, then
+ # reassign under the canonical `Set-Cookie`. _send_response expands the
+ # list into one Set-Cookie line per entry.
cookies = lambda_response.get("cookies")
if cookies:
+ prior = []
for existing in [h for h in resp_headers if h.lower() == "set-cookie"]:
- del resp_headers[existing]
- resp_headers["Set-Cookie"] = list(cookies)
+ val = resp_headers.pop(existing)
+ prior.extend(val if isinstance(val, (list, tuple)) else [val])
+ resp_headers["Set-Cookie"] = list(cookies) + prior
resp_body = lambda_response.get("body", "")
# A base64-encoded body (isBase64Encoded=true) is decoded to its raw bytes
# before sending. HTTP APIs (v2) honor this unconditionally — there is no
diff --git a/pyproject.toml b/pyproject.toml
index 359fe9ae..71bb6d34 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ministack"
-version = "1.3.54"
+version = "1.3.55"
description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"
readme = "README.md"
license = { file = "LICENSE" }
diff --git a/tests/test_apigatewayv2.py b/tests/test_apigatewayv2.py
index 4adbefdc..da7deeea 100644
--- a/tests/test_apigatewayv2.py
+++ b/tests/test_apigatewayv2.py
@@ -461,24 +461,22 @@ def test_apigw_execute_lambda_proxy_empty_cookies(apigw, lam):
apigw.delete_api(ApiId=api_id)
lam.delete_function(FunctionName=fname)
-def test_apigw_execute_lambda_proxy_cookies_supersede_header_set_cookie(apigw, lam):
- """The `cookies` array supersedes a `Set-Cookie` carried in `headers`.
-
- Follow-up to #750. For v2 the `cookies` array is the documented cookie
- mechanism ("don't manually add set-cookie headers" — AWS Lambda Function
- URLs / HTTP API v2 docs), so when both are returned only the array's cookies
- ship — mirroring #759's v1 rule where the structured source wins on a
- case-insensitive collision.
+def test_apigw_execute_lambda_proxy_cookies_and_header_set_cookie_both_ship(apigw, lam):
+ """Both the `cookies` array AND a `Set-Cookie` in `headers` ship.
+
+ Observed real-AWS behavior for HTTP API (v2) Lambda-proxy: when both are
+ returned, AWS emits the array entries first, followed by the header
+ `Set-Cookie`. Case-insensitive on the header key.
"""
import urllib.request as _urlreq
import uuid as _uuid
- fname = f"intg-apigw-cookiewin-{_uuid.uuid4().hex[:8]}"
+ fname = f"intg-apigw-bothcookie-{_uuid.uuid4().hex[:8]}"
code = (
b"def handler(event, context):\n"
b" return {\n"
b" 'statusCode': 200,\n"
- b" 'headers': {'set-cookie': 'should-be-dropped=1; Path=/'},\n"
+ b" 'headers': {'set-cookie': 'h=1; Path=/'},\n"
b" 'cookies': ['a=1; Path=/', 'b=2; Path=/'],\n"
b" 'body': 'x',\n"
b" }\n"
@@ -492,26 +490,25 @@ def test_apigw_execute_lambda_proxy_cookies_supersede_header_set_cookie(apigw, l
Handler="index.handler", Code={"ZipFile": buf.getvalue()},
)
- api_id = apigw.create_api(Name=f"cookiewin-api-{fname}", ProtocolType="HTTP")["ApiId"]
+ api_id = apigw.create_api(Name=f"bothcookie-api-{fname}", ProtocolType="HTTP")["ApiId"]
int_id = apigw.create_integration(
ApiId=api_id, IntegrationType="AWS_PROXY",
IntegrationUri=f"arn:aws:lambda:us-east-1:000000000000:function:{fname}",
PayloadFormatVersion="2.0",
)["IntegrationId"]
route_id = apigw.create_route(
- ApiId=api_id, RouteKey="GET /cookiewin", Target=f"integrations/{int_id}",
+ ApiId=api_id, RouteKey="GET /bothcookie", Target=f"integrations/{int_id}",
)["RouteId"]
apigw.create_stage(ApiId=api_id, StageName="$default")
- url = f"http://{api_id}.execute-api.localhost:{_EXECUTE_PORT}/$default/cookiewin"
+ url = f"http://{api_id}.execute-api.localhost:{_EXECUTE_PORT}/$default/bothcookie"
req = _urlreq.Request(url, method="GET")
req.add_header("Host", f"{api_id}.execute-api.localhost:{_EXECUTE_PORT}")
resp = _urlreq.urlopen(req)
assert resp.status == 200
set_cookies = resp.headers.get_all("Set-Cookie") or []
- # Only the array's cookies ship; the header `Set-Cookie` is superseded.
- assert set_cookies == ["a=1; Path=/", "b=2; Path=/"]
- assert all("should-be-dropped" not in c for c in set_cookies)
+ # Array entries first, header `Set-Cookie` last.
+ assert set_cookies == ["a=1; Path=/", "b=2; Path=/", "h=1; Path=/"]
apigw.delete_route(ApiId=api_id, RouteId=route_id)
apigw.delete_integration(ApiId=api_id, IntegrationId=int_id)