-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathcompliance.yml
More file actions
140 lines (119 loc) · 5.16 KB
/
Copy pathcompliance.yml
File metadata and controls
140 lines (119 loc) · 5.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: 0.0.$(Date:yyMM.d)$(Rev:rrr)
parameters:
- name: AgentPool
type: object
default:
Medium:
name: rnw-pool-4-microsoft
demands: ImageOverride -equals rnw-img-vs2026-node22
Large:
name: rnw-pool-8-microsoft
demands: ImageOverride -equals rnw-img-vs2026-node22
- name: forceCodeQL
displayName: Force CodeQL to rebuild databases
type: boolean
default: false
- name: complianceWarnOnly
displayName: Convert compliance errors to warnings
type: boolean
default: true # Let's get all results in this pipeline
variables:
- template: variables/windows.yml
- group: RNW Secrets
- name: Codeql.Enabled
value: true
- ${{ if eq(parameters.forceCodeQL, true) }}:
- name: Codeql.Cadence
value: 0
- ${{ if eq(parameters.forceCodeQL, false) }}:
- name: Codeql.Cadence
value: 120 # In hours, default to only run every 5 days
trigger: none
pr: none
jobs:
- job: RnwUniversalCompliance
displayName: RNW Universal Compliance
pool: ${{ parameters.AgentPool.Large }}
timeoutInMinutes: 360 # Compliance tasks recommend to 3x usual build timeout
steps:
- template: templates/checkout-shallow.yml
- template: templates/prepare-js-env.yml
- template: templates/set-version-vars.yml
parameters:
buildEnvironment: Continuous
- template: templates/publish-version-vars.yml
- template: templates/prepare-build-env.yml
parameters:
platform: x64
configuration: Release
buildEnvironment: Continuous
- template: templates/apply-published-version-vars.yml
# Pre-build compliance tasks
- template: templates/run-compliance-prebuild.yml
parameters:
complianceWarnOnly: ${{ parameters.complianceWarnOnly }}
- task: NuGetAuthenticate@1
# AgentES Task (https://aka.ms/UES)
# Installs and runs the "Agent ES" tool, which scans the source code for banned file types.
- powershell: |
& nuget.exe install AgentES -FallbackSource https://microsoft.pkgs.visualstudio.com/_packaging/Undocked.Shell.Services/nuget/v3/index.json
$AgentESPath = (Get-ChildItem -Path AgentES* -Filter AgentES.exe -Recurse | %{$_.FullName})
& $AgentESPath $env:BUILD_SOURCESDIRECTORY -e:$env:BUILD_SOURCESDIRECTORY\.ado\config\AgentES.Exemptions.json -b
displayName: "⚖️ AgentES - Scan of Repository for UES Policy Violations"
workingDirectory: $(Agent.BuildDirectory)
continueOnError: ${{ parameters.complianceWarnOnly }}
# Initialize CodeQL 3000 Task (https://aka.ms/codeql3000)
# Performs static code analysis.
- task: CodeQL3000Init@0
displayName: "🛡️ Initialize CodeQL"
continueOnError: ${{ parameters.complianceWarnOnly }}
# Build RNW
- template: templates/msbuild-sln.yml
parameters:
solutionDir: vnext
solutionName: Microsoft.ReactNative.NewArch.sln
buildPlatform: x64
buildConfiguration: Release
# Post-build compliance tasks
- template: templates/run-compliance-postbuild.yml
parameters:
complianceWarnOnly: ${{ parameters.complianceWarnOnly }}
# Attack Surface Analyzer (ASA) for SDL compliance
# This is integrated into the compliance pipeline but runs independently
# Note: ASA requires before/after snapshots, so we run a separate analysis
- task: PowerShell@2
displayName: '🛡️ Attack Surface Analyzer - Note'
inputs:
targetType: inline
script: |
Write-Host "=========================================="
Write-Host "Attack Surface Analyzer (ASA) Information"
Write-Host "=========================================="
Write-Host ""
Write-Host "ASA runs as a separate job in the PR pipeline (see stages.yml)."
Write-Host "It performs before/after snapshot analysis of the build process."
Write-Host ""
Write-Host "For manual ASA runs or to view results:"
Write-Host "1. Check PR pipeline artifacts for ASA_Results"
Write-Host "2. Review docs/attack-surface-analyzer.md for guidance"
Write-Host "3. Run ASA locally: dotnet tool install -g Microsoft.CST.AttackSurfaceAnalyzer.CLI"
Write-Host ""
Write-Host "✅ ASA integration is active in PR builds"
# Finalize CodeQL 3000 Task (https://aka.ms/codeql3000)
# Performs static code analysis.
- task: CodeQL3000Finalize@0
displayName: "🛡️ Finalize CodeQL"
inputs:
# Enable TSA for automatic bug filing from CodeQL
TSAEnabled: true
TSAOptions: |
{
"areaPath": "OS\\Windows Client and Services\\WinPD\\SPICE\\ReactNative",
"iterationPath": "OS\\Future",
"notificationAliases": ["$(TSANotificationAliases)"],
"codebaseAdmins": ["$(TSACodebaseAdmins)"],
"bugTags": ["SDL", "Security"],
"instanceUrl": "https://dev.azure.com/microsoft",
"projectName": "OS"
}
continueOnError: ${{ parameters.complianceWarnOnly }}