mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 21:11:53 +00:00
fix(sts): handle China STS regions (#3613)
This commit is contained in:
@@ -69,6 +69,9 @@ Caller Identity ARN: {Fore.YELLOW}[{audit_info.audited_identity_arn}]{Style.RESE
|
||||
def create_sts_session(
|
||||
session: session.Session, aws_region: str
|
||||
) -> session.Session.client:
|
||||
return session.client(
|
||||
"sts", aws_region, endpoint_url=f"https://sts.{aws_region}.amazonaws.com"
|
||||
sts_endpoint_url = (
|
||||
f"https://sts.{aws_region}.amazonaws.com"
|
||||
if "cn-" not in aws_region
|
||||
else f"https://sts.{aws_region}.amazonaws.com.cn"
|
||||
)
|
||||
return session.client("sts", aws_region, endpoint_url=sts_endpoint_url)
|
||||
|
||||
@@ -507,4 +507,4 @@ class Test_AWS_Credentials:
|
||||
sts_client = create_sts_session(session, aws_region)
|
||||
|
||||
assert sts_client._endpoint._endpoint_prefix == "sts"
|
||||
assert sts_client._endpoint.host == f"https://sts.{aws_region}.amazonaws.com"
|
||||
assert sts_client._endpoint.host == f"https://sts.{aws_region}.amazonaws.com.cn"
|
||||
|
||||
Reference in New Issue
Block a user