mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 17:24:27 +08:00
fix: normalize PEM line endings in signing key validation
This commit is contained in:
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -372,8 +372,12 @@ jobs:
|
|||||||
Set-Content -Path $publicKeyPath -Value $derivedPublicKey -NoNewline
|
Set-Content -Path $publicKeyPath -Value $derivedPublicKey -NoNewline
|
||||||
|
|
||||||
$repoPublicKeyPath = "LanMountainDesktop.Launcher/Assets/public-key.pem"
|
$repoPublicKeyPath = "LanMountainDesktop.Launcher/Assets/public-key.pem"
|
||||||
$repoPublicKey = (Get-Content -Path $repoPublicKeyPath -Raw).Trim()
|
$repoPublicKey = (Get-Content -Path $repoPublicKeyPath -Raw)
|
||||||
if ($repoPublicKey -ne $derivedPublicKey.Trim()) {
|
$normalizePem = {
|
||||||
|
param([string]$pem)
|
||||||
|
return (($pem -replace "`r`n", "`n" -replace "`r", "`n").Trim())
|
||||||
|
}
|
||||||
|
if (& $normalizePem $repoPublicKey -ne (& $normalizePem $derivedPublicKey)) {
|
||||||
Write-Error "Configured signing private key does not match $repoPublicKeyPath. Keep keypair consistent before publishing."
|
Write-Error "Configured signing private key does not match $repoPublicKeyPath. Keep keypair consistent before publishing."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -658,8 +662,12 @@ jobs:
|
|||||||
Set-Content -Path $publicKeyPath -Value $derivedPublicKey -NoNewline
|
Set-Content -Path $publicKeyPath -Value $derivedPublicKey -NoNewline
|
||||||
|
|
||||||
$repoPublicKeyPath = "LanMountainDesktop.Launcher/Assets/public-key.pem"
|
$repoPublicKeyPath = "LanMountainDesktop.Launcher/Assets/public-key.pem"
|
||||||
$repoPublicKey = (Get-Content -Path $repoPublicKeyPath -Raw).Trim()
|
$repoPublicKey = (Get-Content -Path $repoPublicKeyPath -Raw)
|
||||||
if ($repoPublicKey -ne $derivedPublicKey.Trim()) {
|
$normalizePem = {
|
||||||
|
param([string]$pem)
|
||||||
|
return (($pem -replace "`r`n", "`n" -replace "`r", "`n").Trim())
|
||||||
|
}
|
||||||
|
if (& $normalizePem $repoPublicKey -ne (& $normalizePem $derivedPublicKey)) {
|
||||||
Write-Error "Configured signing private key does not match $repoPublicKeyPath. Keep keypair consistent before publishing."
|
Write-Error "Configured signing private key does not match $repoPublicKeyPath. Keep keypair consistent before publishing."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user