futrou 2.0.36 → 2.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/install.ps1 CHANGED
@@ -2,6 +2,7 @@
2
2
  param(
3
3
  [String]$Version = "latest",
4
4
  [Switch]$NoPathUpdate = $false,
5
+ [Switch]$IgnoreSignature = $false,
5
6
  [Switch]$DownloadWithoutCurl = $false
6
7
  )
7
8
 
@@ -39,6 +40,7 @@ $Target = "windows-$GoArch"
39
40
  if ($Version -match "^\d+\.\d+\.\d+$") { $Version = "v$Version" }
40
41
 
41
42
  $BaseURL = "https://github.com/futrou/futrou-cli/releases"
43
+ $GpgKeyURL = "https://futrou.com/.well-known/pgp-key.txt"
42
44
  $FileName = "futrou-$Target.exe"
43
45
  $URL = if ($Version -eq "latest") {
44
46
  "$BaseURL/latest/download/$FileName"
@@ -123,6 +125,42 @@ if (-not (Test-Path $TmpExe)) {
123
125
  Write-Fail "Download produced no file. Did antivirus delete it?"
124
126
  }
125
127
 
128
+ # ---------------------------------------------------------------------------
129
+ # Verify the PGP signature (<file>.asc next to the binary). Needs gpg; without
130
+ # it only a warning is shown. A private keyring is used, never the user's.
131
+ # ---------------------------------------------------------------------------
132
+ function Fail-Signature([String]$Reason) {
133
+ Remove-Item -Force $TmpExe -ErrorAction SilentlyContinue
134
+ $Args2 = if ($Version -eq "latest") { "-IgnoreSignature" } else { "-Version $Version -IgnoreSignature" }
135
+ Write-Warn "warning: could not verify the signature: $Reason"
136
+ Write-Info "Nothing was installed. If you trust the download anyway, run the installer again without the check:"
137
+ Write-Output " & ([scriptblock]::Create((irm https://futrou.com/install.ps1))) $Args2"
138
+ exit 1
139
+ }
140
+
141
+ if ($IgnoreSignature) {
142
+ Write-Warn "Skipping signature verification (-IgnoreSignature)"
143
+ } elseif (-not (Get-Command gpg -ErrorAction SilentlyContinue)) {
144
+ Write-Warn "gpg is not installed, skipping signature verification."
145
+ Write-Info "Install gnupg and run the installer again to verify releases against $GpgKeyURL"
146
+ } else {
147
+ $GpgHome = Join-Path ([IO.Path]::GetTempPath()) ("futrou-gpg-" + [Guid]::NewGuid())
148
+ $null = New-Item -ItemType Directory -Force -Path $GpgHome
149
+ try {
150
+ try { Invoke-WebRequest -UseBasicParsing -Uri $GpgKeyURL -OutFile "$GpgHome\pgp-key.txt" } catch { Fail-Signature "failed to connect to $GpgKeyURL to download the public key" }
151
+ & gpg --homedir $GpgHome --batch --quiet --import "$GpgHome\pgp-key.txt" 2>$null
152
+ if ($LASTEXITCODE -ne 0) { Fail-Signature "the downloaded public key is not valid" }
153
+ try { Invoke-WebRequest -UseBasicParsing -Uri "$URL.asc" -OutFile "$GpgHome\futrou.asc" } catch { Fail-Signature "failed to download the signature from $URL.asc" }
154
+ $Status = & gpg --homedir $GpgHome --batch --no-tty --status-fd 1 --verify "$GpgHome\futrou.asc" $TmpExe 2>$null
155
+ if ($LASTEXITCODE -ne 0) { Fail-Signature "the signature does not match the downloaded file" }
156
+ if (-not ($Status -match '^\[GNUPG:\] VALIDSIG ')) { Fail-Signature "no valid signature on the downloaded file" }
157
+ if ($Status -match '^\[GNUPG:\] (EXPKEYSIG|EXPSIG|REVKEYSIG) ') { Fail-Signature "the signing key is expired or revoked" }
158
+ Write-Info "Signature verified"
159
+ } finally {
160
+ Remove-Item -Recurse -Force $GpgHome -ErrorAction SilentlyContinue
161
+ }
162
+ }
163
+
126
164
  try { Remove-Item -Force $Exe -ErrorAction SilentlyContinue } catch { }
127
165
  Move-Item -Force $TmpExe $Exe
128
166
 
package/install.sh CHANGED
@@ -70,12 +70,16 @@ exe_ext=''
70
70
  # ---------------------------------------------------------------------------
71
71
  GITHUB=${GITHUB:-"https://github.com"}
72
72
  REPO="$GITHUB/futrou/futrou-cli"
73
+ GPG_KEY_URL="https://futrou.com/.well-known/pgp-key.txt"
73
74
 
74
- if [[ $# -eq 0 ]]; then
75
- version="latest"
76
- else
77
- version="$1"
78
- fi
75
+ version="latest"
76
+ ignore_signature=0
77
+ for arg in "$@"; do
78
+ case $arg in
79
+ --ignore-signature) ignore_signature=1 ;;
80
+ *) version="$arg" ;;
81
+ esac
82
+ done
79
83
 
80
84
  # Normalise: accept "1.2.3" or "v1.2.3" → "v1.2.3"
81
85
  if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -163,6 +167,42 @@ if [[ -n "$spinner_pid" ]]; then
163
167
  printf "\r\033[K"
164
168
  fi
165
169
 
170
+ # ---------------------------------------------------------------------------
171
+ # Verify the PGP signature (<file>.asc next to the binary) in a keyring of its
172
+ # own, never the user's. Without gpg it only warns.
173
+ # ---------------------------------------------------------------------------
174
+ signature_failed() {
175
+ rm -f "$tmp_exe"
176
+ [[ -n "${gpg_home:-}" ]] && rm -rf "$gpg_home"
177
+ local rerun="curl -fsSL https://futrou.com/install.sh | bash"
178
+ [[ $version == "latest" ]] && rerun="$rerun -s -- --ignore-signature" || rerun="$rerun -s -- $version --ignore-signature"
179
+ warn "warning: could not verify the signature: $1"
180
+ info "Nothing was installed. If you trust the download anyway, run the installer again without the check:"
181
+ info_bold " $rerun"
182
+ exit 1
183
+ }
184
+
185
+ if [[ $ignore_signature == 1 ]]; then
186
+ warn "Skipping signature verification (--ignore-signature)"
187
+ elif ! command -v gpg >/dev/null 2>&1; then
188
+ warn "gpg is not installed, skipping signature verification."
189
+ info "Install gnupg and run the installer again to verify releases against $GPG_KEY_URL"
190
+ else
191
+ gpg_home=$(mktemp -d)
192
+ chmod 700 "$gpg_home"
193
+ export GNUPGHOME="$gpg_home"
194
+ do_download "$GPG_KEY_URL" "$gpg_home/pgp-key.txt" || signature_failed "failed to connect to $GPG_KEY_URL to download the public key"
195
+ gpg --batch --quiet --import "$gpg_home/pgp-key.txt" 2>/dev/null || signature_failed "the downloaded public key is not valid"
196
+ do_download "$download_url.asc" "$gpg_home/futrou.asc" || signature_failed "failed to download the signature from $download_url.asc"
197
+ status=$(gpg --batch --no-tty --status-fd 1 --verify "$gpg_home/futrou.asc" "$tmp_exe" 2>/dev/null) || signature_failed "the signature does not match the downloaded file"
198
+ grep -q '^\[GNUPG:\] VALIDSIG ' <<<"$status" || signature_failed "no valid signature on the downloaded file"
199
+ grep -qE '^\[GNUPG:\] (EXPKEYSIG|EXPSIG|REVKEYSIG) ' <<<"$status" && signature_failed "the signing key is expired or revoked"
200
+ signature_id=$(awk '/^\[GNUPG:\] VALIDSIG /{print $3}' <<<"$status")
201
+ unset GNUPGHOME
202
+ rm -rf "$gpg_home"
203
+ info "Signature verified: $signature_id"
204
+ fi
205
+
166
206
  # Read new version from downloaded binary
167
207
  new_version=$("$tmp_exe" version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
168
208
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "futrou",
3
3
  "productName": "Futrou CLI",
4
- "version": "2.0.36",
4
+ "version": "2.0.38",
5
5
  "description": "Futrou CLI - Deploy and manage Futrou Cloud from your terminal.",
6
6
  "main": "./config.cjs",
7
7
  "types": "./index.d.ts",