Skip to content

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

fix: security & maintenance hardening (#299) (#339)

Akhil adiga7b0bbea02ba5
diff --git a/Makefile b/Makefile
index 8930b319..3e3aad97 100644
--- a/Makefile
+++ b/Makefile
@@ -94,7 +94,7 @@ z.writestr('index.py', 'import json\ndef handler(event, context):\n return {\
z.close(); \
print('Lambda zip created')"
aws --endpoint-url=http://localhost:$(PORT) lambda create-function \
- --function-name alb-test-fn --runtime python3.9 \
+ --function-name alb-test-fn --runtime python3.12 \
--handler index.handler \
--role arn:aws:iam::000000000000:role/role \
--zip-file fileb:///tmp/ms-alb-test.zip
diff --git a/docker-compose.yml b/docker-compose.yml
index f23fac3a..056e5018 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,3 @@
-version: "3.8"
-
services:
ministack:
build: .
diff --git a/ministack/app.py b/ministack/app.py
index 869025d2..41accdf0 100644
--- a/ministack/app.py
+++ b/ministack/app.py
@@ -739,7 +739,7 @@ async def _run_ready_scripts():
script_env.setdefault("AWS_ACCESS_KEY_ID", "test")
script_env.setdefault("AWS_SECRET_ACCESS_KEY", "test")
script_env.setdefault("AWS_DEFAULT_REGION", os.environ.get("MINISTACK_REGION", "us-east-1"))
- script_env.setdefault("AWS_ENDPOINT_URL", f"http://localhost:{port}")
+ script_env.setdefault("AWS_ENDPOINT_URL", f"http://{_MINISTACK_HOST}:{port}")
for script_path in scripts:
logger.info('Running ready script: %s', script_path)
try:
diff --git a/ministack/core/lambda_runtime.py b/ministack/core/lambda_runtime.py
index d1cbd12c..f59d2a96 100644
--- a/ministack/core/lambda_runtime.py
+++ b/ministack/core/lambda_runtime.py
@@ -332,7 +332,7 @@ class Worker:
def _spawn(self):
"""Extract zip and start worker process."""
self._tmpdir = tempfile.mkdtemp(prefix=f"ministack-lambda-{self.func_name}-")
- runtime = self.config.get("Runtime", "python3.9")
+ runtime = self.config.get("Runtime", "python3.12")
binary, worker_script = _detect_runtime_binary(runtime)
if not binary:
raise RuntimeError(f"Unsupported runtime: {runtime}")
diff --git a/ministack/services/cloudformation/provisioners.py b/ministack/services/cloudformation/provisioners.py
index 66138729..75a550f6 100644
--- a/ministack/services/cloudformation/provisioners.py
+++ b/ministack/services/cloudformation/provisioners.py
@@ -360,7 +360,7 @@ def _ddb_delete(physical_id, props):
# --- Lambda Function ---
-def _zip_inline(source: str | None, handler: str, runtime: str = "python3.9") -> bytes | None:
+def _zip_inline(source: str | None, handler: str, runtime: str = "python3.12") -> bytes | None:
"""Wrap inline ZipFile source code into a real zip archive."""
if not source:
return None
@@ -375,7 +375,7 @@ def _zip_inline(source: str | None, handler: str, runtime: str = "python3.9") ->
def _lambda_create(logical_id, props, stack_name):
name = props.get("FunctionName") or _physical_name(stack_name, logical_id, max_len=64)
arn = f"arn:aws:lambda:{REGION}:{get_account_id()}:function:{name}"
- runtime = props.get("Runtime", "python3.9")
+ runtime = props.get("Runtime", "python3.12")
handler = props.get("Handler", "index.handler")
role = props.get("Role", f"arn:aws:iam::{get_account_id()}:role/dummy-role")
timeout = int(props.get("Timeout", 3))
@@ -2244,7 +2244,7 @@ def _apigw_v2_api_create(logical_id, props, stack_name):
"apiId": api_id,
"name": name,
"protocolType": protocol,
- "apiEndpoint": f"http://{api_id}.execute-api.localhost:4566",
+ "apiEndpoint": f"http://{api_id}.execute-api.{os.environ.get('MINISTACK_HOST', 'localhost')}:{os.environ.get('GATEWAY_PORT', '4566')}",
"createdDate": now_iso(),
"routeSelectionExpression": props.get("RouteSelectionExpression", "$request.method $request.path"),
"apiKeySelectionExpression": props.get("ApiKeySelectionExpression", "$request.header.x-api-key"),
diff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.py
index 6ae0a9d3..9f4fb59e 100644
--- a/ministack/services/lambda_svc.py
+++ b/ministack/services/lambda_svc.py
@@ -379,7 +379,7 @@ def _build_config(name: str, data: dict, code_zip: bytes | None = None) -> dict:
config = {
"FunctionName": name,
"FunctionArn": _func_arn(name),
- "Runtime": data.get("Runtime", "" if is_image else "python3.9"),
+ "Runtime": data.get("Runtime", "" if is_image else "python3.12"),
"Role": data.get("Role", f"arn:aws:iam::{get_account_id()}:role/lambda-role"),
"Handler": data.get("Handler", "" if is_image else "index.handler"),
"CodeSize": code_size,
@@ -710,6 +710,14 @@ def _create_function(data: dict):
if image_uri:
data.setdefault("PackageType", "Image")
+ is_image = data.get("PackageType", "Zip") == "Image"
+ if not is_image and not data.get("Runtime"):
+ return error_response_json(
+ "InvalidParameterValueException",
+ "Runtime is required for .zip deployment packages.",
+ 400,
+ )
+
config = _build_config(name, data, code_zip)
if image_uri:
config["ImageUri"] = image_uri
@@ -1044,7 +1052,7 @@ def _execute_function_docker(func: dict, event: dict) -> dict:
``{"body": ..., "log": ..., "error": ...}``.
"""
config = func.get("config") or func
- runtime = config.get("Runtime", "python3.9")
+ runtime = config.get("Runtime", "python3.12")
if not _docker_available:
@@ -1315,7 +1323,7 @@ def _execute_function(func: dict, event: dict) -> dict:
if config.get("PackageType") == "Image" and config.get("ImageUri"):
return _execute_function_image(func, event)
- runtime = config.get("Runtime", "python3.9")
+ runtime = config.get("Runtime", "python3.12")
if LAMBDA_EXECUTOR == "docker":
return _execute_function_docker(func, event)
diff --git a/pyproject.toml b/pyproject.toml
index 98e41c3e..f9d114d2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -67,7 +67,7 @@ python_functions = ["test_*"]
[tool.ruff]
line-length = 120
-target-version = "py310"
+target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I"]
diff --git a/tests/test_apigw.py b/tests/test_apigw.py
index 2d78c982..af318640 100644
--- a/tests/test_apigw.py
+++ b/tests/test_apigw.py
@@ -256,7 +256,7 @@ def test_apigw_execute_lambda_proxy(apigw, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -319,7 +319,7 @@ def test_apigw_execute_default_route(apigw, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -359,7 +359,7 @@ def test_apigw_path_param_route(apigw, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -398,7 +398,7 @@ def test_apigw_path_parameters_in_event(apigw, lam):
)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -439,7 +439,7 @@ def test_apigw_greedy_path_parameters_in_event(apigw, lam):
)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -484,7 +484,7 @@ def test_apigw_query_params_and_headers_in_event(apigw, lam):
)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -532,7 +532,7 @@ def test_apigw_multiple_path_parameters(apigw, lam):
)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -577,7 +577,7 @@ def test_apigw_no_path_parameters_returns_null(apigw, lam):
)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -618,7 +618,7 @@ def test_apigw_url_encoded_path_parameter(apigw, lam):
)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -657,7 +657,7 @@ def test_apigw_greedy_path_param(apigw, lam):
code = 'def handler(event, context):\n return {"statusCode": 200, "body": event["rawPath"]}\n'
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -735,7 +735,7 @@ def test_apigw_routekey_in_lambda_event(apigw, lam):
code = 'def handler(event, context):\n return {"statusCode": 200, "body": event["routeKey"]}\n'
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
diff --git a/tests/test_apigwv1.py b/tests/test_apigwv1.py
index 37dee3c3..3703a6d5 100644
--- a/tests/test_apigwv1.py
+++ b/tests/test_apigwv1.py
@@ -351,7 +351,7 @@ def test_apigwv1_execute_lambda_proxy(apigw_v1, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -409,7 +409,7 @@ def test_apigwv1_execute_path_params(apigw_v1, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -540,7 +540,7 @@ def test_apigwv1_no_conflict_with_v2(apigw_v1, apigw, lam):
zf.writestr("index.py", code_v1)
lam.create_function(
FunctionName=fname_v1,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf_v1.getvalue()},
@@ -554,7 +554,7 @@ def test_apigwv1_no_conflict_with_v2(apigw_v1, apigw, lam):
zf.writestr("index.py", code_v2)
lam.create_function(
FunctionName=fname_v2,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf_v2.getvalue()},
@@ -845,7 +845,7 @@ def test_apigwv1_execute_lambda_arn_uri(apigw_v1, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -909,7 +909,7 @@ def test_apigwv1_execute_lambda_requestcontext(apigw_v1, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
diff --git a/tests/test_cfn.py b/tests/test_cfn.py
index 5d9c2f14..c23f8903 100644
--- a/tests/test_cfn.py
+++ b/tests/test_cfn.py
@@ -333,7 +333,7 @@ def test_cfn_multi_resource_dependencies(cfn, iam, lam):
"Type": "AWS::Lambda::Function",
"Properties": {
"FunctionName": "cfn-t07-func",
- "Runtime": "python3.9",
+ "Runtime": "python3.12",
"Handler": "index.handler",
"Role": {"Fn::GetAtt": ["Role", "Arn"]},
"Code": {"ZipFile": "def handler(e,c): return {}"},
diff --git a/tests/test_elbv2.py b/tests/test_elbv2.py
index b1d33982..a04cf98f 100644
--- a/tests/test_elbv2.py
+++ b/tests/test_elbv2.py
@@ -325,7 +325,7 @@ def _alb_setup(elbv2, lam, lb_name, fn_name, fn_code, listener_port=80, extra_ru
# Lambda
lam.create_function(
FunctionName=fn_name,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": _alb_zip(fn_code)},
@@ -532,7 +532,7 @@ def test_elbv2_dataplane_path_pattern_rule(elbv2, lam):
for fn_name, fn_code in [("dp-alb-api-fn", api_code), ("dp-alb-def-fn", default_code)]:
lam.create_function(
FunctionName=fn_name,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": _alb_zip(fn_code)},
diff --git a/tests/test_eventbridge.py b/tests/test_eventbridge.py
index 4237a9cb..38a81f49 100644
--- a/tests/test_eventbridge.py
+++ b/tests/test_eventbridge.py
@@ -190,7 +190,7 @@ def test_eventbridge_lambda_target(eb, lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
diff --git a/tests/test_lambda.py b/tests/test_lambda.py
index 807646a4..4e14c156 100644
--- a/tests/test_lambda.py
+++ b/tests/test_lambda.py
@@ -48,7 +48,7 @@ def test_lambda_create_invoke(lam):
zf.writestr("index.py", code)
lam.create_function(
FunctionName="test-func-1",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -59,6 +59,21 @@ def test_lambda_create_invoke(lam):
payload = json.loads(resp["Payload"].read())
assert payload["statusCode"] == 200
+def test_create_function_missing_runtime_raises(lam):
+ """Zip deployment without a Runtime should return InvalidParameterValueException."""
+ buf = io.BytesIO()
+ with zipfile.ZipFile(buf, "w") as zf:
+ zf.writestr("index.py", "def handler(e, c): return {}")
+ with pytest.raises(ClientError) as exc:
+ lam.create_function(
+ FunctionName="no-runtime-fn",
+ Role="arn:aws:iam::000000000000:role/role",
+ Handler="index.handler",
+ Code={"ZipFile": buf.getvalue()},
+ )
+ assert exc.value.response["Error"]["Code"] == "InvalidParameterValueException"
+
+
def test_lambda_esm_sqs(lam, sqs):
"""SQS → Lambda event source mapping: messages sent to SQS trigger Lambda."""
import io
@@ -84,7 +99,7 @@ def test_lambda_esm_sqs(lam, sqs):
lam.create_function(
FunctionName="esm-test-func",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -125,13 +140,13 @@ def test_lambda_esm_sqs(lam, sqs):
def test_lambda_create_function(lam):
resp = lam.create_function(
FunctionName="lam-create-test",
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
)
assert resp["FunctionName"] == "lam-create-test"
- assert resp["Runtime"] == "python3.9"
+ assert resp["Runtime"] == "python3.12"
assert resp["Handler"] == "index.handler"
assert resp["State"] == "Active"
assert "FunctionArn" in resp
@@ -140,7 +155,7 @@ def test_lambda_create_duplicate(lam):
with pytest.raises(ClientError) as exc:
lam.create_function(
FunctionName="lam-create-test",
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -166,7 +181,7 @@ def test_lambda_list_functions(lam):
def test_lambda_delete_function(lam):
lam.create_function(
FunctionName="lam-to-delete",
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -179,7 +194,7 @@ def test_lambda_delete_function(lam):
def test_lambda_invoke(lam):
lam.create_function(
FunctionName="lam-invoke-test",
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -282,7 +297,7 @@ def test_lambda_esm_sqs_comprehensive(lam, sqs):
code = 'def handler(event, context):\n return {"processed": len(event.get("Records", []))}\n'
lam.create_function(
FunctionName="esm-comp-func",
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -330,7 +345,7 @@ def test_lambda_esm_sqs_failure_respects_visibility_timeout(lam, sqs):
lam.create_function(
FunctionName="esm-fail-func",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -391,7 +406,7 @@ def test_lambda_esm_sqs_report_batch_item_failures(lam, sqs):
)
lam.create_function(
FunctionName="esm-partial-func",
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -467,7 +482,7 @@ def test_lambda_warm_start(lam, apigw):
zf.writestr("index.py", code)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf.getvalue()},
@@ -808,7 +823,7 @@ def test_lambda_function_url_config(lam):
fn = f"intg-url-cfg-{_uuid_mod.uuid4().hex[:8]}"
lam.create_function(
FunctionName=fn,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -868,7 +883,7 @@ def test_lambda_reset_terminates_workers(lam):
code = "import time\n_boot = time.time()\ndef handler(event, context):\n return {'boot': _boot}\n"
lam.create_function(
FunctionName=fn,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -891,7 +906,7 @@ def test_lambda_reset_terminates_workers(lam):
# Re-create and invoke — new worker means new boot time
lam.create_function(
FunctionName=fn,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -905,7 +920,7 @@ def test_lambda_alias_crud(lam):
code = _zip_lambda("def handler(e,c): return {'v': 1}")
lam.create_function(
FunctionName="qa-lam-alias",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -934,7 +949,7 @@ def test_lambda_publish_version_snapshot(lam):
code = _zip_lambda("def handler(e,c): return 'v1'")
lam.create_function(
FunctionName="qa-lam-version",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -951,7 +966,7 @@ def test_lambda_function_concurrency(lam):
code = _zip_lambda("def handler(e,c): return {}")
lam.create_function(
FunctionName="qa-lam-concurrency",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -971,7 +986,7 @@ def test_lambda_add_remove_permission(lam):
code = _zip_lambda("def handler(e,c): return {}")
lam.create_function(
FunctionName="qa-lam-policy",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -995,7 +1010,7 @@ def test_lambda_list_functions_pagination(lam):
try:
lam.create_function(
FunctionName=f"qa-lam-page-{i}",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -1016,7 +1031,7 @@ def test_lambda_invoke_event_type_returns_202(lam):
try:
lam.create_function(
FunctionName="qa-lam-event-invoke",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -1036,7 +1051,7 @@ def test_lambda_invoke_dry_run_returns_204(lam):
try:
lam.create_function(
FunctionName="qa-lam-dryrun",
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/r",
Handler="index.handler",
Code={"ZipFile": code},
@@ -1357,7 +1372,7 @@ def test_lambda_warm_worker_invalidation(lam):
z.writestr("index.py", code_v1)
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Role="arn:aws:iam::000000000000:role/test-role",
Handler="index.handler",
Code={"ZipFile": buf1.getvalue()},
@@ -1895,7 +1910,7 @@ def test_lambda_empty_dead_letter_config(lam):
pass
resp = lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Handler="index.handler",
Role=_LAMBDA_ROLE,
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -1919,7 +1934,7 @@ def test_esm_sqs_no_starting_position(lam, sqs):
pass
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Handler="index.handler",
Role=_LAMBDA_ROLE,
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -1966,7 +1981,7 @@ def test_esm_kinesis_has_starting_position(lam, kin):
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Handler="index.handler",
Role=_LAMBDA_ROLE,
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
@@ -2007,7 +2022,7 @@ def test_esm_response_no_function_name_field(lam, sqs):
pass
lam.create_function(
FunctionName=fname,
- Runtime="python3.9",
+ Runtime="python3.12",
Handler="index.handler",
Role=_LAMBDA_ROLE,
Code={"ZipFile": _make_zip(_LAMBDA_CODE)},
diff --git a/tests/test_sfn.py b/tests/test_sfn.py
index 5d4a4232..82d9740d 100644
--- a/tests/test_sfn.py
+++ b/tests/test_sfn.py
@@ -1387,7 +1387,7 @@ def test_sfn_integration_lambda_invoke(sfn, lam):
code = "def handler(event, context):\n return {'doubled': event.get('value', 0) * 2}\n"
lam.create_function(
FunctionName=fn,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
diff --git a/tests/test_sns.py b/tests/test_sns.py
index 6077058b..f42e8bae 100644
--- a/tests/test_sns.py
+++ b/tests/test_sns.py
@@ -243,7 +243,7 @@ def test_sns_to_lambda_fanout(lam, sns):
code = "received = []\ndef handler(event, context):\n received.append(event)\n return {'ok': True}\n"
lam.create_function(
FunctionName=fn,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},
@@ -269,7 +269,7 @@ def test_sns_to_lambda_event_subscription_arn(lam, sns):
)
lam.create_function(
FunctionName=fn,
- Runtime="python3.9",
+ Runtime="python3.12",
Role=_LAMBDA_ROLE,
Handler="index.handler",
Code={"ZipFile": _make_zip(code)},