From 578896db5b4ba892bb2bb173b33dabb88d90ea1e Mon Sep 17 00:00:00 2001 From: Arun Rajkumar Date: Fri, 29 Jul 2022 11:01:57 +0530 Subject: [PATCH] Update lambda_http_api_ip_validation.py We have use routearn so regsion doesnt stay hardcoded --- lambda/lambda_http_api_ip_validation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lambda/lambda_http_api_ip_validation.py b/lambda/lambda_http_api_ip_validation.py index e21b8f9..4508375 100644 --- a/lambda/lambda_http_api_ip_validation.py +++ b/lambda/lambda_http_api_ip_validation.py @@ -37,7 +37,7 @@ def lambda_handler(event, context): METHOD = event["requestContext"]["http"]["method"] STAGE = event["requestContext"]["stage"] ROUTE = event["requestContext"]["http"]["path"] - + ROUTEARN = event["routeArn"] if event["headers"]["authorizationtoken"] == "secretcode" and VALID_IP: response = { @@ -48,7 +48,7 @@ def lambda_handler(event, context): { "Action": "execute-api:Invoke", "Effect": "Allow", - "Resource": f"arn:aws:execute-api:us-east-1:{ACC_ID}:{API_ID}/{STAGE}/{METHOD}{ROUTE}", + "Resource": f"{ROUTEARN}", } ], }, @@ -65,7 +65,7 @@ def lambda_handler(event, context): { "Action": "execute-api:Invoke", "Effect": "Deny", - "Resource": f"arn:aws:execute-api:us-east-1:{ACC_ID}:{API_ID}/*/*/*", + "Resource": f"{ROUTEARN}", } ], },