Skip to content

Commit

Permalink
Update Whitelist to Allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Sep 23, 2021
1 parent fac4cf4 commit 3baaacd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions sdk/core/azure-core/tests/async_tests/test_pipeline_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_default_http_logging_policy():
pipeline_client = AsyncPipelineClient(base_url="test")
pipeline = pipeline_client._build_pipeline(config)
http_logging_policy = pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST

def test_pass_in_http_logging_policy():
config = Configuration()
Expand All @@ -186,7 +186,7 @@ def test_pass_in_http_logging_policy():
pipeline_client = AsyncPipelineClient(base_url="test")
pipeline = pipeline_client._build_pipeline(config)
http_logging_policy = pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"})
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union({"x-ms-added-header"})

@pytest.mark.asyncio
@pytest.mark.parametrize("http_request", HTTP_REQUESTS)
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_default_http_logging_policy(http_request):
pipeline_client = PipelineClient(base_url="test")
pipeline = pipeline_client._build_pipeline(config)
http_logging_policy = pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST

@pytest.mark.parametrize("http_request", HTTP_REQUESTS)
def test_pass_in_http_logging_policy(http_request):
Expand All @@ -77,7 +77,7 @@ def test_pass_in_http_logging_policy(http_request):
pipeline_client = PipelineClient(base_url="test")
pipeline = pipeline_client._build_pipeline(config)
http_logging_policy = pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"})
assert http_logging_policy.allowed_header_names == HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union({"x-ms-added-header"})


@pytest.mark.parametrize("http_request", HTTP_REQUESTS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ARMHttpLoggingPolicy(HttpLoggingPolicy):
"""HttpLoggingPolicy with ARM specific safe headers fopr loggers.
"""

DEFAULT_HEADERS_WHITELIST = HttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST | set([
DEFAULT_HEADERS_ALLOWLIST = HttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST | set([
# https://docs.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling#remaining-requests
"x-ms-ratelimit-remaining-subscription-reads",
"x-ms-ratelimit-remaining-subscription-writes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_default_http_logging_policy():
config = Configuration()
pipeline_client = AsyncARMPipelineClient(base_url="test", config=config)
http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST

def test_pass_in_http_logging_policy():
config = Configuration()
Expand All @@ -43,4 +43,4 @@ def test_pass_in_http_logging_policy():

pipeline_client = AsyncARMPipelineClient(base_url="test", config=config)
http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"})
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union({"x-ms-added-header"})
4 changes: 2 additions & 2 deletions sdk/core/azure-mgmt-core/tests/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_default_http_logging_policy():
config = Configuration()
pipeline_client = ARMPipelineClient(base_url="test", config=config)
http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST

def test_pass_in_http_logging_policy():
config = Configuration()
Expand All @@ -184,4 +184,4 @@ def test_pass_in_http_logging_policy():

pipeline_client = ARMPipelineClient(base_url="test", config=config)
http_logging_policy = pipeline_client._pipeline._impl_policies[-1]._policy
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_WHITELIST.union({"x-ms-added-header"})
assert http_logging_policy.allowed_header_names == ARMHttpLoggingPolicy.DEFAULT_HEADERS_ALLOWLIST.union({"x-ms-added-header"})

0 comments on commit 3baaacd

Please sign in to comment.