Skip to content

Commit 6140f1b

Browse files
committed
fixing siging key injection issue it-11
1 parent aba6177 commit 6140f1b

2 files changed

Lines changed: 26 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,36 @@ jobs:
7777
7878
# Decode the secret and set the environment variable for the next step
7979
- name: Setup Signing Key
80+
env:
81+
# CORRECT: Map secret to an env var. No quotes needed here in YAML.
82+
TAURI_KEY_SECRET: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
8083
run: |
81-
# 1. Get the Base64 secret
82-
$encoded = "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}"
84+
# 1. Get the Base64 secret from the environment variable
85+
# This avoids injection issues and whitespace problems from GitHub Secrets
86+
$encoded = $env:TAURI_KEY_SECRET
8387
8488
if ($encoded) {
8589
# 2. Decode Base64 to text
86-
$bytes = [System.Convert]::FromBase64String($encoded)
87-
$decodedKey = [System.Text.Encoding]::UTF8.GetString($bytes)
88-
89-
# 3. Write to a temporary file (frontend/tauri.key)
90-
$keyPath = Join-Path (Get-Location) "frontend/tauri.key"
91-
[System.IO.File]::WriteAllText($keyPath, $decodedKey)
92-
93-
# 4. Set the environment variable to the FILE PATH
94-
# This is the equivalent of 'export' but for GitHub Actions Windows runners
95-
echo "TAURI_SIGNING_PRIVATE_KEY=$keyPath" >> $env:GITHUB_ENV
96-
97-
Write-Host "Success: Signing key decoded and saved to $keyPath"
90+
try {
91+
# Trim just in case there's accidental whitespace from the secret copy-paste
92+
$encoded = $encoded.Trim()
93+
$bytes = [System.Convert]::FromBase64String($encoded)
94+
$decodedKey = [System.Text.Encoding]::UTF8.GetString($bytes)
95+
96+
# 3. Write to a temporary file (frontend/tauri.key)
97+
$keyPath = Join-Path (Get-Location) "frontend/tauri.key"
98+
# WriteAllText ensures no BOM if we don't specify encoding, or we can be explicit
99+
[System.IO.File]::WriteAllText($keyPath, $decodedKey)
100+
101+
# 4. Set the environment variable to the FILE PATH
102+
echo "TAURI_SIGNING_PRIVATE_KEY=$keyPath" >> $env:GITHUB_ENV
103+
104+
Write-Host "Success: Signing key decoded and saved to $keyPath"
105+
} catch {
106+
Write-Error "Failed to decode signing key. Check if the secret is a valid Base64 string."
107+
Write-Error $_
108+
exit 1
109+
}
98110
} else {
99111
Write-Warning "TAURI_SIGNING_PRIVATE_KEY secret is missing!"
100112
}

frontend/src-tauri/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::sync::{Arc, Mutex};
22
use std::time::Duration;
33
use tauri::{Emitter, Manager, State, WindowEvent};
44
use tauri_plugin_shell::{process::{CommandChild, CommandEvent}, ShellExt};
5-
use tauri_plugin_updater::UpdaterExt;
65

76
#[derive(Default)]
87
struct BackendInfo {

0 commit comments

Comments
 (0)