Repository navigation
Conversation
c7a9fc3 to
65600b5
Compare
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.
zeroshade
left a comment
There was a problem hiding this comment.
Nice work. The anonymous download path, the HTTPS-downgrade guards, signer checks before any fetch, template-digest replay and the refusal to fall back to registries all look right, and I found no credential leak. One thing I'd like fixed before merge: gnu, musl and variant targets expand to the same archive URL (inline). The rest are nits.
Also, as the description says, whichever of #616 and #621 merges second needs to extend --locked to HTTP sources. Otherwise checkLockedReplay → replayLock → bind("") would report a misleading "not among the configured registries" trust problem for every HTTP driver.
| if slices.ContainsFunc(artifacts, func(a lockedArtifact) bool { return a.Target == t }) { | ||
| continue | ||
| } | ||
| u, err := src.url.expand(v, t) |
There was a problem hiding this comment.
Templates only have {os} and {arch}, so with platforms = ["linux_amd64", "linux_amd64_musl"] (or a _v3 variant) both targets expand to the same URL and get locked to the same archive. Nothing catches it later: the install checks the hash, the MANIFEST version and the signature, but not the platform. A musl machine using the platform override would install the glibc build without any warning. Until per-target overrides or a {libc} variable exist, could HTTP sources reject declared targets with LibC == "musl" or a non-empty Variant? Failing when two declared targets expand to the same URL would also work.
| ```toml | ||
| [drivers.example] | ||
| version = "1.2.0" | ||
| source = { |
There was a problem hiding this comment.
Newlines and a trailing comma inside an inline table are TOML 1.1 only. go-toml accepts them, but TOML 1.0 tools (taplo and editors built on it, Python tomllib) reject them, so users' editors would flag a config that dbc accepts. Could the example use a [drivers.example.source] sub-table instead? It decodes the same.
| // the same source or another one, keeps its signer. Every unsigned source is | ||
| // a signer of its own, so a driver pinned to one cannot move to another, | ||
| // whatever its type. | ||
| func checkSourceContinuity(name string, old, now lockedDriver) error { |
There was a problem hiding this comment.
Nit: with signing_key = false, any template change (a typo fix, a move to another host) is a new signer, so dbc lock refuses it, and the hint says to delete the whole lockfile, which can bump every other driver. It's consistent with unsigned registries, but a per-driver remedy ("delete this driver's entry") would be much less disruptive here.
| } | ||
| lines++ | ||
| if len(line) < 64 || !isHex(line[:64]) { | ||
| return "", errors.New("the checksum file has a line that does not start with a SHA-256 hash") |
There was a problem hiding this comment.
Nit: only GNU sha256sum output is accepted. BSD tag format (SHA256 (name) = hash, from shasum --tag / sha256sum --tag) and backslash-escaped names hit this message. Naming the expected format here or in the docs would save users some guessing.
Let projects install off-registry dbc packages using HTTP URL templates in
dbc.toml(see #394).{version},{os}, and{arch}in the path. dbc does not discover available versions, soversionmust 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 withsigning_key = false. Registry sources rejectsigning_keyandchecksum_url.checksum_urlwhen set. Otherwise, it records the first download's SHA-256 and size. As in refactor: letdbc lockpin measured archives without checking them #623, locking extracts an archive only to check an applicable v1 library checksum. At installation,dbc syncchecks the archive, itsMANIFESTversion, and any required library signature. dbc warns when a new hash comes from a declared plain HTTP URL.DBC_BASE_URLdoes not affect HTTP sources.dbc syncrejects a changed source or a recorded URL that no longer matches the template.dbc lockcan relock an explicitly changed source subject to signer continuity. Removing the HTTP declaration stops both commands without a registry search.version_list_url, extracting them with a regex, JSON path or expression, so thatlatestand 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.Note: #616 adds
dbc sync --locked, which handles registry sources only. Whichever of the two PRs merges second should extend it to HTTP sources.