Skip to content

feat: install drivers from HTTP URL templates in dbc.toml - #621

Merged
eitsupi merged 31 commits into
feat/lock-measure-hash-onlyfrom
feat/http-source
Dec 1, 2026
Merged

eitsupi merged 31 commits into
feat/lock-measure-hash-onlyfrom
feat/http-source

Conversation

@eitsupi

@eitsupi eitsupi commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Let projects install off-registry dbc packages using HTTP URL templates in dbc.toml (see #394).

[drivers.example]
version = "1.2.0"

[drivers.example.source]
type = "http"
url = "https://example.com/releases/download/v{version}/example_{os}_{arch}_v{version}.tar.gz"
checksum_url = "https://example.com/releases/download/v{version}/SHA256SUMS"
signing_key = false
  • Configuration: Requires a dbc package archive. URL templates support {version}, {os}, and {arch} in the path. dbc does not discover available versions, so version must be a full version ("1.2.0" or "=1.2.0"); {version} expands to it, including any prerelease or build metadata. Unknown HTTP source keys are errors. An HTTP source can name a key from the project's [signing_keys] (feat: share project signing keys across sources #620), use the built-in key by default, or opt out with signing_key = false. Registry sources reject signing_key and checksum_url.
  • Targets: Locks archives for the declared platforms, or the current platform by default. Limitation: musl and architecture variant drivers (such as linux_amd64_musl or linux_amd64_v3) cannot be installed from an HTTP source yet. A template cannot tell those targets from the plain target, so HTTP sources reject them, including artifacts already recorded for them.
  • Hashes: dbc reads new hashes from checksum_url when set, as GNU sha256sum lines or as a single hash for a file that serves one archive. Otherwise, it records the first download's SHA-256 and size. As in refactor: let dbc lock pin measured archives without checking them #623, locking extracts an archive only to check an applicable v1 library checksum. At installation, dbc sync checks the archive, its MANIFEST version, and any required library signature. dbc warns when a new hash comes from a declared plain HTTP URL.
  • Downloads: Archive and checksum requests carry no registry credentials or telemetry IDs. URL replacements apply. The CLI rejects HTTPS-to-HTTP replacements and redirects. DBC_BASE_URL does not affect HTTP sources.
  • Lock replay: Records the template digest and absolute archive URLs. dbc sync rejects a changed source or a recorded URL that no longer matches the template. dbc lock can relock an explicitly changed source subject to signer continuity. Each unsigned source is a signer of its own, so changing an unsigned source's template needs its lock entry removed first; the error says so. Removing the HTTP declaration stops both commands without a registry search.
  • dbc sync --locked: Installs from the recorded artifacts without updating the lockfile or fetching a checksum file or registry index. The HTTP declaration, URL template, exact version, and pinned signer must still match.
  • Future work: mise's HTTP backend reads versions from a version_list_url, extracting them with a regex, JSON path or expression, so that latest and version prefixes work. A similar source key would let an HTTP source take a version range; this version of dbc rejects such a key with a hint that a newer dbc may be required.

@eitsupi
eitsupi added this pull request to stack #619 November 26, 2026 00:02
@eitsupi eitsupi changed the title feat/http source feat: install drivers from HTTP URL templates in dbc.toml Nov 26, 2026
@eitsupi
eitsupi marked this pull request as ready for review November 26, 2026 00:54
@eitsupi
eitsupi requested review from amoeba and zeroshade November 26, 2026 00:54
The hash of an HTTP source archive without a checksum file is now only
measured, like the one of a registry archive without a published hash:
the signature, the extraction checks and the version in its MANIFEST are
checked by the installation. dbc sync --no-verify no longer refuses to
measure an archive of a signed HTTP source.
The signer checks and the description of an unsigned pin are shared
with HTTP sources now, so they say source. A locked HTTP source is
also told apart by its own type rather than as any type but registry.
… variant targets

dbc sync --locked now checks a driver of an HTTP source against its lock
entry like planHTTP does, without fetching a checksum file, and reports a
removed declaration, a switch between an HTTP source and a registry, a
changed url template or version, and a signer that the source no longer
selects together with the other problems. The registries are never
consulted for such a driver.

A url template only has {os} and {arch}, so it would give a musl or
variant target the archive of the plain target. HTTP sources now reject
such targets, declared, implicit or recorded in the lock file. The checksum
file errors also name the format that dbc reads.
…oving the lock file

Removing the driver's entry is enough; removing the whole lock file may
also select newer versions of the other drivers.
The signer is now checked even when the url template changed, so that a
key change is reported together with it, and an unsupported target of the
driver list is reported once. A recorded artifact that cannot be replayed
tells to remove only that driver's lock entry, since dbc lock would reject
it again.
…d checksum files

Use a sub-table in the example, since a multi-line inline table is TOML 1.1
only.
…P source

Pin a recorded URL that the template does not give, a missing artifact for
this platform and a registry entry for a driver that now has an HTTP source.
…d also when its signer is not accepted

A recorded URL that the template does not give is now reported together
with a signer that the source no longer selects.
@eitsupi

eitsupi commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

8272e19 rejects musl and architecture variants for HTTP sources, adds HTTP replay to dbc sync --locked, and clarifies the checksum error.
777bc21 and eeaea0a check the signer and the recorded URLs independently, and 83ada37 adds replay failure coverage.
cea83ce uses a TOML sub-table and documents targets, checksums, and locked replay.
b835a88 points to removing only the affected lock entry for an intentional change to an unsigned source.

The dedicated update command is tracked in #196.

Could you take another look at the target restriction and HTTP replay under --locked?

@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-reviewed; LGTM.

  • Target restriction: checkHTTPTarget rejects musl and variant targets, whether declared or (with no platforms declared) the current platform. checkHTTPArtifacts also rejects them when already recorded in the lock file, with a per-driver hint. This applies to dbc lock, dbc sync and dbc sync --locked.
  • --locked replay: HTTP entries go through checkLockedHTTP and never reach replayLock/bind. The signer is checked even when the template changed, and recorded URLs are checked against the template even when the signer is rejected. Version and source changes are reported by lockMismatches/httpMismatches. Nothing is fetched, because the replayed plan has no pending artifacts.
  • The sub-table example, the per-entry hint for unsigned sources, and the checksum format hint all look good.

Nit: in cmd/dbc/http_source.go, checksumFormatHint sits between checksumFor's doc comment and func checksumFor. Go treats that comment as part of the constant's doc, and checksumFor ends up with none. Moving the constant above the comment fixes it.

This branch was previously deployed

1 inactive deployment
snapshot — eeaea0ae Deployed Nov 30, 2026 by eitsupi via snapshot #1414
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