Skip to content

Commit 07372e5

Browse files
mccoypiscai-msft
authored andcommitted
[Storage] Move test keys into CredScan-suppressed helper files (#20330)
1 parent f16bdf5 commit 07372e5

File tree

8 files changed

+23
-104
lines changed

8 files changed

+23
-104
lines changed

eng/CredScanSuppression.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"sdk/identity/azure-identity/tests/certificate.pfx",
4545
"sdk/identity/azure-identity/tests/certificate-with-password.pfx",
4646
"sdk/core/azure-servicemanagement-legacy/tests/legacy_mgmt_settings_fake.py",
47-
"sdk/storage/azure-storage-blob/tests/blob_settings_fake.py",
48-
"sdk/storage/azure-storage-file-datalake/tests/data_lake_settings_fake.py",
47+
"sdk/storage/azure-storage-blob/tests/fake_credentials.py",
48+
"sdk/storage/azure-storage-file-datalake/tests/fake_credentials.py",
4949
"tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py"
5050
],
5151
"_justification": "File contains private key used by test code."

sdk/storage/azure-storage-blob/tests/blob_settings_fake.py

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
7+
CPK_KEY_VALUE = "MDEyMzQ1NjcwMTIzNDU2NzAxMjM0NTY3MDEyMzQ1Njc="
8+
CPK_KEY_HASH = "3QFFFpRA5+XANHqwwbT4yXDmrT/2JaLt/FKHjzhOdoE="

sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ResourceTypes,
3030
AccountSasPermissions, generate_container_sas, ContainerClient, CustomerProvidedEncryptionKey,
3131
)
32+
from fake_credentials import CPK_KEY_HASH, CPK_KEY_VALUE
3233
from _shared.testcase import GlobalStorageAccountPreparer
3334
from devtools_testutils.storage import StorageTestCase
3435

@@ -862,8 +863,7 @@ def test_if_blob_with_cpk_exists(self, resource_group, location, storage_account
862863
connection_data_block_size=4 * 1024)
863864
cc.create_container()
864865
self._setup()
865-
test_cpk = CustomerProvidedEncryptionKey(key_value="MDEyMzQ1NjcwMTIzNDU2NzAxMjM0NTY3MDEyMzQ1Njc=",
866-
key_hash="3QFFFpRA5+XANHqwwbT4yXDmrT/2JaLt/FKHjzhOdoE=")
866+
test_cpk = CustomerProvidedEncryptionKey(key_value=CPK_KEY_VALUE, key_hash=CPK_KEY_HASH)
867867
blob_client = cc.get_blob_client("test_blob")
868868
blob_client.upload_blob(b"hello world", cpk=test_cpk)
869869
# Act

sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
AccessPolicy, generate_account_sas, ResourceTypes, AccountSasPermissions, generate_blob_sas, BlobSasPermissions,
2929
generate_container_sas, CustomerProvidedEncryptionKey,
3030
)
31+
from fake_credentials import CPK_KEY_HASH, CPK_KEY_VALUE
3132
from _shared.testcase import GlobalStorageAccountPreparer
3233
from devtools_testutils.storage.aio import AsyncStorageTestCase
3334

@@ -884,8 +885,7 @@ async def test_if_blob_with_cpk_exists(self, resource_group, location, storage_a
884885
connection_data_block_size=4 * 1024)
885886
await cc.create_container()
886887
self._setup()
887-
test_cpk = CustomerProvidedEncryptionKey(key_value="MDEyMzQ1NjcwMTIzNDU2NzAxMjM0NTY3MDEyMzQ1Njc=",
888-
key_hash="3QFFFpRA5+XANHqwwbT4yXDmrT/2JaLt/FKHjzhOdoE=")
888+
test_cpk = CustomerProvidedEncryptionKey(key_value=CPK_KEY_VALUE, key_hash=CPK_KEY_HASH)
889889
blob_client = cc.get_blob_client("test_blob")
890890
await blob_client.upload_blob(b"hello world", cpk=test_cpk)
891891
# Act

sdk/storage/azure-storage-file-datalake/tests/data_lake_settings_fake.py

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
7+
STORAGE_DATA_LAKE_ACCOUNT_FAKE_KEY = "NzhL3hKZbJBuJ2484dPTR+xF30kYaWSSCbs2BzLgVVI1woqeST/1IgqaLm6QAOTxtGvxctSNbIR/1hW8yH+bJg=="

sdk/storage/azure-storage-file-datalake/tests/testcase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from azure_devtools.scenario_tests import RecordingProcessor
2020
from devtools_testutils import AzureTestCase, PowerShellPreparer
21+
from fake_credentials import STORAGE_DATA_LAKE_ACCOUNT_FAKE_KEY
2122

2223
try:
2324
from cStringIO import StringIO # Python 2
@@ -38,7 +39,7 @@
3839
DataLakePreparer = functools.partial(
3940
PowerShellPreparer, "storage",
4041
datalake_storage_account_name="storagename",
41-
datalake_storage_account_key="NzhL3hKZbJBuJ2484dPTR+xF30kYaWSSCbs2BzLgVVI1woqeST/1IgqaLm6QAOTxtGvxctSNbIR/1hW8yH+bJg=="
42+
datalake_storage_account_key=STORAGE_DATA_LAKE_ACCOUNT_FAKE_KEY
4243
)
4344

4445

0 commit comments

Comments
 (0)