Skip to content

feat(lock)!: pin the signing key fingerprint in lockfile v2 - #576

Merged
zeroshade merged 9 commits into
columnar-tech:mainfrom
eitsupi:feat/lock-signer-fingerprint
Nov 18, 2026
Merged

zeroshade merged 9 commits into
columnar-tech:mainfrom
eitsupi:feat/lock-signer-fingerprint

Conversation

@eitsupi

@eitsupi eitsupi commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #575 (dbc lock).

Lockfile v2 pins sources and archive hashes, but not the key signatures are verified with. This PR adds that before v2 ships.

  • Lockfile: each driver requires a signer table pinning the OpenPGP primary key its packages must verify with. This records the expected signer, not successful verification. A v2 lock without it is invalid; v2 is unreleased, so there is no migration. v1 upgrades are unchanged.

    [drivers.signer]
    type = 'openpgp'
    fingerprint = 'ab7766e9b341299ebc7f45dd82abd0a33a3c9e48'
  • Enforcement: dbc sync and dbc lock verify reused installations, new installations and hash-measuring downloads with the pinned key. An untrusted pin, or a re-resolution that would change the pin, fails before anything is downloaded, installed or written. There is no fallback key. --no-verify skips that run's signature check without changing or bypassing the pin.

  • API: dbc.SigningKey exposes one key's fingerprint and verification; dbc.ColumnarSigningKey() returns the built-in key. SignedByColumnar and VerifyPackageSignature are unchanged.

Only Columnar's built-in key is trusted. Existing users see only the new lock field; dbc install, Client.Install and install receipts are unchanged.

Other sources and verification methods

The table identifies who must authenticate a release; type specifies how. It belongs to the driver release rather than its source: one registry can serve multiple publishers.

  • Other OpenPGP keys, including custom-registry keys, would use openpgp with another fingerprint, without format changes.
  • Other authentication methods, such as the Packslip source explored in feat!: new lockfile format with GitHub release support via Packslip (PoC) #497, would need no OpenPGP signature. Another type would pin the verified identity (project, issuer and workflow identity for Sigstore keyless signing), so replaying the lock elsewhere does not trust a new identity on first use. Verified metadata hashes stay in evidence.

This PR defines only openpgp. An unknown type makes the lock invalid rather than skipping verification, so new types are additive.

@eitsupi
eitsupi marked this pull request as ready for review November 11, 2026 13:06

@zeroshade zeroshade 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.

The core change is solid. SigningKey takes its fingerprint and its verifier from the same parsed key, trustedSigner runs before any fetch, download or write and never falls back to another key, and an unknown type invalidates the lock instead of skipping verification. I tried it: dbc lock pins the Columnar fingerprint, and changing the fingerprint in the lock makes the next dbc lock fail with the "not trusted" error.

One design question to settle before v2 ships:

  1. Every driver gets Columnar's key pinned, whatever registry it comes from. signerFor ignores registryIdentity, so a driver from a third-party registry locked with --no-verify still gets fingerprint = <Columnar key>. The lock then records an expected signer that never signed the package. Once per-registry keys exist, which the signerFor comment anticipates, those entries become "signer changed" or "untrusted" errors that users have to clear by hand. v2 is unreleased and a missing signer makes the lock invalid, so now is the cheap time to decide how sources without a known key are recorded: an explicit "no signer" value, leaving the field out for those sources, or pinning Columnar's key only for registries known to be Columnar-signed. Requiring the field everywhere is fine; filling it with a key that doesn't apply is the problem.

Smaller points:

  1. The recovery advice in trustedSigner and signerChangedError ("delete the driver's entry from the lock file") contradicts the lock file header, which says the file is not intended for manual editing. Pointing at a command instead would be better: rm dbc.lock && dbc lock for now, or dbc lock --upgrade-driver <name> once that lands.
  2. The changed-signer check in plan (a re-resolution that switches signer has to fail) has no test for the failure. With only one trusted key it's hard to trigger, so a test double for signerFor may be needed.
  3. Nit: --no-verify still writes the pin, which is intended and documented in driver_list.md. One sentence on SigningKey or the signer docs saying the pin is policy, not proof of verification, would stop library users from treating it as proof.

@eitsupi

eitsupi commented Nov 17, 2026 •

Copy link
Copy Markdown
Member Author

Thanks for the review.

  1. The signer entry records the verification policy, not who signed the archive. Today that policy is "the Columnar key" for every registry: without --no-verify, dbc refuses a package from any registry that the Columnar key did not sign, so that is the key the lock should pin. --no-verify skips the verification of one run but does not change the policy, so it does not change the pin either.

    What's missing is a way to configure the policy per source. I'll add it for registries in the next PR, with this planned dbc.toml syntax:

    [signing_keys.example]
    type = "openpgp"
    public_key = """
    -----BEGIN PGP PUBLIC KEY BLOCK-----
    ...
    """
    
    [[registries]]
    url = "https://example.com/drivers"
    signing_key = "example"   # verify with this key
    
    [[registries]]
    url = "https://unsigned.example.com/drivers"
    signing_key = false       # explicitly do not require an OpenPGP signature

    If signing_key is omitted, the built-in Columnar key is used as now. With false, the lock records an explicit unsigned signer type with no fingerprint. Replaying that lock still requires signing_key = false in dbc.toml, so a lock file alone cannot turn verification off.

    Packslip sources come in a later PR, and their syntax is still tentative. They don't use signing_key: Packslip releases are signed keylessly through the project's CI identity. The signer is identified by a Packslip signer fingerprint, which is derived from the OIDC issuer and the repository ID:

    # dbc.toml
    [drivers.example]
    version = "1.2.3"
    
    [drivers.example.source]
    type = "packslip"
    project = "github.com/example/adbc-driver-example"
    signer = "ps1_snirenkjwr7m5ozgcufameodnm"   # optional: pin before the first install
    # dbc.lock
    [drivers.signer]
    type = "packslip"
    fingerprint = "ps1_snirenkjwr7m5ozgcufameodnm"

    That is why signer has a type: each kind of source adds its own (openpgp now, an unsigned type for signing_key = false, packslip later). A dbc version that doesn't know a type rejects the lock rather than skipping verification. A source that changes from the Columnar key to another signer changes the policy, and I think failing until the lock is recreated is the right behavior there.

  2. Changed the advice to recreating the lock file with dbc lock, with a TODO to suggest --upgrade-driver once it lands (f42e905).

  3. There was already a test (resolving again may not replace the pin), but it only checked text shared with the untrusted-key error. It now checks the changed-signer message, and it fails without that check.

  4. Added that sentence to the SigningKey doc comment. The lock file guide already says the table is a policy, not evidence of a verification.

@zeroshade zeroshade 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.

Thanks, all addressed. The policy framing for (1) makes sense: without --no-verify, every registry is checked against the Columnar key today, so that's the right pin, and the planned signing_key = "<name>" | false plus an explicit unsigned signer type that still needs signing_key = false in dbc.toml to replay closes the gap without letting a lock file turn verification off. One request on ordering: let's land the per-registry signing_key PR before a release ships lock file v2, so third-party registry users don't get a Columnar pin they'd have to recreate later. The shared signerChangeHint, the changed-signer test that now tells the two errors apart, and the SigningKey doc note look good. LGTM.

A SigningKey is built from one parsed OpenPGP public key and provides both
its primary key fingerprint and the detached signature verification, so
the two cannot drift apart. SignedByColumnar and VerifyPackageSignature
keep their behaviour and now delegate to the built-in Columnar key.
Every driver entry of a version 2 lock file now has a required signature
table with the OpenPGP primary key fingerprint that its packages must
verify with. It is an expected-signer policy, not evidence of a
verification.

dbc sync and dbc lock verify reused installations, new installations and
hash-measuring downloads with the pinned key. A pin that is not trusted,
or a re-resolution that would change it, fails before anything is
downloaded or written and never falls back to another key, also with
--no-verify.
git on Windows converted the line ending of the signed payload, which
made its detached signature invalid.
The table pins who must have signed a driver, not a signature, and the
name also fits sources that authenticate without an OpenPGP signature.
The signer errors told users to delete the driver's entry from the lock
file, which the file header says is not meant for manual editing. Point
to recreating the lock file with dbc lock instead. Check the
changed-signer failure by its own message, state that a pinned
fingerprint is not evidence of a verification, and leave a TODO for
choosing the key per registry.
@eitsupi
eitsupi force-pushed the feat/lock-signer-fingerprint branch from f42e905 to 84f4e51 Compare November 18, 2026 10:02
@eitsupi eitsupi changed the title feat(lock)!: pin the signing key fingerprint in lock file v2 feat(lock)!: pin the signing key fingerprint in lockfile v2 Nov 18, 2026
@eitsupi

eitsupi commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

#575 has been merged, so I've rebased and updated the PR body.

@eitsupi
eitsupi requested a review from zeroshade November 18, 2026 10:13

@zeroshade zeroshade 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.

Re-checked after the rebase onto main: the PR's commits are unchanged, and lint, build and tests are clean on the new base. Heads-up: this conflicts with #584 in sync_plan_test.go only (both add a test at the same spot); keep both. LGTM.

@zeroshade
zeroshade merged commit 2a7d4f5 into columnar-tech:main Nov 18, 2026
24 checks passed
@eitsupi
eitsupi deleted the feat/lock-signer-fingerprint branch November 18, 2026 23:10
zeroshade pushed a commit that referenced this pull request Nov 25, 2026
Follow-up to #576. Custom registries (#360) can name the key their
packages are signed with, so drivers from them no longer need
`--no-verify`. This also turns on the signer check of #601 for these
keys. Closes #613.

```toml
[signing_keys.acme]
type = "openpgp"
public_key_file = "keys/acme.asc"  # or public_key = "-----BEGIN PGP PUBLIC KEY BLOCK-----..."

[[registries]]
url = "https://drivers.acme.example.com"
signing_key = "acme"  # omitted: built-in Columnar key; false: unsigned registry
```

- **Config:** in the user `config.toml` and in `dbc.toml`. A
`signing_key` name is resolved only in the file that declares the
registry, so adding a key to the user config never changes what a
project trusts. A project cannot declare a registry from the user config
or a default registry (compared without query, user information or
default port) with a different signing policy; that is an error. An
omitted `signing_key` always means the built-in Columnar key. `columnar`
is reserved. Registry URLs in these files reject empty interior path
segments, `.` or `..` segments even when escaped, and escaped slashes,
so that another spelling of a trusted registry's path cannot get past
this check. Registry identities, including lockfile sources, omit
default ports and normalize path escapes by decoding unreserved
characters and uppercasing the remaining hex digits, preserving the
distinction between escaped and literal reserved characters.
- **Keys:** exactly one public certificate, armored (or binary in a
file). Private keys, several keys or armor blocks, unknown packets and
trailing data are rejected instead of skipped. A relative
`public_key_file` is relative to the file that defines it; in `dbc.toml`
it must stay inside the project directory (no absolute or UNC paths or
`..` that leaves it, read through `os.Root`). The file is read only when
its key is needed, also for the signer check, and the certificate read
is reused for the rest of the operation; a failure is an error, never a
fallback to another key.
- **Signer check:** when several registries list a driver, or an index
is missing, their signers must match (#601). Keys match only when their
certificates are identical, and every unsigned registry is a signer of
its own, so a missing index of an unsigned registry, or of one with a
key the others do not share, stops new resolution of drivers without a
`source`. The signer check, the verification and the lock pin of one
operation use the same certificate, even if a `public_key_file` changes
meanwhile.
- **Lockfile:** the selected key's fingerprint is pinned as in #576, or
`type = 'none'` for `signing_key = false`. Replay requires the
registry's current configuration to select the same signer, also with
`--no-verify`, so a lock entry can neither switch keys nor turn
verification off on its own. Each unsigned registry counts as a separate
signer, so a driver locked from one is not resolved again from another
unsigned registry, even with a changed `source`.
- **Install:** `dbc install` and `Client.Install` select the key from
the registry of the chosen package before downloading it, so a driver
that a later registry with the same key serves (#584) is verified with
that registry's key. `--no-verify` / `AllowUnsigned` skip the signature
check, but not the signer check of an implicit selection; local archives
keep using the Columnar key. The `install` and `sync` JSON report
`signature_verified`, and `verify.start` / `verify.complete` are only
emitted when a signature is checked.
- **API:** `Registry.Signing` (`RegistrySigningPolicy`, zero value =
Columnar key) with `SignWith` / `Unsigned`, plus `NewSigningKey` and
`Registry.ResolveSigningKey`. `RegistrySigningOperation` keeps the keys
of one operation; its `ResolvePackage` replaces the unreleased function
of the same name (#584, #601). The unreleased `LoadProjectRegistries` /
`WithProjectRegistries` become `LoadProjectConfig` /
`WithProjectConfig`, so key definitions and their file path travel with
the registries. Bindings take `signingKey` on explicit registries
(`registry.<n>.signing_key` in the C API).

The policy only covers detached OpenPGP signatures of registry packages;
another source such as Packslip would get its own policy and lock signer
type.
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