Skip to content

Commit

Permalink
hide secrets in mgmt sdk (Azure#18535)
Browse files Browse the repository at this point in the history
  • Loading branch information
00Kai0 authored May 7, 2021
1 parent 4486c6a commit db9cde5
Show file tree
Hide file tree
Showing 12 changed files with 939 additions and 1,552 deletions.
1 change: 0 additions & 1 deletion scripts/auto_release/mgmt_settings_real_.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
ACTIVE_DIRECTORY_TENANT_ID = '00000000-0000-0000-0000-000000000000'
IS_SERVER_SIDE_FILE_ENCRYPTION_ENABLED = True
ENABLE_LOGGING = True
AZURE_STORAGE_CONNECTION_STRING = 'DefaultEndpointsProtocol=https;AccountName=storagename;AccountKey=NzhL3hKZbJBuJ2484dPTR+xF30kYaWSSCbs2BzLgVVI1woqeST/1IgqaLm6QAOTxtGvxctSNbIR/1hW8yH+bJg==;EndpointSuffix=core.windows.net'

# Read for details of this file:
# https://github.com/Azure/azure-sdk-for-python/wiki/Contributing-to-the-tests
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class MgmtComputeTest(AzureMgmtTestCase):

def setUp(self):
super(MgmtComputeTest, self).setUp()
self.re_replacer.register_pattern_pair('"value":".{88}"', '"value":"FakeValue"')
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.compute.ComputeManagementClient
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class MgmtComputeTestMultiVersion(AzureMgmtTestCase):

def setUp(self):
super(MgmtComputeTestMultiVersion, self).setUp()
self.re_replacer.register_pattern_pair(
'\"accessSAS\": \"https://.*\"',
'\"accessSAS\": \"FakeUrl\"'
)
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.compute.ComputeManagementClient
)
Expand Down Expand Up @@ -109,6 +113,10 @@ class MgmtComputeTest(AzureMgmtTestCase):

def setUp(self):
super(MgmtComputeTest, self).setUp()
self.re_replacer.register_pattern_pair(
'\"accessSAS\": \"https://.*\"',
'\"accessSAS\": \"FakeUrl\"'
)
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.compute.ComputeManagementClient
)
Expand Down

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cli_mgmt_cosmosdb_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ class MgmtCosmosDBTest(AzureMgmtTestCase):

def setUp(self):
super(MgmtCosmosDBTest, self).setUp()
self.re_replacer.register_pattern_pair(
'"primaryMasterKey":".{88}"',
'"primaryMasterKey":"FakeKey"',
)
self.re_replacer.register_pattern_pair(
'"secondaryMasterKey":".{88}"',
'"secondaryMasterKey":"FakeKey"',
)
self.re_replacer.register_pattern_pair(
'"primaryReadonlyMasterKey":".{88}"',
'"primaryReadonlyMasterKey":"FakeKey"',
)
self.re_replacer.register_pattern_pair(
'"secondaryReadonlyMasterKey":".{88}"',
'"secondaryReadonlyMasterKey":"FakeKey"',
)
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.cosmosdb.CosmosDBManagementClient
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ interactions:
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountxxyyzzccc/regenerateKey?api-version=2021-02-01
response:
body:
string: '{"keys":[{"creationTime":"2021-04-13T05:47:41.2838152Z","keyName":"key1","value":"W2vpnh31w4m1ScIVh2uXTZY76x46jq7x8V3DGkuy47xHC/cWEZPAem0k/ACAf/m1lZy0KeTvDmA/G5NsAnjGgw==","permissions":"FULL"},{"creationTime":"2021-04-13T05:48:33.0184652Z","keyName":"key2","value":"a3sDevVNf9Cc8Q2B25jMbzubFEowOGfV3XNiCG0yy+7j95V+58ZhC++IRZL3OIHaCEydnxLngWUeJSHFVY5iBg==","permissions":"FULL"}]}'
string: '{"keys":[{"creationTime":"2021-04-13T05:47:41.2838152Z","keyName":"key1","value":"FakeValue","permissions":"FULL"},{"creationTime":"2021-04-13T05:48:33.0184652Z","keyName":"key2","value":"FakeValue","permissions":"FULL"}]}'
headers:
cache-control:
- no-cache
Expand Down Expand Up @@ -1937,7 +1937,7 @@ interactions:
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountxxyyzzccc/listKeys?api-version=2021-02-01&$expand=kerb
response:
body:
string: '{"keys":[{"creationTime":"2021-04-13T05:47:41.2838152Z","keyName":"key1","value":"W2vpnh31w4m1ScIVh2uXTZY76x46jq7x8V3DGkuy47xHC/cWEZPAem0k/ACAf/m1lZy0KeTvDmA/G5NsAnjGgw==","permissions":"FULL"},{"creationTime":"2021-04-13T05:48:33.0184652Z","keyName":"key2","value":"a3sDevVNf9Cc8Q2B25jMbzubFEowOGfV3XNiCG0yy+7j95V+58ZhC++IRZL3OIHaCEydnxLngWUeJSHFVY5iBg==","permissions":"FULL"}]}'
string: '{"keys":[{"creationTime":"2021-04-13T05:47:41.2838152Z","keyName":"key1","value":"FakeValue","permissions":"FULL"},{"creationTime":"2021-04-13T05:48:33.0184652Z","keyName":"key2","value":"FakeValue","permissions":"FULL"}]}'
headers:
cache-control:
- no-cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class MgmtStorageTest(AzureMgmtTestCase):

def setUp(self):
super(MgmtStorageTest, self).setUp()
self.re_replacer.register_pattern_pair('"value":".{88}"', '"value":"FakeValue"')
self.mgmt_client = self.create_mgmt_client(
az_storage.StorageManagementClient
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MgmtStorageTest(AzureMgmtAsyncTestCase):

def setUp(self):
super(MgmtStorageTest, self).setUp()
self.re_replacer.register_pattern_pair('"value":".{88}"', '"value":"FakeValue"')
self.mgmt_client = self.create_mgmt_aio_client(
az_storage_aio.StorageManagementClient
)
Expand Down

0 comments on commit db9cde5

Please sign in to comment.