Skip to content

Commit 4617109

Browse files
committed
fix patching of "apiStages" in API GW usage plans; release version 0.12.15
1 parent 3840889 commit 4617109

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
(Please also refer to https://github.com/localstack/localstack/releases for a more human-readable version of the change log.)
44

5+
* v0.12.15: Security fixes: bind edge service to 127.0.0.1 by default (instead of 0.0.0.0); remove dead/unused CloudFormation code; refactor common.py and add tests; restructure Elasticsearch process management; fix processing of empty values in EventBridge event filters; fix JSON Patch operations for API Gateway usage plans; make for-loop in Makefile /bin/sh compatible; add flake8 rule F401 (unused imports); run pre-release smoke tests for Pro features in CI builds; remove quiet parameter from service starting; update code style badge in README.md; format the codebase with black and isort; add additional allowed CORS origins to fix Cognito issues; minor formatting in bug-report issue template; add CF support for CertificateManager::Certificate; refactor tests to fix/invert order of arguments in test assertions; add support for Kinesis CBOR error messages; refactor test_integration.py to use randomly generated resource names; add unit test for moto parsing of complex params from querystring; fix detection of resource status to allow re-deployment of CF stack after deletion; update bug-report issue template to assign correct label; fix minor formatting issues in http/proxy server; update .dockerignore to exclude files generated in CI build; fix installation of debugpy via pip module instead of calling pip CLI; add workaround for kinesis-mock persistence startup failure; reduce log verbosity for CORS/origin checks
56
* v0.12.14: Security fixes: fix CORS setup to prevent CSRF, add `DISABLE_*_CORS_*` configs; add KINESIS_INITIALIZE_STREAMS configuration to initialize Kinesis streams on startup; migrate from nose to pytests; add support for EventBridge API destinations; minor refactoring - add dynamodb_table_exists() to common utils; update badges in README; refactor test_error_injection.py into a unittest.TestCase class; minor: fix KeyError for missing EventSourceArn in Lambda API lookup; refactor tests and invert/fix order of assertion arguments; update coveralls config for new test setup with pytests; improve version check in check_terraform_version; pin serverless version in TestServerless to 2.48.0; add coverage install to Dockerfile.base to enable coverage C extensions; fix prefix filtering of events in EventBridge API in case of exact match; fix deprecation warnings surfaced when introducing pytest; minor: make "enabled" flag to add_job(..) optional; add support for V4 S3 presigned URLs with custom headers; add support for isBase64Encoded flag with Lambda integrations in API Gateway; fix extract build report step in docker-build CI phase; fix passing environment variables to container creation for LAMBDA_EXECUTOR=docker-reuse; add CloudFormation support for CloudWatch::Alarm resources; minor fix in file regex for plugin lookup to accommodate Windows path separators; fix request params for CF deployment of ApiGateway::Stage; parallelize builds and improve CircleCI workflow; minor fix to avoid exception on missing CloudFormation exports; add support for API GW MOCK integration and response parameters; fix linter exclusions in install.py; minor fixes in S3 API; fall back to using JAR for kinesis-mock installation for ARM systems (e.g., Macbook M1); add config option TF_COMPAT_MODE to enable TF compatibility mode (for TF integration tests); minor: add parse_json_or_yaml() util function; add threading event to indicate infrastructure has started; fix time duration unit for profiler log_duration output; remove superfluous coveralls config, now managed via CI env
67
* v0.12.13: Introduce kinesis-mock as default provider for Kinesis (replacing kinesalite); add support for API Gateway client certificates; fix minor formatting issue in profiler log; fix S3 bucket notification FilterRule name validation; minor refactoring around Kinesis handler and x-amzn-errortype response header; fix deprecation warnings in unit tests; fix timezone issues in timestamp calculation and datetime comparisons; add support for API Gateway - S3 integration for GET requests; use the new MOTO_S3_DEFAULT_KEY_BUFFER_SIZE variable for S3 in-memory buffer sizes; minor: update Helm repo URL in README from HTTP to HTTPS; minor fix in extraction of Lambda results from log output lines; add CF support for ResourceGroups::Group; refactor shutdown procedure; ignore trailing slashes for some routes in Lambda API; fix response for Lambda configuration update API; fix passing payload via stdin for large Lambda events using docker-reuse; fix duplicate Content-Type header in Lambda invocation responses; add BUCKET_MARKER_LOCAL option to customize S3 bucket name (`__local__`) for local Lambda code mounting; add support for API Gateway VPC Links; fix API GW JSONPatch operations and error responses; add support for x-id query param for S3 delete object requests; add tagging support for IAM policies and instance profiles; add support for Kinesis EnableEnhancedMonitoring; minor fix for Kinesis max stream retention period; add support for EC2 create_vpc_endpoint_service_configuration; fix start_edge to gracefully fail when stdin for sudo is not available; minor fix when extracting URI for API GW integrations; minor CF fix to extract PhysicalResourceId via get_physical_resource_id(); make parsing of IAM::Role properties more resilient; fix continuation sequence number in event returned by SubscribeToShard Kinesis API; use --env-file to pass env vars to Lambda containers to prevent cmd line arguments from becoming too long; fix symlink to aws CLI executable in Dockerfile; fix datetime format for Lambda put-function-event-invoke-config response; minor refactoring of Dockerfile and API Gateway tests; add support for requestParameters in Api Gateway method integrations; fix skipping S3 signature validation if S3_SKIP_SIGNATURE_VALIDATION is enabled; fix stripping off qualifier suffix when constructing ARN for Lambda lookup; update PYTHONPATH in image to accommodate both python v3.8 and v3.7; refactor API GW impl. for better compatibility with Terraform; parallelize SNS message delivery for improved performance; fix returning error response for attempting to delete non-existing S3 bucket
78
* v0.12.12: Add XRay trace headers in notifications from S3 to SQS; add initial support for Resource Groups API; minor enhancements in base image to optimize disk space; add support for managing request payers on S3 buckets; minor refactoring of docker-reuse Lambda executor for better extensibility; save SES email contents to disk in machine-readable format; add support for KinesisStreamSpecification parameter for AWS::DynamoDB::Table CF resource; fix missing SQS message attributes for notifications via SNS; add support for LAMBDA_DOCKER_FLAGS to support custom Lambda Docker run flags; add DEVELOP configuration for debugpy integration; add support for servicediscovery endpoints in API GW invocations; minor refactoring for EC2::VPCGatewayAttachment CF model; add patch for stepfunctions-local to enable cross-region Lambda access; minor: add simple items_equivalent() util function; use configured edge port in S3 presign URL calculation; add test for creating bucket with existsting bucket name; add support for session_token in S3 presign URLs; enhance validation of presigned URLs to support different port numbers in S3 URLs; add Lambda Ruby 2.7 image support and update tests; fix EC2::Route CF model to properly lookup deployment state if DestinationIpv6CidrBlock not set; fix fetching CF resource state for EC2::Route and Logs::LogGroup; remove obsolete DynamoDBLocal fix for Alpine; add EventsBackend to manage state of Events API resources; fix broken SNS test related to UnsubscribeURL returned on subscription attributes; fix edge route mapping for SES requests using /email route; add UnsubscribeURL in payload sent to HTTP SQS endpoints; minor refactoring in API Gateway implementation; fix syntax in aws_stack.py for compatibility with python 2.x; fix incorrect suffixes in SecretManager ARNs for secret lookups; temporarily set S3_SKIP_SIGNATURE_VALIDATION=1 by default (until all issues with S3 presign URLs are resolved); add docs for Kafka and Elasticsearch external services integration; minor fix in ACM to avoid returning duplicate DomainValidationOptions; add CF support for ApiGateway::RequestValidator, Logs::SubscriptionFilter; add region backend for DynamoDB state; add support for DynamoDB table replicas; minor: allow passing keyword args to async_utils.run_sync(..); add support for arn:aws-us-gov:iam:... managed IAM policies; fix Python sys path for module resolution when using local Lambda executor; update version in sample docker-compose.yml; minor: initialize Properties for CF resource instances; support ElasticsearchClusterConfig parameter for creation of ES clusters; add CloudFormation model for Redshift::Cluster; add test case for generating S3 presign URL from Node.js Lambda; fix integration test assertions to accommodate recent CloudWatch metrics changes; fix idempotence for SNS CreatePlatformEndpoint API calls; fix correct error code for getting attributes of non-existing SNS subscription; fix correct Authn header for internal call when replaying non HMAC request; fix filtering of CloudWatch metrics and dimensions; add simple TCP proxy server util; add "running" property to FuncThread; fix URL escaping when calculating presigned URLs to accommodate recent Quart server update; fix double response headers in CORS preflight API Gateway requests; refactor logic for sending SQS messages to DLQ; fix resetting ETags when copying S3 object from multipart upload; cache target API in edge requests for improved performance; skip gzip encoding for S3 responses to fix content-length issue with Go SDK; fix accessing raw response when returning gzip encoded content from Lambdas via API GW; rename currentThread to current_thread for deprecation in Python 3.10; minor: add utility function to clean up Docker containers; fix copying missing events file into container for Java Lambdas with docker-reuse; fix Kinesis response payload encoding for use with Java SDK; add S3_SKIP_SIGNATURE_VALIDATION config to skip S3 presign URL signature validation; add support for Route53 reusable-delegation-set APIs; add missing endpoints for StepFunctions startup command

localstack/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import localstack_client.config
44

55
# LocalStack version
6-
VERSION = "0.12.14"
6+
VERSION = "0.12.15"
77

88
# constant to represent the "local" region, i.e., local machine
99
REGION_LOCAL = "local"

localstack/services/apigateway/apigateway_starter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,17 @@ def apigateway_response_usage_plan_individual(
325325
usage_plan = self.backend.usage_plans.get(usage_plan_id)
326326
if not usage_plan:
327327
raise UsagePlanNotFoundException()
328+
328329
apply_json_patch_safe(usage_plan, patch_operations, in_place=True)
330+
# fix certain attributes after running the patch updates
331+
if isinstance(usage_plan.get("apiStages"), (dict, str)):
332+
usage_plan["apiStages"] = [usage_plan["apiStages"]]
333+
api_stages = usage_plan.get("apiStages") or []
334+
for i in range(len(api_stages)):
335+
if isinstance(api_stages[i], str) and ":" in api_stages[i]:
336+
api_id, stage = api_stages[i].split(":")
337+
api_stages[i] = {"apiId": api_id, "stage": stage}
338+
329339
return 200, {}, json.dumps(usage_plan)
330340
result = apigateway_response_usage_plan_individual_orig(
331341
self, request, full_url, headers, *args, **kwargs

localstack/services/apigateway/helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,9 @@ def apply_json_patch_safe(subject, patch_operations, in_place=True, return_list=
791791
operation["op"] = "add"
792792
return apply_patch(subject, [operation], in_place=in_place)
793793
if operation["op"] == "remove" and isinstance(subject, dict):
794-
subject.pop(operation["path"], None)
794+
result = subject.pop(operation["path"], None)
795+
results.append(result)
796+
continue
795797
raise
796798
if return_list:
797799
return results

0 commit comments

Comments
 (0)