Skip to content

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

fix(secretsmanager): resolve secrets by partial ARN prefix match — bu… (#268)

Nahuel Nucera0a1550a80409
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 254d8536..9bc6091e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,15 @@ Versioning follows [Semantic Versioning](https://semver.org/).
---
+## [1.2.5] — 2026-04-12
+
+### Fixed
+- **Secrets Manager partial ARN lookup** — `GetSecretValue` and all other operations now resolve secrets by partial ARN (without the random 6-character suffix), matching real AWS behaviour. Previously returned `ResourceNotFoundException`.
+- **Java SDK v2 timestamp compatibility** — all JSON-protocol services now return integer epoch seconds instead of high-precision floats. Fixes `Unable to parse date` and `Input timestamp string must be no longer than 20 characters` errors across DynamoDB, Lambda, Kinesis, CodeBuild, CloudWatch, Glue, Athena, ECR, Secrets Manager, EventBridge, KMS, SNS, Service Discovery, and CloudFormation provisioners. Python and Node.js SDKs are unaffected.
+- **DELETE/GET/HEAD requests without body could hang** — ASGI body read loop now skips waiting for a body on methods that don't typically carry one, preventing timeouts under concurrent load.
+
+---
+
## [1.2.4] — 2026-04-11
### Added
diff --git a/ministack/app.py b/ministack/app.py
index bdb22771..67330707 100644
--- a/ministack/app.py
+++ b/ministack/app.py
@@ -216,11 +216,13 @@ async def app(scope, receive, send):
headers[name.decode("latin-1").lower()] = value.decode("latin-1")
body = b""
- while True:
- message = await receive()
- body += message.get("body", b"")
- if not message.get("more_body", False):
- break
+ has_body = headers.get("content-length") or headers.get("transfer-encoding")
+ if has_body or method in ("POST", "PUT", "PATCH"):
+ while True:
+ message = await receive()
+ body += message.get("body", b"")
+ if not message.get("more_body", False):
+ break
# AWS SDK v2 sends PutObject with Transfer-Encoding: chunked and
# x-amz-content-sha256: STREAMING-AWS4-HMAC-SHA256-PAYLOAD[-TRAILER].
diff --git a/ministack/services/athena.py b/ministack/services/athena.py
index 6f5b8b2b..b4f78623 100644
--- a/ministack/services/athena.py
+++ b/ministack/services/athena.py
@@ -47,7 +47,7 @@ _workgroups: dict = {
"Name": "primary",
"State": "ENABLED",
"Description": "Primary workgroup",
- "CreationTime": time.time(),
+ "CreationTime": int(time.time()),
"Configuration": {
"ResultConfiguration": {"OutputLocation": "s3://athena-results/"}
},
@@ -216,7 +216,7 @@ def _start_query_execution(data):
"QueryExecutionContext": {"Database": db, "Catalog": catalog},
"Status": {
"State": "QUEUED",
- "SubmissionDateTime": time.time(),
+ "SubmissionDateTime": int(time.time()),
"CompletionDateTime": None,
"StateChangeReason": "",
},
@@ -283,7 +283,7 @@ def _execute_query(query_id, query, database):
execution["Status"]["StateChangeReason"] = str(e)[:2000]
execution["_error"] = str(e)
- execution["Status"]["CompletionDateTime"] = time.time()
+ execution["Status"]["CompletionDateTime"] = int(time.time())
def _run_duckdb(query, database):
@@ -502,7 +502,7 @@ def _stop_query_execution(data):
if execution and execution["Status"]["State"] in ("QUEUED", "RUNNING"):
execution["Status"]["State"] = "CANCELLED"
execution["Status"]["StateChangeReason"] = "Query was cancelled by user"
- execution["Status"]["CompletionDateTime"] = time.time()
+ execution["Status"]["CompletionDateTime"] = int(time.time())
return json_response({})
@@ -525,7 +525,7 @@ def _create_workgroup(data):
"Name": name,
"State": "ENABLED",
"Description": data.get("Description", ""),
- "CreationTime": time.time(),
+ "CreationTime": int(time.time()),
"Configuration": data.get("Configuration", {}),
}
tags = data.get("Tags", [])
@@ -784,7 +784,7 @@ def _create_prepared_statement(data):
"WorkGroupName": workgroup,
"QueryStatement": query,
"Description": data.get("Description", ""),
- "LastModifiedTime": time.time(),
+ "LastModifiedTime": int(time.time()),
}
return json_response({})
@@ -836,8 +836,8 @@ def _get_table_metadata(data):
{
"TableMetadata": {
"Name": table,
- "CreateTime": time.time(),
- "LastAccessTime": time.time(),
+ "CreateTime": int(time.time()),
+ "LastAccessTime": int(time.time()),
"TableType": "EXTERNAL_TABLE",
"Columns": [],
"PartitionKeys": [],
@@ -896,7 +896,7 @@ def reset():
"Name": "primary",
"State": "ENABLED",
"Description": "Primary workgroup",
- "CreationTime": time.time(),
+ "CreationTime": int(time.time()),
"Configuration": {
"ResultConfiguration": {"OutputLocation": "s3://athena-results/"}
},
diff --git a/ministack/services/cloudformation/provisioners.py b/ministack/services/cloudformation/provisioners.py
index b9cd8993..66138729 100644
--- a/ministack/services/cloudformation/provisioners.py
+++ b/ministack/services/cloudformation/provisioners.py
@@ -324,7 +324,7 @@ def _ddb_create(logical_id, props, stack_name):
"TableArn": arn,
"TableId": new_uuid(),
"TableStatus": "ACTIVE",
- "CreationDateTime": time.time(),
+ "CreationDateTime": int(time.time()),
"KeySchema": key_schema,
"AttributeDefinitions": attr_defs,
"ProvisionedThroughput": props.get("ProvisionedThroughput", {
@@ -681,7 +681,7 @@ def _kinesis_stream_create(logical_id, props, stack_name):
"RetentionPeriodHours": retention,
"shards": _kinesis._build_shards(shard_count),
"tags": {},
- "CreationTimestamp": time.time(),
+ "CreationTimestamp": int(time.time()),
"EncryptionType": "NONE",
}
return name, {"Arn": arn, "StreamId": stream_id}
@@ -930,7 +930,7 @@ def _lambda_esm_create(logical_id, props, stack_name):
"StateTransitionReason": "USER_INITIATED",
"BatchSize": int(props.get("BatchSize", 10)),
"MaximumBatchingWindowInSeconds": int(props.get("MaximumBatchingWindowInSeconds", 0)),
- "LastModified": time.time(),
+ "LastModified": int(time.time()),
"LastProcessingResult": "No records processed",
"StartingPosition": props.get("StartingPosition", "LATEST"),
"Enabled": props.get("Enabled", True),
@@ -1167,7 +1167,7 @@ def _sm_secret_create(logical_id, props, stack_name):
_sm._secrets[name] = {
"ARN": arn, "Name": name, "Description": props.get("Description", ""),
"Tags": props.get("Tags", []),
- "CreatedDate": _time.time(), "LastChangedDate": _time.time(),
+ "CreatedDate": int(_time.time()), "LastChangedDate": int(_time.time()),
"LastAccessedDate": None, "DeletedDate": None,
"RotationEnabled": False, "RotationLambdaARN": None,
"RotationRules": None, "ReplicationStatus": [],
@@ -1176,7 +1176,7 @@ def _sm_secret_create(logical_id, props, stack_name):
new_uuid(): {
"SecretString": secret_string,
"SecretBinary": None,
- "CreatedDate": _time.time(),
+ "CreatedDate": int(_time.time()),
"Stages": ["AWSCURRENT"],
}
},
@@ -2214,14 +2214,14 @@ def _cw_metric_alarm_create(logical_id, props, stack_name):
"StateReason": _cw._alarms[name]["StateReason"]
if name in _cw._alarms
else "Unchecked: Initial alarm creation",
- "StateUpdatedTimestamp": time.time(),
+ "StateUpdatedTimestamp": int(time.time()),
"ActionsEnabled": ae,
"AlarmActions": alarm_actions,
"OKActions": ok_actions,
"InsufficientDataActions": insuff_actions,
"Dimensions": dims,
"Unit": props.get("Unit"),
- "AlarmConfigurationUpdatedTimestamp": time.time(),
+ "AlarmConfigurationUpdatedTimestamp": int(time.time()),
}
_cw.cloudformation_put_metric_alarm(alarm)
arn = alarm["AlarmArn"]
diff --git a/ministack/services/cloudwatch.py b/ministack/services/cloudwatch.py
index 7477e922..4f571264 100644
--- a/ministack/services/cloudwatch.py
+++ b/ministack/services/cloudwatch.py
@@ -191,7 +191,7 @@ def _evaluate_alarm(alarm):
reason = f"Threshold Crossed: {alarm.get('Statistic','Average')} {val} {op} {threshold}"
alarm["StateValue"] = new_state
alarm["StateReason"] = reason
- alarm["StateUpdatedTimestamp"] = time.time()
+ alarm["StateUpdatedTimestamp"] = int(time.time())
_record_history(alarm["AlarmName"], old_state, new_state, reason)
@@ -697,14 +697,14 @@ def _put_metric_alarm(params, cbor_data, is_cbor, is_json=False):
"StateReason": _alarms[name]["StateReason"]
if name in _alarms
else "Unchecked: Initial alarm creation",
- "StateUpdatedTimestamp": time.time(),
+ "StateUpdatedTimestamp": int(time.time()),
"ActionsEnabled": cbor_data.get("ActionsEnabled", True),
"AlarmActions": cbor_data.get("AlarmActions", []),
"OKActions": cbor_data.get("OKActions", []),
"InsufficientDataActions": cbor_data.get("InsufficientDataActions", []),
"Dimensions": cbor_data.get("Dimensions", []),
"Unit": cbor_data.get("Unit"),
- "AlarmConfigurationUpdatedTimestamp": time.time(),
+ "AlarmConfigurationUpdatedTimestamp": int(time.time()),
}
else:
name = _p(params, "AlarmName")
@@ -752,14 +752,14 @@ def _put_metric_alarm(params, cbor_data, is_cbor, is_json=False):
"StateReason": _alarms[name]["StateReason"]
if name in _alarms
else "Unchecked: Initial alarm creation",
- "StateUpdatedTimestamp": time.time(),
+ "StateUpdatedTimestamp": int(time.time()),
"ActionsEnabled": _p(params, "ActionsEnabled") != "false",
"AlarmActions": alarm_actions,
"OKActions": ok_actions,
"InsufficientDataActions": [],
"Dimensions": dims,
"Unit": _p(params, "Unit") or None,
- "AlarmConfigurationUpdatedTimestamp": time.time(),
+ "AlarmConfigurationUpdatedTimestamp": int(time.time()),
}
is_new = name not in _alarms
@@ -819,12 +819,12 @@ def _put_composite_alarm(params, cbor_data, is_cbor, is_json=False):
"AlarmRule": alarm_rule,
"StateValue": "INSUFFICIENT_DATA",
"StateReason": "Unchecked: Initial alarm creation",
- "StateUpdatedTimestamp": time.time(),
+ "StateUpdatedTimestamp": int(time.time()),
"ActionsEnabled": actions_enabled,
"AlarmActions": alarm_actions,
"OKActions": ok_actions,
"InsufficientDataActions": insuff_actions,
- "AlarmConfigurationUpdatedTimestamp": time.time(),
+ "AlarmConfigurationUpdatedTimestamp": int(time.time()),
}
if is_cbor:
return _cbor_ok({})
@@ -1106,7 +1106,7 @@ def _set_alarm_state(params, cbor_data, is_cbor, is_json=False):
alarm["StateReason"] = reason
if reason_data:
alarm["StateReasonData"] = reason_data
- alarm["StateUpdatedTimestamp"] = time.time()
+ alarm["StateUpdatedTimestamp"] = int(time.time())
if old_state != new_state:
_record_history(name, old_state, new_state, reason)
@@ -1224,7 +1224,7 @@ def _put_dashboard(params, cbor_data, is_cbor, is_json=False):
"DashboardName": name,
"DashboardBody": body,
"DashboardArn": f"arn:aws:cloudwatch::{get_account_id()}:dashboard/{name}",
- "LastModified": time.time(),
+ "LastModified": int(time.time()),
"Size": len(body),
}
diff --git a/ministack/services/codebuild.py b/ministack/services/codebuild.py
index 0b60526e..f988674f 100644
--- a/ministack/services/codebuild.py
+++ b/ministack/services/codebuild.py
@@ -16,7 +16,7 @@ import os
import time
from ministack.core.persistence import PERSIST_STATE, load_state
-from ministack.core.responses import AccountScopedDict, error_response_json, get_account_id, json_response, new_uuid, now_iso
+from ministack.core.responses import AccountScopedDict, error_response_json, get_account_id, json_response, new_uuid
logger = logging.getLogger("codebuild")
@@ -70,7 +70,7 @@ def _build_id(project_name):
def _make_build_record(project, build_id, source_version=None):
"""Create a build record that immediately shows SUCCEEDED."""
- now = now_iso()
+ now = time.time()
return {
"id": build_id,
"arn": _build_arn(build_id),
@@ -151,7 +151,7 @@ def _create_project(data):
return error_response_json("ResourceAlreadyExistsException",
f"Project already exists: {name}", 400)
- now = now_iso()
+ now = time.time()
project = {
"name": name,
"arn": _project_arn(name),
@@ -235,7 +235,7 @@ def _update_project(data):
"encryptionKey"):
if key in data:
project[key] = data[key]
- project["lastModified"] = now_iso()
+ project["lastModified"] = int(time.time())
logger.info("UpdateProject: %s", name)
return json_response({"project": _project_shape(project)})
@@ -287,7 +287,7 @@ def _stop_build(data):
return error_response_json("ResourceNotFoundException",
f"Build not found: {bid}", 400)
build["buildStatus"] = "STOPPED"
- build["endTime"] = now_iso()
+ build["endTime"] = int(time.time())
build["currentPhase"] = "COMPLETED"
logger.info("StopBuild: %s", bid)
return json_response({"build": copy.deepcopy(build)})
diff --git a/ministack/services/dynamodb.py b/ministack/services/dynamodb.py
index 15c0b344..3701cb2d 100644
--- a/ministack/services/dynamodb.py
+++ b/ministack/services/dynamodb.py
@@ -250,7 +250,7 @@ def _create_table(data):
"sk_name": sk_name,
"items": defaultdict(dict),
"TableStatus": "ACTIVE",
- "CreationDateTime": time.time(),
+ "CreationDateTime": int(time.time()),
"ItemCount": 0,
"TableSizeBytes": 0,
"TableArn": f"arn:aws:dynamodb:{REGION}:{get_account_id()}:table/{name}",
diff --git a/ministack/services/ecr.py b/ministack/services/ecr.py
index cf927724..06cf7616 100644
--- a/ministack/services/ecr.py
+++ b/ministack/services/ecr.py
@@ -123,7 +123,7 @@ def _create_repository(data):
"registryId": _registry_id(),
"repositoryName": name,
"repositoryUri": _repo_uri(name),
- "createdAt": time.time(),
+ "createdAt": int(time.time()),
"imageTagMutability": data.get("imageTagMutability", "MUTABLE"),
"imageScanningConfiguration": data.get("imageScanningConfiguration", {"scanOnPush": False}),
"encryptionConfiguration": data.get("encryptionConfiguration", {"encryptionType": "AES256"}),
@@ -202,7 +202,7 @@ def _put_image(data):
"imageManifest": manifest,
"imageManifestMediaType": manifest_type,
"imageTags": [tag] if tag else [],
- "imagePushedAt": time.time(),
+ "imagePushedAt": int(time.time()),
"imageDigest": digest,
}
if tag:
@@ -329,7 +329,7 @@ def _describe_images(data):
"imageDigest": img["imageDigest"],
"imageTags": img.get("imageTags", []),
"imageSizeInBytes": len(manifest),
- "imagePushedAt": img.get("imagePushedAt", time.time()),
+ "imagePushedAt": img.get("imagePushedAt", int(time.time())),
"imageManifestMediaType": img.get("imageManifestMediaType",
"application/vnd.docker.distribution.manifest.v2+json"),
"artifactMediaType": img.get("imageManifestMediaType",
@@ -344,7 +344,7 @@ def _get_authorization_token(data):
return json_response({
"authorizationData": [{
"authorizationToken": token,
- "expiresAt": time.time() + 43200,
+ "expiresAt": int(time.time()) + 43200,
"proxyEndpoint": f"https://{get_account_id()}.dkr.ecr.{REGION}.amazonaws.com",
}]
})
@@ -421,7 +421,7 @@ def _get_lifecycle_policy(data):
"registryId": _registry_id(),
"repositoryName": name,
"lifecyclePolicyText": _lifecycle_policies[name],
- "lastEvaluatedAt": time.time(),
+ "lastEvaluatedAt": int(time.time()),
})
@@ -438,7 +438,7 @@ def _delete_lifecycle_policy(data):
"registryId": _registry_id(),
"repositoryName": name,
"lifecyclePolicyText": policy,
- "lastEvaluatedAt": time.time(),
+ "lastEvaluatedAt": int(time.time()),
})
diff --git a/ministack/services/eventbridge.py b/ministack/services/eventbridge.py
index 31894673..26acc09b 100644
--- a/ministack/services/eventbridge.py
+++ b/ministack/services/eventbridge.py
@@ -895,7 +895,7 @@ def _dispatch_to_sns(arn, payload):
"id": msg_id,
"message": payload,
"subject": "EventBridge Notification",
- "timestamp": time.time(),
+ "timestamp": int(time.time()),
})
_sns._fanout(arn, msg_id, payload, "EventBridge Notification")
logger.info("EventBridge → SNS %s", arn)
diff --git a/ministack/services/glue.py b/ministack/services/glue.py
index fef4a3ec..dda73f27 100644
--- a/ministack/services/glue.py
+++ b/ministack/services/glue.py
@@ -188,7 +188,7 @@ def _create_database(data):
"Description": db_input.get("Description", ""),
"LocationUri": db_input.get("LocationUri", ""),
"Parameters": db_input.get("Parameters", {}),
- "CreateTime": time.time(),
+ "CreateTime": int(time.time()),
"CatalogId": get_account_id(),
}
return json_response({})
@@ -245,9 +245,9 @@ def _create_table(data):
"DatabaseName": db_name,
"Description": table_input.get("Description", ""),
"Owner": table_input.get("Owner", ""),
- "CreateTime": time.time(),
- "UpdateTime": time.time(),
- "LastAccessTime": time.time(),
+ "CreateTime": int(time.time()),
+ "UpdateTime": int(time.time()),
+ "LastAccessTime": int(time.time()),
"StorageDescriptor": table_input.get("StorageDescriptor", {}),
"PartitionKeys": table_input.get("PartitionKeys", []),
"TableType": table_input.get("TableType", "EXTERNAL_TABLE"),
@@ -299,7 +299,7 @@ def _update_table(data):
for k in safe_keys:
if k in table_input:
_tables[key][k] = table_input[k]
- _tables[key]["UpdateTime"] = time.time()
+ _tables[key]["UpdateTime"] = int(time.time())
return json_response({})
@@ -339,8 +339,8 @@ def _create_partition(data):
**partition_input,
"DatabaseName": db_name,
"TableName": table_name,
- "CreationTime": time.time(),
- "LastAccessTime": time.time(),
+ "CreationTime": int(time.time()),
+ "LastAccessTime": int(time.time()),
"CatalogId": get_account_id(),
})
return json_response({})
@@ -393,7 +393,7 @@ def _batch_create_partition(data):
**pi,
"DatabaseName": db_name,
"TableName": table_name,
- "CreationTime": time.time(),
+ "CreationTime": int(time.time()),
"CatalogId": get_account_id(),
})
return json_response({"Errors": errors})
@@ -450,7 +450,7 @@ def _get_partition_indexes(data):
def _create_connection(data):
conn_input = data.get("ConnectionInput", {})
name = conn_input.get("Name")
- _connections[name] = {**conn_input, "CreationTime": time.time(), "LastUpdatedTime": time.time()}
+ _connections[name] = {**conn_input, "CreationTime": int(time.time()), "LastUpdatedTime": int(time.time())}
return json_response({})
@@ -491,8 +491,8 @@ def _create_crawler(data):
"LineageConfiguration": data.get("LineageConfiguration", {}),
"State": "READY",
"CrawlElapsedTime": 0,
- "CreationTime": time.time(),
- "LastUpdated": time.time(),
+ "CreationTime": int(time.time()),
+ "LastUpdated": int(time.time()),
"LastCrawl": None,
"Version": 1,
"Configuration": data.get("Configuration", ""),
@@ -536,7 +536,7 @@ def _update_crawler(data):
crawler["Schedule"] = {"ScheduleExpression": sched} if isinstance(sched, str) else sched
else:
crawler[k] = data[k]
- crawler["LastUpdated"] = time.time()
+ crawler["LastUpdated"] = int(time.time())
crawler["Version"] = crawler.get("Version", 1) + 1
return json_response({})
@@ -564,7 +564,7 @@ def _start_crawler(data):
"LogStream": new_uuid(),
"MessagePrefix": "",
"StartTime": start_time,
- "EndTime": time.time(),
+ "EndTime": int(time.time()),
}
logger.info("Glue: Crawler %s finished after %ss", name, CRAWLER_RUN_SECONDS)
@@ -631,8 +631,8 @@ def _create_job(data):
"MaxCapacity": data.get("MaxCapacity"),
"SecurityConfiguration": data.get("SecurityConfiguration", ""),
"Tags": data.get("Tags", {}),
- "CreatedOn": time.time(),
- "LastModifiedOn": time.time(),
+ "CreatedOn": int(time.time()),
+ "LastModifiedOn": int(time.time()),
}
_job_runs[name] = []
return json_response({"Name": name})
@@ -669,7 +669,7 @@ def _update_job(data):
for k in updatable:
if k in job_update:
_jobs[name][k] = job_update[k]
- _jobs[name]["LastModifiedOn"] = time.time()
+ _jobs[name]["LastModifiedOn"] = int(time.time())
return json_response({"JobName": name})
@@ -702,8 +702,8 @@ def _start_job_run(data):
run = {
"Id": run_id,
"JobName": job_name,
- "StartedOn": time.time(),
- "LastModifiedOn": time.time(),
+ "StartedOn": int(time.time()),
+ "LastModifiedOn": int(time.time()),
"CompletedOn": None,
"JobRunState": "STARTING",
"Arguments": args,
@@ -726,7 +726,7 @@ def _start_job_run(data):
def _execute():
run["JobRunState"] = "RUNNING"
- run["LastModifiedOn"] = time.time()
+ run["LastModifiedOn"] = int(time.time())
script_location = job.get("Command", {}).get("ScriptLocation", "")
resolved = _resolve_script(script_location)
@@ -757,9 +757,9 @@ def _start_job_run(data):
else:
run["JobRunState"] = "SUCCEEDED"
- run["CompletedOn"] = time.time()
+ run["CompletedOn"] = int(time.time())
run["ExecutionTime"] = int(run["CompletedOn"] - run["StartedOn"])
- run["LastModifiedOn"] = time.time()
+ run["LastModifiedOn"] = int(time.time())
thread = threading.Thread(target=_execute, daemon=True)
thread.start()
@@ -792,8 +792,8 @@ def _batch_stop_job_run(data):
if run["Id"] == run_id:
if run["JobRunState"] in ("STARTING", "RUNNING"):
run["JobRunState"] = "STOPPED"
- run["CompletedOn"] = time.time()
- run["LastModifiedOn"] = time.time()
+ run["CompletedOn"] = int(time.time())
+ run["LastModifiedOn"] = int(time.time())
successful.append({"JobName": job_name, "JobRunId": run_id})
else:
errors.append({"JobName": job_name, "JobRunId": run_id,
@@ -819,7 +819,7 @@ def _create_security_configuration(data):
f"Security configuration {name} already exists", 400)
_security_configs[name] = {
"Name": name,
- "CreatedTimeStamp": time.time(),
+ "CreatedTimeStamp": int(time.time()),
"EncryptionConfiguration": data.get("EncryptionConfiguration", {}),
}
return json_response({"Name": name, "CreatedTimestamp": _security_configs[name]["CreatedTimeStamp"]})
@@ -869,7 +869,7 @@ def _create_classifier(data):
cls_type = "GrokClassifier" if grok else "XMLClassifier" if xml_cls else "JsonClassifier" if json_cls else "CsvClassifier"
_classifiers[name] = {
- cls_type: {**classifier, "CreationTime": time.time(), "LastUpdated": time.time(), "Version": 1},
+ cls_type: {**classifier, "CreationTime": int(time.time()), "LastUpdated": int(time.time()), "Version": 1},
}
return json_response({})
@@ -914,8 +914,8 @@ def _create_trigger(data):
"Description": data.get("Description", ""),
"WorkflowName": data.get("WorkflowName", ""),
"Tags": data.get("Tags", {}),
- "CreatedOn": time.time(),
- "LastModifiedOn": time.time(),
+ "CreatedOn": int(time.time()),
+ "LastModifiedOn": int(time.time()),
}
if data.get("StartOnCreation", False):
_triggers[name]["State"] = "ACTIVATED"
@@ -951,7 +951,7 @@ def _update_trigger(data):
for k in updatable:
if k in trigger_update:
_triggers[name][k] = trigger_update[k]
- _triggers[name]["LastModifiedOn"] = time.time()
+ _triggers[name]["LastModifiedOn"] = int(time.time())
return json_response({"Trigger": _triggers[name]})
@@ -960,7 +960,7 @@ def _start_trigger(data):
if name not in _triggers:
return error_response_json("EntityNotFoundException", f"Trigger {name} not found", 400)
_triggers[name]["State"] = "ACTIVATED"
- _triggers[name]["LastModifiedOn"] = time.time()
+ _triggers[name]["LastModifiedOn"] = int(time.time())
return json_response({"Name": name})
@@ -969,7 +969,7 @@ def _stop_trigger(data):
if name not in _triggers:
return error_response_json("EntityNotFoundException", f"Trigger {name} not found", 400)
_triggers[name]["State"] = "DEACTIVATED"
- _triggers[name]["LastModifiedOn"] = time.time()
+ _triggers[name]["LastModifiedOn"] = int(time.time())
return json_response({"Name": name})
@@ -1016,8 +1016,8 @@ def _create_workflow(data):
"Name": name,
"Description": data.get("Description", ""),
"DefaultRunProperties": data.get("DefaultRunProperties", {}),
- "CreatedOn": time.time(),
- "LastModifiedOn": time.time(),
+ "CreatedOn": int(time.time()),
+ "LastModifiedOn": int(time.time()),
"MaxConcurrentRuns": data.get("MaxConcurrentRuns", 0),
}
if data.get("Tags"):
@@ -1055,7 +1055,7 @@ def _update_workflow(data):
for k in ("Description", "DefaultRunProperties", "MaxConcurrentRuns"):
if k in data:
_workflows[name][k] = data[k]
- _workflows[name]["LastModifiedOn"] = time.time()
+ _workflows[name]["LastModifiedOn"] = int(time.time())
return json_response({"Name": name})
@@ -1068,7 +1068,7 @@ def _start_workflow_run(data):
"WorkflowRunId": run_id,
"Name": name,
"Status": "RUNNING",
- "StartedOn": time.time(),
+ "StartedOn": int(time.time()),
"CompletedOn": None,
"Statistics": {
"TotalActions": 0, "RunningActions": 0, "StoppedActions": 0,
diff --git a/ministack/services/kinesis.py b/ministack/services/kinesis.py
index 9f4e35b1..bc572d4f 100644
--- a/ministack/services/kinesis.py
+++ b/ministack/services/kinesis.py
@@ -238,7 +238,7 @@ def _create_stream(data):
"RetentionPeriodHours": 24,
"shards": _build_shards(shard_count),
"tags": {},
- "CreationTimestamp": time.time(),
+ "CreationTimestamp": int(time.time()),
"EncryptionType": "NONE",
}
return json_response({})
@@ -383,7 +383,7 @@ def _put_record(data):
stream["shards"][shard_id]["records"].append({
"SequenceNumber": seq,
- "ApproximateArrivalTimestamp": time.time(),
+ "ApproximateArrivalTimestamp": int(time.time()),
"Data": record_data,
"PartitionKey": partition_key,
})
@@ -440,7 +440,7 @@ def _put_records(data):
seq = _next_sequence_number()
stream["shards"][sid]["records"].append({
"SequenceNumber": seq,
- "ApproximateArrivalTimestamp": time.time(),
+ "ApproximateArrivalTimestamp": int(time.time()),
"Data": rd,
"PartitionKey": pk,
})
@@ -760,7 +760,7 @@ def _register_consumer(data):
f"Consumer {consumer_name} already exists", 400)
consumer_arn = f"{stream_arn}/consumer/{consumer_name}:{int(time.time())}"
- now = time.time()
+ now = int(time.time())
_consumers[consumer_arn] = {
"ConsumerName": consumer_name,
"ConsumerARN": consumer_arn,
diff --git a/ministack/services/kms.py b/ministack/services/kms.py
index 55646123..e6a6ea62 100644
--- a/ministack/services/kms.py
+++ b/ministack/services/kms.py
@@ -187,7 +187,7 @@ def _create_key(data):
"KeySpec": key_spec,
"KeyUsage": key_usage,
"Description": description,
- "CreationDate": time.time(),
+ "CreationDate": int(time.time()),
"Origin": "AWS_KMS",
"Tags": tags,
"Policy": policy,
@@ -764,7 +764,7 @@ def _schedule_key_deletion(data):
days = data.get("PendingWindowInDays", 30)
rec["KeyState"] = "PendingDeletion"
rec["Enabled"] = False
- rec["DeletionDate"] = time.time() + (days * 86400)
+ rec["DeletionDate"] = int(time.time() + (days * 86400))
return json_response({
"KeyId": rec["KeyId"],
"KeyState": "PendingDeletion",
diff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.py
index 766bfec6..759af554 100644
--- a/ministack/services/lambda_svc.py
+++ b/ministack/services/lambda_svc.py
@@ -2476,7 +2476,7 @@ def _put_event_invoke_config(func_name: str, data: dict):
"FunctionArn": _func_arn(func_name),
"MaximumRetryAttempts": data.get("MaximumRetryAttempts", 2),
"MaximumEventAgeInSeconds": data.get("MaximumEventAgeInSeconds", 21600),
- "LastModified": time.time(),
+ "LastModified": int(time.time()),
"DestinationConfig": data.get(
"DestinationConfig",
{
@@ -2623,7 +2623,7 @@ def _create_esm(data: dict):
"StateTransitionReason": "USER_INITIATED",
"BatchSize": data.get("BatchSize", 10),
"MaximumBatchingWindowInSeconds": data.get("MaximumBatchingWindowInSeconds", 0),
- "LastModified": time.time(),
+ "LastModified": int(time.time()),
"LastProcessingResult": "No records processed",
"Enabled": enabled,
"FunctionResponseTypes": data.get("FunctionResponseTypes", []),
@@ -2700,7 +2700,7 @@ def _update_esm(esm_id: str, data: dict):
new_name = _resolve_name(data["FunctionName"])
esm["FunctionName"] = new_name
esm["FunctionArn"] = _func_arn(new_name)
- esm["LastModified"] = time.time()
+ esm["LastModified"] = int(time.time())
return json_response(_esm_response(esm))
diff --git a/ministack/services/secretsmanager.py b/ministack/services/secretsmanager.py
index 50e3bf2a..32ef8591 100644
--- a/ministack/services/secretsmanager.py
+++ b/ministack/services/secretsmanager.py
@@ -60,7 +60,13 @@ if _restored:
# ---------------------------------------------------------------------------
def _resolve(secret_id):
- """Look up a secret by name or ARN. Returns (storage_key, record) or (None, None)."""
+ """Look up a secret by name or ARN. Returns (storage_key, record) or (None, None).
+
+ Supports three lookup modes (matching real AWS behaviour):
+ 1. By name: "my-secret"
+ 2. By full ARN: "arn:aws:secretsmanager:...:secret:my-secret-A1B2C3"
+ 3. By partial ARN: "arn:aws:secretsmanager:...:secret:my-secret" (no random suffix)
+ """
if not secret_id:
return None, None
if secret_id in _secrets:
@@ -68,6 +74,11 @@ def _resolve(secret_id):
for key, s in _secrets.items():
if s["ARN"] == secret_id:
return key, s
+ # Partial ARN: prefix match against stored ARNs (AWS behaviour)
+ if secret_id.startswith("arn:"):
+ for key, s in _secrets.items():
+ if s["ARN"].startswith(secret_id):
+ return key, s
return None, None
@@ -201,7 +212,7 @@ def _create_secret(data):
arn = f"arn:aws:secretsmanager:{REGION}:{get_account_id()}:secret:{name}-{new_uuid()[:6]}"
vid = new_uuid()
- now = time.time()
+ now = int(time.time())
_secrets[name] = {
"ARN": arn,
@@ -243,7 +254,7 @@ def _get_secret_value(data):
"You can't perform this operation on the secret because it was marked for deletion.", 400,
)
- secret["LastAccessedDate"] = time.time()
+ secret["LastAccessedDate"] = int(time.time())
req_vid = data.get("VersionId")
req_stage = data.get("VersionStage", "AWSCURRENT")
@@ -384,7 +395,7 @@ def _delete_secret(data):
"RecoveryWindowInDays value must be between 7 and 30 days (inclusive).", 400,
)
- now = time.time()
+ now = int(time.time())
deletion_date = now if force else now + window * 86400
if force:
@@ -434,11 +445,11 @@ def _update_secret(data):
has_new_value = "SecretString" in data or "SecretBinary" in data
if not has_new_value:
- secret["LastChangedDate"] = time.time()
+ secret["LastChangedDate"] = int(time.time())
return json_response({"ARN": secret["ARN"], "Name": secret["Name"]})
vid = new_uuid()
- now = time.time()
+ now = int(time.time())
secret["Versions"][vid] = {
"SecretString": data.get("SecretString"),
"SecretBinary": data.get("SecretBinary"),
@@ -499,7 +510,7 @@ def _put_secret_value(data):
vid = data.get("ClientRequestToken", new_uuid())
stages = data.get("VersionStages", ["AWSCURRENT"])
- now = time.time()
+ now = int(time.time())
secret["Versions"][vid] = {
"SecretString": data.get("SecretString"),
@@ -602,7 +613,7 @@ def _update_secret_version_stage(data):
_remove_stage_everywhere(secret, "AWSPREVIOUS")
_add_stage(secret, old_current_vid, "AWSPREVIOUS")
- secret["LastChangedDate"] = time.time()
+ secret["LastChangedDate"] = int(time.time())
return json_response({"ARN": secret["ARN"], "Name": secret["Name"]})
@@ -699,7 +710,7 @@ def _rotate_secret(data):
secret["RotationEnabled"] = True
vid = data.get("ClientRequestToken", new_uuid())
- now = time.time()
+ now = int(time.time())
curr_vid, curr_ver = _find_stage_version(secret, "AWSCURRENT")
secret["Versions"][vid] = {
diff --git a/ministack/services/servicediscovery.py b/ministack/services/servicediscovery.py
index 51d0620a..dc64f6dd 100644
--- a/ministack/services/servicediscovery.py
+++ b/ministack/services/servicediscovery.py
@@ -134,7 +134,7 @@ def _create_operation(op_type: str, targets=None):
op_id = new_uuid()
targets = targets or {}
- now = time.time()
+ now = int(time.time())
op = {
"Id": op_id,
"Status": "SUCCESS",
@@ -189,7 +189,7 @@ async def _create_namespace(data):
"Name": ns_name,
"Type": ns_type,
"Description": data.get("Description"),
- "CreateDate": time.time(),
+ "CreateDate": int(time.time()),
}
if ns_type != "HTTP":
@@ -287,7 +287,7 @@ def _create_service(data):
"DnsConfig": data.get("DnsConfig"),
"HealthCheckConfig": data.get("HealthCheckConfig"),
"HealthCheckCustomConfig": data.get("HealthCheckCustomConfig"),
- "CreateDate": time.time(),
+ "CreateDate": int(time.time()),
}
_services[svc_id] = service
_service_attributes.setdefault(svc_id, {})
diff --git a/ministack/services/sns.py b/ministack/services/sns.py
index f7dbdaa7..1063d799 100644
--- a/ministack/services/sns.py
+++ b/ministack/services/sns.py
@@ -459,7 +459,7 @@ def _publish(params):
"subject": subject,
"message_structure": message_structure,
"message_attributes": msg_attrs,
- "timestamp": time.time(),
+ "timestamp": int(time.time()),
})
group_id = _p(params, "MessageGroupId") or ""
@@ -511,7 +511,7 @@ def _publish_batch(params):
"subject": subject,
"message_structure": message_structure,
"message_attributes": msg_attrs,
- "timestamp": time.time(),
+ "timestamp": int(time.time()),
})
_fanout(topic_arn, msg_id, message, subject, message_structure, msg_attrs)
diff --git a/pyproject.toml b/pyproject.toml
index 6e1722b9..630c0c09 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ministack"
-version = "1.2.4"
+version = "1.2.5"
description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"
readme = "README.md"
license = { file = "LICENSE" }
diff --git a/tests/test_cloudfront.py b/tests/test_cloudfront.py
index 9bae49d1..fde685ac 100644
--- a/tests/test_cloudfront.py
+++ b/tests/test_cloudfront.py
@@ -483,8 +483,10 @@ def test_oac_delete_no_if_match(cloudfront):
url = f"{endpoint}/2020-05-31/origin-access-control/{oac_id}"
req = urllib.request.Request(
url,
+ data=b"",
method="DELETE",
headers={
+ "Content-Length": "0",
"Authorization": "AWS4-HMAC-SHA256 Credential=test/20240101/us-east-1/cloudfront/aws4_request, SignedHeaders=host, Signature=fake",
},
)
diff --git a/tests/test_secretsmanager.py b/tests/test_secretsmanager.py
index caf00ff1..4f2a5104 100644
--- a/tests/test_secretsmanager.py
+++ b/tests/test_secretsmanager.py
@@ -321,3 +321,19 @@ def test_secretsmanager_kms_key_id_on_update(sm):
resp = sm.describe_secret(SecretId="kms-test-secret")
assert resp["KmsKeyId"] == "alias/other-key"
+
+def test_secretsmanager_get_by_partial_arn(sm):
+ """GetSecretValue with a partial ARN (no random suffix) must resolve the secret."""
+ import uuid as _uuid
+ name = f"partial-arn-test/{_uuid.uuid4().hex[:8]}"
+ created = sm.create_secret(Name=name, SecretString="partial-arn-value")
+ full_arn = created["ARN"]
+
+ # Full ARN works
+ assert sm.get_secret_value(SecretId=full_arn)["SecretString"] == "partial-arn-value"
+
+ # Partial ARN: strip the random suffix (last hyphen + 6 chars)
+ partial_arn = full_arn.rsplit("-", 1)[0]
+ assert partial_arn != full_arn
+ assert sm.get_secret_value(SecretId=partial_arn)["SecretString"] == "partial-arn-value"
+