Skip to content

Commit cb5beb7

Browse files
committed
Make key decoding robust
1 parent 47dbf35 commit cb5beb7

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ jobs:
102102
} catch {
103103
# If Base64 decoding fails, assume it's the raw text content of the key
104104
Write-Output "Secret is not Base64, assuming raw key content."
105-
$env:TAURI_SIGNING_PRIVATE_KEY | Out-File -FilePath "tauri.key" -Encoding utf8 -NoNewline
105+
# Explicitly use UTF-8 NO BOM and Trim whitespace
106+
$keyContent = $env:TAURI_SIGNING_PRIVATE_KEY.Trim()
107+
$encoding = New-Object System.Text.UTF8Encoding $false
108+
[System.IO.File]::WriteAllText("$PWD/tauri.key", $keyContent, $encoding)
106109
Write-Output "Saved raw key content to tauri.key"
107110
}
108111
@@ -129,11 +132,10 @@ jobs:
129132
}
130133
}
131134
132-
# Strategy: Pass the FILE PATH to Tauri
133-
# This bypasses any environment variable string corruption issues
134-
$keyPath = (Resolve-Path "tauri.key").Path
135-
$env:TAURI_SIGNING_PRIVATE_KEY = $keyPath
136-
Write-Output "Setting TAURI_SIGNING_PRIVATE_KEY to path: $keyPath"
135+
# Strategy: Pass the content to Tauri
136+
# We reload it from the file to ensure we use the clean version we just wrote
137+
$env:TAURI_SIGNING_PRIVATE_KEY = [System.IO.File]::ReadAllText("$PWD/tauri.key")
138+
Write-Output "Setting TAURI_SIGNING_PRIVATE_KEY to clean key content (length: $($env:TAURI_SIGNING_PRIVATE_KEY.Length))"
137139
138140
npm run tauri build
139141

test_bom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
untrusted comment: test

test_nobom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
untrusted comment: test

0 commit comments

Comments
 (0)