mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-03-21 18:58:04 +00:00
fix(aws): respect AWS_ENDPOINT_URL for STS session creation (#10228)
Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user