Skip to content

fix: verify driver signatures in Client.Install - #544

Merged
zeroshade merged 3 commits into
mainfrom
fix/install-verify-signatures
Nov 4, 2026
Merged

zeroshade merged 3 commits into
mainfrom
fix/install-verify-signatures

Conversation

@zeroshade

@zeroshade zeroshade commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

SignedByColumnar's deprecation note says Client.Install verifies signatures, but on main it still doesn't: it calls config.InstallPackage with empty InstallPackageOptions, so library installs (and, via later PRs, npm/Rust installs) accept a driver whose library was modified after signing. Only the CLI verified.

This plugs into #502's transaction hook instead of adding a separate staging step:

  • dbc.VerifyPackageSignature(stagingDir, manifest) matches config.PackageVerifier. It is the check the CLI ran in verifySignatureInStaging, moved into the library; the CLI now delegates to it, with identical error messages.
  • Client.Install passes it as the Verifier unless the caller gives dbc.AllowUnsigned(), the library counterpart of --no-verify.
  • Verification runs on the staged package before publication, so a rejected driver leaves any existing install and registration in place.

Behaviour change: unsigned or tampered drivers installed through the library now fail unless the caller passes AllowUnsigned().

Tests: TestClientInstallVerifiesSignature (new tampered fixture is rejected with no registration; AllowUnsigned installs it) and TestClientInstallFailedVerificationKeepsExistingInstall.

(Archive path-traversal hardening was dropped from this PR: #502's validatePackageFilename already rejects ../, separators and reserved names before anything is written.)

@amoeba amoeba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question about exporting and maybe hardening VerifyPackageSignature.

Comment thread verify.go Resolved
SignedByColumnar's deprecation note says Client.Install verifies signatures,
but Client.Install passes no verifier to config.InstallPackage, so library
installs accept a driver whose library was modified after signing.

VerifyPackageSignature (a config.PackageVerifier) now holds the check the CLI
ran in verifySignatureInStaging; Client.Install passes it unless the caller
opts out with AllowUnsigned, and the CLI delegates to it. Verification runs on
the staged package, so a rejected driver leaves an existing install in place.
@zeroshade
zeroshade force-pushed the fix/install-verify-signatures branch from 2e1ffc9 to 30c3174 Compare November 4, 2026 15:23
VerifyPackageSignature is exported, so it can't rely on extractPackageArchive
having validated Files.driver and Files.signature. Joining them onto the
staging directory let '../' or a symlink point verification at a validly
signed file outside the package. Open both through os.OpenRoot(stagingDir).
Per review on #544.
The escape cases also moved the driver outside the stage, so verification
failed at the driver and never exercised the signature's confinement. Stage
the driver legitimately and escape only Files.signature (relative, absolute,
symlink); reverting just the signature open now fails the test.
@zeroshade
zeroshade merged commit c982a78 into main Nov 4, 2026
15 checks passed
@zeroshade
zeroshade deleted the fix/install-verify-signatures branch November 4, 2026 20:11
zeroshade added a commit that referenced this pull request Nov 4, 2026
#545)

Adds `internal/api`: search / resolve / install / uninstall / list
implemented once over `dbc.Client`, for the WASM and C bindings that
follow. Install/uninstall/list take an explicit directory or the
`user`/`system` config level. `NewClient` returns an error for a
malformed `baseURL` instead of panicking.

Also sets `toolchain go1.27.3` in `go.mod` for CI and releases (the `go`
minimum is unchanged).

Stacked on #544.

This branch was previously deployed

1 inactive deployment
snapshot — bd57275d Deployed Nov 4, 2026 by zeroshade via snapshot #1177
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.

2 participants