fix(aws): respect AWS_ENDPOINT_URL for STS session creation (#10228)

Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
Harsh Mishra
2026-03-03 12:55:59 +05:30
committed by GitHub
parent dcf74113fc
commit 150abce4a8
3 changed files with 17 additions and 1 deletions

View File

@@ -1521,6 +1521,19 @@ aws:
sts_session._endpoint.host == f"https://sts.{aws_region}.amazonaws.com.cn"
)
@mock_aws
def test_create_sts_session_custom_endpoint_url(self):
custom_endpoint = "http://localhost:4566"
current_session = session.Session()
aws_region = AWS_REGION_US_EAST_1
with mock.patch.dict(os.environ, {"AWS_ENDPOINT_URL": custom_endpoint}):
sts_session = AwsProvider.create_sts_session(current_session, aws_region)
assert sts_session._service_model.service_name == "sts"
assert sts_session._client_config.region_name == aws_region
assert sts_session._endpoint._endpoint_prefix == "sts"
assert sts_session._endpoint.host == custom_endpoint
@mock_aws
def test_create_sts_session_eusc(self):
current_session = session.Session()