Skip to content

Commit abc9a1c

Browse files
Add PoliCheck (Azure#20776)
* Add PoliCheck * Fix up some policheck issues
1 parent d1b2a62 commit abc9a1c

File tree

18 files changed

+138
-81
lines changed

18 files changed

+138
-81
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<PoliCheckExclusions>
2+
<!-- All strings must be UPPER CASE -->
3+
<!-- Each of these exclusions is a folder name - if \[name]\ exists in the file path, it will be skipped -->
4+
<!--<Exclusion Type="FolderPathFull">ABC|XYZ</Exclusion>-->
5+
<!-- Each of these exclusions is a folder name - if any folder or file starts with "\[name]", it will be
6+
skipped -->
7+
<!--<Exclusion Type="FolderPathStart">ABC|XYZ</Exclusion>-->
8+
<!-- Each of these file types will be completely skipped for the entire scan -->
9+
<!--<Exclusion Type="FileType">.ABC|.XYZ</Exclusion>-->
10+
<!-- The specified file names will be skipped during the scan regardless which folder they are in -->
11+
<!--<Exclusion Type="FileName">ABC.TXT|XYZ.CS</Exclusion>-->
12+
</PoliCheckExclusions>

eng/pipelines/aggregate-reports.yml

Lines changed: 100 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,105 @@ pr:
88
include:
99
- eng/pipelines/aggregate-reports.yml
1010

11-
jobs:
12-
- job: 'ValidateDependencies'
13-
variables:
11+
pool:
12+
name: azsdk-pool-mms-win-2019-general
13+
vmImage: MMS2019
14+
15+
variables:
1416
- template: ./templates/variables/globals.yml
1517

16-
pool:
17-
name: azsdk-pool-mms-win-2019-general
18-
vmImage: MMS2019
19-
20-
steps:
21-
- template: /eng/pipelines/templates/steps/analyze_dependency.yml
22-
23-
- task: AzureFileCopy@2
24-
displayName: 'Upload dependency report'
25-
condition: and(succeededOrFailed(), eq(variables['System.TeamProject'], 'internal'))
26-
inputs:
27-
sourcePath: '$(Build.ArtifactStagingDirectory)/reports'
28-
azureSubscription: 'Azure SDK Artifacts'
29-
destination: AzureBlob
30-
storage: azuresdkartifacts
31-
containerName: 'azure-sdk-for-python'
32-
blobPrefix: dependencies
33-
34-
- task: PowerShell@2
35-
displayName: "Verify Repository Resource Refs"
36-
inputs:
37-
pwsh: true
38-
workingDirectory: $(Build.SourcesDirectory)
39-
filePath: eng/common/scripts/Verify-Resource-Ref.ps1
40-
41-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
42-
displayName: 'Run CredScan'
43-
condition: succeededOrFailed()
44-
inputs:
45-
suppressionsFile: 'eng\CredScanSuppression.json'
46-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
47-
displayName: 'Post Analysis'
48-
condition: succeededOrFailed()
49-
inputs:
50-
GdnBreakAllTools: false
51-
GdnBreakGdnToolCredScan: true
52-
GdnBreakGdnToolCredScanSeverity: Error
53-
GdnBreakBaselineFiles: $(Build.SourcesDirectory)\eng\python.gdnbaselines
54-
GdnBreakBaselines: baseline
55-
# Used for generating baseline file.
56-
# GdnBreakOutputBaselineFile: python
57-
# GdnBreakOutputBaseline: baseline
58-
continueOnError: true
59-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
60-
displayName: 'Publish Security Analysis Logs'
61-
continueOnError: true
62-
condition: succeededOrFailed()
63-
- template: ../common/pipelines/templates/steps/verify-links.yml
64-
parameters:
65-
Directory: ""
66-
CheckLinkGuidance: $true
67-
Condition: succeededOrFailed()
18+
stages:
19+
- stage: ValidateDependencies
20+
displayName: Validate Dependencies
21+
22+
jobs:
23+
- job: ValidateDependencies
24+
timeoutInMinutes: 120
25+
steps:
26+
27+
- template: /eng/pipelines/templates/steps/analyze_dependency.yml
28+
29+
- task: AzureFileCopy@2
30+
displayName: 'Upload dependency report'
31+
condition: and(succeededOrFailed(), eq(variables['System.TeamProject'], 'internal'))
32+
inputs:
33+
sourcePath: '$(Build.ArtifactStagingDirectory)/reports'
34+
azureSubscription: 'Azure SDK Artifacts'
35+
destination: AzureBlob
36+
storage: azuresdkartifacts
37+
containerName: 'azure-sdk-for-python'
38+
blobPrefix: dependencies
39+
40+
- task: PowerShell@2
41+
displayName: "Verify Repository Resource Refs"
42+
inputs:
43+
pwsh: true
44+
workingDirectory: $(Build.SourcesDirectory)
45+
filePath: eng/common/scripts/Verify-Resource-Ref.ps1
46+
47+
- template: ../common/pipelines/templates/steps/verify-links.yml
48+
parameters:
49+
Directory: ""
50+
CheckLinkGuidance: $true
51+
Condition: succeededOrFailed()
52+
53+
- stage: ComplianceTools
54+
displayName: Compliance Tools
55+
dependsOn: []
56+
57+
jobs:
58+
- job: ComplianceTools
59+
timeoutInMinutes: 120
60+
steps:
61+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
62+
displayName: 'Run CredScan'
63+
condition: succeededOrFailed()
64+
inputs:
65+
suppressionsFile: 'eng\CredScanSuppression.json'
66+
67+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
68+
displayName: 'Post Analysis'
69+
condition: succeededOrFailed()
70+
inputs:
71+
GdnBreakAllTools: false
72+
GdnBreakGdnToolCredScan: true
73+
GdnBreakGdnToolCredScanSeverity: Error
74+
GdnBreakBaselineFiles: $(Build.SourcesDirectory)\eng\python.gdnbaselines
75+
GdnBreakBaselines: baseline
76+
# Used for generating baseline file.
77+
# GdnBreakOutputBaselineFile: python
78+
# GdnBreakOutputBaseline: baseline
79+
continueOnError: true
80+
81+
- pwsh: |
82+
azcopy copy "https://azuresdkartifacts.blob.core.windows.net/policheck/PythonPoliCheckExclusion.mdb?$(azuresdk-policheck-blob-SAS)" `
83+
"$(Build.BinariesDirectory)"
84+
displayName: 'Download PoliCheck Exclusion Database'
85+
condition: succeededOrFailed()
86+
87+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2
88+
displayName: 'Run PoliCheck'
89+
inputs:
90+
targetType: F
91+
targetArgument: '$(Build.SourcesDirectory)'
92+
result: PoliCheck.sarif
93+
optionsFC: 0
94+
optionsXS: 1
95+
optionsPE: 1|2|3|4
96+
optionsRulesDBPath: "$(Build.BinariesDirectory)/PythonPoliCheckExclusion.mdb"
97+
optionsUEPATH: "$(Build.SourcesDirectory)/eng/guardian-tools/policheck/PolicheckExclusions.xml"
98+
condition: succeededOrFailed()
99+
100+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
101+
displayName: 'Post Analysis (PoliCheck)'
102+
inputs:
103+
GdnBreakAllTools: false
104+
GdnBreakGdnToolPoliCheck: true
105+
GdnBreakGdnToolPoliCheckSeverity: Warning
106+
condition: succeededOrFailed()
107+
continueOnError: true
108+
109+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
110+
displayName: 'Publish Security Analysis Logs'
111+
continueOnError: true
112+
condition: succeededOrFailed()

sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ def __init__(self, client, config, serializer, deserializer):
3535

3636
def screen_text(
3737
self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config):
38-
"""Detect profanity and match against custom and shared blacklists.
38+
"""Detect profanity and match against custom and shared blocklists.
3939
4040
Detects profanity in more than 100 languages and match against custom
41-
and shared blacklists.
41+
and shared blocklists.
4242
4343
:param text_content_type: The content type. Possible values include:
4444
'text/plain', 'text/html', 'text/xml', 'text/markdown'

sdk/core/azure-core/azure/core/pipeline/policies/_retry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ def _is_read_error(self, err):
152152

153153
def _is_method_retryable(self, settings, request, response=None):
154154
"""Checks if a given HTTP method should be retried upon, depending if
155-
it is included on the method whitelist.
155+
it is included on the method allowlist.
156156
157157
:param dict settings: The retry settings.
158158
:param request: The PipelineRequest object.
159159
:type request: ~azure.core.pipeline.PipelineRequest
160160
:param response: The PipelineResponse object.
161161
:type response: ~azure.core.pipeline.PipelineResponse
162-
:return: True if method should be retried upon. False if not in method whitelist.
162+
:return: True if method should be retried upon. False if not in method allowlist.
163163
:rtype: bool
164164
"""
165165
if response and request.method.upper() in ['POST', 'PATCH'] and \
@@ -173,7 +173,7 @@ def _is_method_retryable(self, settings, request, response=None):
173173
def is_retry(self, settings, response):
174174
"""Checks if method/status code is retryable.
175175
176-
Based on whitelists and control variables such as the number of
176+
Based on allowlists and control variables such as the number of
177177
total retries to allow, whether to respect the Retry-After header,
178178
whether this header is present, and whether the returned status
179179
code is on the list of status codes to be retried upon on the
@@ -244,7 +244,7 @@ def increment(self, settings, response=None, error=None):
244244

245245
else:
246246
# Incrementing because of a server error like a 500 in
247-
# status_forcelist and a the given method is in the whitelist
247+
# status_forcelist and a the given method is in the allowlist
248248
if response:
249249
settings['status'] -= 1
250250
if hasattr(response, 'http_request') and hasattr(response, 'http_response'):

sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
7575

7676

7777
def is_retry(response, mode):
78-
"""Is this method/status code retryable? (Based on whitelists and control
78+
"""Is this method/status code retryable? (Based on allowlists and control
7979
variables such as the number of total retries to allow, whether to
8080
respect the Retry-After header, whether this header is present, and
8181
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
456456

457457
else:
458458
# Incrementing because of a server error like a 500 in
459-
# status_forcelist and a the given method is in the whitelist
459+
# status_forcelist and a the given method is in the allowlist
460460
if response:
461461
settings['status'] -= 1
462462
settings['history'].append(RequestHistory(request, http_response=response))

sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/storage/blob/_shared/policies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):
7575

7676

7777
def is_retry(response, mode):
78-
"""Is this method/status code retryable? (Based on whitelists and control
78+
"""Is this method/status code retryable? (Based on allowlists and control
7979
variables such as the number of total retries to allow, whether to
8080
respect the Retry-After header, whether this header is present, and
8181
whether the returned status code is on the list of status codes to
@@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):
456456

457457
else:
458458
# Incrementing because of a server error like a 500 in
459-
# status_forcelist and a the given method is in the whitelist
459+
# status_forcelist and a the given method is in the allowlist
460460
if response:
461461
settings['status'] -= 1
462462
settings['history'].append(RequestHistory(request, http_response=response))

sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/_policies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def __init__(self, **kwargs):
133133
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)
134134

135135
def is_retry(self, settings, response):
136-
"""Is this method/status code retryable? (Based on whitelists and control
136+
"""Is this method/status code retryable? (Based on allowlists and control
137137
variables such as the number of total retries to allow, whether to
138138
respect the Retry-After header, whether this header is present, and
139139
whether the returned status code is on the list of status codes to

sdk/eventhub/azure-eventhub-checkpointstoretable/azure/eventhub/extensions/checkpointstoretable/_vendor/data/tables/aio/_policies_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, **kwargs):
5656
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)
5757

5858
def is_retry(self, settings, response):
59-
"""Is this method/status code retryable? (Based on whitelists and control
59+
"""Is this method/status code retryable? (Based on allowlists and control
6060
variables such as the number of total retries to allow, whether to
6161
respect the Retry-After header, whether this header is present, and
6262
whether the returned status code is on the list of status codes to

sdk/eventhub/test-resources.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"type": "string",
6060
"defaultValue": "10",
6161
"metadata": {
62-
"description": "The maximum duration, in minutes, that a single test is permitted to run before it is considered at-risk for being hung."
62+
"description": "The maximum duration, in minutes, that a single test is permitted to run before it is considered at-risk of not responding"
6363
}
6464
}
6565
},

sdk/search/azure-search-documents/azure/search/documents/_search_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def get_document(self, key, selected_fields=None, **kwargs):
132132
133133
:param key: The primary key value for the document to retrieve
134134
:type key: str
135-
:param selected_fields: a whitelist of fields to include in the results
135+
:param selected_fields: a allowlist of fields to include in the results
136136
:type selected_fields: List[str]
137137
:rtype: dict
138138

0 commit comments

Comments
 (0)