Skip to content

Commit 46d82e7

Browse files
Nitin-100Nitin Chaudhary
andauthored
verify code signatures on installers/updates downloaded from Microsoft (#15241)
* Change files * Add signature verification for SDL compliance (Work Item 58386093) --------- Co-authored-by: Nitin Chaudhary <[email protected]>
1 parent 79cb3bf commit 46d82e7

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Add signature verification for SDL compliance (Work Item 58386093)",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}

vnext/Scripts/rnw-dependencies.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,23 @@ $requirements = @(
488488
Install = {
489489
$ProgressPreference = 'Ignore';
490490
$url = "https://github.com/microsoft/WinAppDriver/releases/download/v1.2.1/WindowsApplicationDriver_1.2.1.msi";
491+
$downloadPath = "$env:TEMP\WindowsApplicationDriver.msi"
491492
Write-Verbose "Downloading WinAppDriver from $url";
492-
Invoke-WebRequest -UseBasicParsing $url -OutFile $env:TEMP\WindowsApplicationDriver.msi
493-
& $env:TEMP\WindowsApplicationDriver.msi /q
493+
Invoke-WebRequest -UseBasicParsing $url -OutFile $downloadPath
494+
495+
# SDL Compliance: Verify signature (Work Item 58386093)
496+
$signature = Get-AuthenticodeSignature $downloadPath
497+
if ($signature.Status -ne "Valid") {
498+
Remove-Item $downloadPath -ErrorAction SilentlyContinue
499+
throw "WinAppDriver signature verification failed"
500+
}
501+
if ($signature.SignerCertificate.Subject -notlike "*Microsoft*") {
502+
Remove-Item $downloadPath -ErrorAction SilentlyContinue
503+
throw "WinAppDriver not signed by Microsoft"
504+
}
505+
506+
& $downloadPath /q
507+
Remove-Item $downloadPath -ErrorAction SilentlyContinue
494508
};
495509
HasVerboseOutput = $true;
496510
Optional = $true;

0 commit comments

Comments
 (0)