Skip to content

Commit 7302bf1

Browse files
committed
Merged PR 6388: FIX: Use .gdnsuppress and .gdnbaseline to suppress false CredScan alerts
#### AI description (iteration 1) #### PR Classification This pull request is a bug fix that resolves configuration issues for APIScan and BinSkim. #### PR Summary The changes ensure correct file paths for APIScan on Windows and add necessary parameters for BinSkim analysis in the build pipeline. - `OneBranchPipelines/variables/symbol-variables.yml`: Updated the API scan DLL and PDB paths to use backslashes for Windows compatibility. - `OneBranchPipelines/build-release-package-pipeline.yml`: Added parameters to configure BinSkim with the analyze target, recursion flag, and log file path. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
1 parent 3fb8ab2 commit 7302bf1

File tree

6 files changed

+38
-12
lines changed

6 files changed

+38
-12
lines changed

OneBranchPipelines/build-release-package-pipeline.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,23 @@ extends:
138138
featureFlags:
139139
WindowsHostVersion:
140140
Version: '2022'
141+
binskimScanAllExtensions: true # Enable scanning of all supported file types including .pyd
141142

142143
# Global SDL Configuration
143144
# See: https://aka.ms/obpipelines/sdl
144145
globalSdl:
146+
# Global Guardian baseline and suppression files
147+
baseline:
148+
baselineFile: $(Build.SourcesDirectory)\.gdn\.gdnbaselines
149+
suppressionSet: default
150+
suppression:
151+
suppressionFile: $(Build.SourcesDirectory)\.gdn\.gdnsuppress
152+
suppressionSet: default
153+
145154
# ApiScan - Scans APIs for security vulnerabilities
155+
# Disabled: Requires specific binary paths and symbols not applicable to Python wheels
146156
apiscan:
147-
enabled: ${{ parameters.runSdlTasks }}
148-
softwareFolder: '$(apiScanDllPath)'
149-
softwareName: 'mssql-python'
150-
softwareVersionNum: '$(packageVersion)'
151-
symbolsFolder: '$(apiScanPdbPath)'
157+
enabled: false
152158

153159
# Armory - Security scanning for binaries
154160
armory:
@@ -163,6 +169,10 @@ extends:
163169
binskim:
164170
enabled: ${{ parameters.runSdlTasks }}
165171
break: true
172+
# Scan all binary types: .pyd (Python), .dll/.exe (Windows), .so (Linux), .dylib (macOS)
173+
analyzeTarget: '$(Build.SourcesDirectory)/**/*.{pyd,dll,exe,so,dylib}'
174+
analyzeRecurse: true
175+
logFile: '$(Build.ArtifactStagingDirectory)/BinSkimResults.sarif'
166176

167177
# CodeInspector - Source code security analysis
168178
codeinspector:
@@ -177,9 +187,9 @@ extends:
177187
querySuite: security-extended
178188

179189
# CredScan - Scans for credentials in code
190+
# Note: Global baseline/suppression files configured at globalSdl level
180191
credscan:
181192
enabled: ${{ parameters.runSdlTasks }}
182-
suppressionsFile: '$(REPO_ROOT)/.config/CredScanSuppressions.json'
183193

184194
# ESLint - JavaScript/TypeScript specific, not applicable for Python
185195
eslint:

OneBranchPipelines/dummy-release-pipeline.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,21 @@ extends:
7272

7373
# Global SDL Configuration
7474
globalSdl:
75+
# Global Guardian baseline and suppression files
76+
baseline:
77+
baselineFile: $(Build.SourcesDirectory)\.gdn\.gdnbaselines
78+
suppressionSet: default
79+
suppression:
80+
suppressionFile: $(Build.SourcesDirectory)\.gdn\.gdnsuppress
81+
suppressionSet: default
82+
7583
# Minimal SDL for release pipeline - artifacts already scanned during build
7684
binskim:
7785
enabled: true
7886
break: true
7987

8088
credscan:
8189
enabled: true
82-
suppressionsFile: '$(REPO_ROOT)/.config/CredScanSuppressions.json'
8390

8491
policheck:
8592
enabled: true

OneBranchPipelines/official-release-pipeline.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,21 @@ extends:
7070

7171
# Global SDL Configuration
7272
globalSdl:
73+
# Global Guardian baseline and suppression files
74+
baseline:
75+
baselineFile: $(Build.SourcesDirectory)\.gdn\.gdnbaselines
76+
suppressionSet: default
77+
suppression:
78+
suppressionFile: $(Build.SourcesDirectory)\.gdn\.gdnsuppress
79+
suppressionSet: default
80+
7381
# Minimal SDL for release pipeline - artifacts already scanned during build
7482
binskim:
7583
enabled: true
7684
break: true
7785

7886
credscan:
7987
enabled: true
80-
suppressionsFile: '$(REPO_ROOT)/.config/CredScanSuppressions.json'
8188

8289
policheck:
8390
enabled: true

OneBranchPipelines/stages/build-macos-single-stage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ stages:
111111
python -m pytest -v
112112
displayName: 'Run pytests'
113113
env:
114-
DB_CONNECTION_STRING: 'Driver=ODBC Driver 18 for SQL Server;Server=tcp:127.0.0.1,1433;Database=master;Uid=SA;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes'
114+
DB_CONNECTION_STRING: 'Server=tcp:127.0.0.1,1433;Database=master;Uid=SA;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes'
115115
116116
- script: |
117117
python -m pip install --upgrade pip wheel setuptools

OneBranchPipelines/variables/symbol-variables.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ variables:
44
# Symbol paths for ApiScan
55
# Must use Build.SourcesDirectory (not ob_outputDirectory) so files persist for globalSdl
66
# Files are copied here during build stages, before ApiScan runs
7+
# CRITICAL: Must use backslashes to match Build.SourcesDirectory's Windows path format
8+
# When Build.SourcesDirectory resolves to D:\a\_work\1\s, we append \apiScan\dlls
79
- name: apiScanDllPath
8-
value: '$(Build.SourcesDirectory)/apiScan/dlls'
10+
value: '$(Build.SourcesDirectory)\apiScan\dlls'
911

1012
- name: apiScanPdbPath
11-
value: '$(Build.SourcesDirectory)/apiScan/pdbs'
13+
value: '$(Build.SourcesDirectory)\apiScan\pdbs'
1214

1315
# Symbol server variables come from 'Symbols Publishing' variable group:
1416
# - SymbolServer: Symbol publishing server hostname

tests/test_012_connection_string_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_parse_filter_build_complex_realistic(self):
160160
assert 'Server=tcp:server.database.windows.net,1433' in result
161161
assert 'Database=mydb' in result
162162
assert 'UID=user@server' in result # UID not Uid (canonical form)
163-
assert 'PWD={P@ss;w}}rd}' in result
163+
assert 'PWD={TestP@ss;w}}rd}' in result
164164
assert 'Encrypt=yes' in result
165165
assert 'TrustServerCertificate=no' in result
166166
# Connection Timeout not in result (filtered out)

0 commit comments

Comments
 (0)