Skip to content

fix: handle unparseable cosign version in install.sh#580

Merged
dimitris-m merged 2 commits intomainfrom
dm/fix-install-cosign-version
Feb 9, 2026
Merged

fix: handle unparseable cosign version in install.sh#580
dimitris-m merged 2 commits intomainfrom
dm/fix-install-cosign-version

Conversation

@dimitris-m
Copy link
Collaborator

@dimitris-m dimitris-m commented Feb 9, 2026

Closes #578

Summary

install.sh (bash)

  • Guard cosign version parsing with || true so an unparseable version (e.g. GitVersion: devel from distro packages) doesn't cause a silent exit under set -euo pipefail
  • Warn when version is unparseable; fail hard if --verify-signatures was explicitly requested

install.ps1 (PowerShell)

  • Add Find-Cosign to discover cosign under both cosign and cosign-windows-amd64 (winget and manual downloads use the platform-suffixed name)
  • Return $null instead of 0 for unparseable versions, with appropriate error/warning depending on -VerifySignatures
  • Fix cosign verify-blob on PowerShell 5.1: stderr output ("Verified OK") was treated as a terminating ErrorRecord under $ErrorActionPreference = "Stop". Use a child scope with "Continue" to prevent this while still preserving $LASTEXITCODE for real verification failures

Test plan

install.sh -- tested on Raspberry Pi (Debian trixie, cosign 2.5.0 via apt, GitVersion: devel)

  • Without --verify-signatures: prints warning, installation proceeds
  • With --verify-signatures: prints error, exits 1
  • With proper cosign (v3.0.4 from GitHub): no warnings, works as before

install.ps1 -- tested on Windows 11 (PS 5.1, cosign 3.0.4 via winget as cosign-windows-amd64)

  • -List: finds cosign via winget name, no warnings
  • -VerifySignatures fresh install: signature verified, installed successfully
  • Bad signature (wrong file): LASTEXITCODE=1, error message preserved, install aborted
  • Good signature: LASTEXITCODE=0, "Verified OK" captured without terminating error
  • GHA workflow test-install-ps1 passed all 3 jobs (x86, cosign, ARM64)

Distro-packaged cosign (e.g. apt on Debian) may report
"GitVersion: devel" instead of a semver string. The integer
comparison on the empty parsed result caused a silent exit under
set -euo pipefail.

Guard the version check: warn when the version is unparseable,
or fail if --verify-signatures was explicitly requested.
- Add Find-Cosign to check both 'cosign' and 'cosign-windows-amd64'
  (winget and manual downloads use the platform-suffixed name)
- Return $null instead of 0 for unparseable versions, with appropriate
  error/warning depending on -VerifySignatures
- Fix cosign verify-blob on PowerShell 5.1: stderr output ("Verified OK")
  was treated as a terminating ErrorRecord under $ErrorActionPreference = "Stop".
  Use a child scope with "Continue" to suppress this while still preserving
  $LASTEXITCODE for real verification failures.
@dimitris-m dimitris-m force-pushed the dm/fix-install-cosign-version branch from b4223ae to 43423af Compare February 9, 2026 20:23
@dimitris-m dimitris-m merged commit 7a1693b into main Feb 9, 2026
1 check passed
@dimitris-m dimitris-m deleted the dm/fix-install-cosign-version branch February 9, 2026 20:25
@maciejpirog maciejpirog mentioned this pull request Feb 17, 2026
@dimitris-m dimitris-m mentioned this pull request Feb 17, 2026
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 19, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [opengrep/opengrep](https://github.com/opengrep/opengrep) | patch | `v1.16.0` → `v1.16.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>opengrep/opengrep (opengrep/opengrep)</summary>

### [`v1.16.1`](https://github.com/opengrep/opengrep/releases/tag/v1.16.1): Opengrep 1.16.1

[Compare Source](opengrep/opengrep@v1.16.0...v1.16.1)

#### Improvements

- Pin Nuitka to 2.8.9 across all build workflows by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;594](opengrep/opengrep#594)
- Remove redundant pip and Nuitka dependencies by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;573](opengrep/opengrep#573)
- Support split rule/target directories in test subcommand by [@&#8203;qkaiser](https://github.com/qkaiser) in [#&#8203;576](opengrep/opengrep#576)

#### Benchmarking

- New benchmarking using hyperfine by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;557](opengrep/opengrep#557) and [#&#8203;579](opengrep/opengrep#579)

#### Bug fixes

- Allow multiple logical operators in metavariable comparison by [@&#8203;maciejpirog](https://github.com/maciejpirog) in [#&#8203;590](opengrep/opengrep#590)
- In `--experimental`, don't report git untracked files as skipped with `--use-git-ignore` by [@&#8203;maciejpirog](https://github.com/maciejpirog) in [#&#8203;577](opengrep/opengrep#577)
- C#: Add primary constructor arguments to base class by [@&#8203;maciejpirog](https://github.com/maciejpirog) in [#&#8203;589](opengrep/opengrep#589)
- Dockerfile: Add missing buildkit constructs by [@&#8203;maciejpirog](https://github.com/maciejpirog) in [#&#8203;581](opengrep/opengrep#581)
- Dockerfile: Fix CRLF and comment-in-continuation parsing by [@&#8203;abezdina](https://github.com/abezdina) in [#&#8203;586](opengrep/opengrep#586)
- Rust: Fix taint propagation through variable shadowing by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;572](opengrep/opengrep#572)
- TS/TSX: Add support for the `satisfies` construct by [@&#8203;maciejpirog](https://github.com/maciejpirog) in [#&#8203;592](opengrep/opengrep#592)

#### Installation

- Add Windows install script (pwsh) by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;569](opengrep/opengrep#569)
- Ensure that install.ps1 works on ARM by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;571](opengrep/opengrep#571)
- Fix: handle unparseable cosign version in install.sh by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;580](opengrep/opengrep#580)

#### Documentation

- Improve the README by [@&#8203;dimitris-m](https://github.com/dimitris-m) in [#&#8203;570](opengrep/opengrep#570)

#### New Contributors

- [@&#8203;qkaiser](https://github.com/qkaiser) made their first contribution in [#&#8203;576](opengrep/opengrep#576)
- [@&#8203;abezdina](https://github.com/abezdina) made their first contribution in [#&#8203;586](opengrep/opengrep#586)

**Full Changelog**: <opengrep/opengrep@v1.16.0...v1.16.1>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNC4yIiwidXBkYXRlZEluVmVyIjoiNDMuMjQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install.sh: silent failure when cosign reports non-semver version

1 participant