docs/attack-surface-analyzer.md
Attack Surface Analyzer (ASA) is integrated into the React Native Windows CI pipeline to meet Secure Development Lifecycle (SDL) compliance requirements. ASA validates that installers or other high-privilege programs do not weaken the security configuration of the operating system.
When installing software on an operating system, elevated privileges are often required. Since installers typically run with 'Administrator' or 'root' privileges, they can easily change the security configuration of the operating system, potentially leaving it in a weakened state after installation is complete.
Attack Surface Analyzer is a Microsoft tool that helps determine the changes made to an operating system during software installation by:
ASA is integrated into the Build stage of the PR pipeline and runs automatically on secure pull requests (SecurePullRequest builds). The job performs the following steps:
dotnet tool install --global Microsoft.CST.AttackSurfaceAnalyzer.CLI
Captures the initial system state before any build operations:
asa collect -r before --verbose
Builds the React Native Windows solution (simulating package installation):
Captures the system state after build operations:
asa collect -r after --verbose
Exports and analyzes the differences:
asa export-collect -f before after -o asa-comparison.json
asa export-collect -f before after -o asa-comparison.html
Results are published as build artifacts for review:
asa-comparison.json (machine-readable)asa-comparison.html (human-readable)ASA monitors for security-relevant changes including:
ASA_Results artifactasa-comparison.html in a browser for a visual overviewasa-comparison.json for detailed, programmatic analysisExpected Changes:
Unexpected Changes (Require Review):
ASA integration satisfies the SDL requirement:
Microsoft.Security.AccessControl.10011: Use Attack Surface Analyzer (ASA) to validate that installers or other high-privilege programs do not weaken the security configuration of the operating system.
All issues identified by ASA must be fixed or justified before merging. If ASA detects security regressions:
ASA runs as part of the Build stage in .ado/stages.yml:
- template: jobs/attack-surface-analyzer.yml
parameters:
buildEnvironment: ${{ parameters.buildEnvironment }}
AgentPool: ${{ parameters.AgentPool }}
complianceWarnOnly: true
true, ASA failures won't block PR (default: true)ASA is configured to run only for SecurePullRequest builds to ensure thorough security scanning in controlled environments. It uses complianceWarnOnly: true to allow gradual adoption. This can be changed to false to enforce blocking on security regressions.
Developers can run ASA locally to test before submitting a PR:
# Install ASA CLI
dotnet tool install --global Microsoft.CST.AttackSurfaceAnalyzer.CLI
# Verify installation
asa --version
# 1. Take before snapshot
asa collect -r before
# 2. Perform your build/installation
cd vnext
msbuild Microsoft.ReactNative.sln /p:Configuration=Release /p:Platform=x64
# 3. Take after snapshot
asa collect -r after
# 4. Export comparison
asa export-collect -f before after -o .\asa-comparison.html
# 5. Review results
start .\asa-comparison.html
ASA also provides a browser-based GUI:
asa gui
Then navigate to http://localhost:5000 in your browser.
Issue: dotnet tool install fails
Solution: Ensure .NET SDK 8.0 or later is installed:
dotnet --version
Issue: ASA reports many changes Solution:
Issue: ASA job exceeds 60-minute timeout Solution:
.ado/jobs/attack-surface-analyzer.ymlFor issues or questions about ASA integration: