Repository navigation
fix(server): record at request time whether a lookup sent credentials - #177
Merged
Merged
Conversation
Which lookups the public repository API withholds was decided by predicting one URL per source and matching it against the operator's registries. That covered npm, PyPI, container registries, Helm, Maven and forge tags only, and only the first URL a lookup reads; crates, Go, NuGet, RubyGems, Packagist, Terraform and the rest never counted, nor did a second request a lookup made through a mirror. Now the HTTP client records, as each request is made, whether it carried an operator entry's credentials (directly or through a mirror, from the network or the cache, whose entries are kept per credential) or a registry account's token, in a task-local record. The engine runs each catalog lookup inside one, keeps the result with its saved catalogs, and writes it into the dependency's metadata as credentialed; the server withholds exactly those. The predicting credentialed() functions and the URL helpers only they used are gone. The mirrors example now mirrors the Go proxy, since PyPI is read through its JSON API first and a simple-only mirror does not replace it (from #163).
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | 976eea5 | Commit Preview URL Branch Preview URL |
Nov 04 2026, 06:04 AM |
…alogs From review: - A read served from the HTTP client's in-flight memo records the credentials its original request carried, so two lookups of the same URL both count. - Digest, image digest and SBOM reads run inside the record too; a dependency whose package any of them read with credentials is credentialed, which covers a digest-only image rule with no catalog. - Docker counts a token as an account's only when its entry sends credentials, not for a withheld entry. - Saved catalogs move to age-catalog-v4 without a default, so none saved before the record existed is reused as uncredentialed. - A withheld dependency also loses the version its range resolved to and its resolution, which came from the lookup.
From the second review: - A withheld dependency also loses its advisories: an image's come from SBOMs read with the same credentials. - Warnings and lookup failures naming a dependency found with credentials are dropped from the withheld report, and a private repository's stored run takes its warnings and lookup failures from it, since they can quote what the registry answered. - Merging two report entries keeps credentialed if either was. - Digest reads and image reads are recorded apart (git: and image:), so a credentialed image named like an npm package does not withhold it. - Cached::read_credential, which only the removed prediction used, is gone; the report reference documents credentialed.
An entry without metadata now takes the merged one's, so its credentialed flag is not lost.
Wrapping lookups and reads in a credential record grew the run's future past a debug build's test stack; boxing them keeps it on the heap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #163 (closed): which lookups the public repository API withholds.
The problem
The server withheld a dependency's updates from the public API when
credentialed(id)predicted that its lookup read a registry with operator credentials. The prediction built one URL per source and matched it against the registries. That missed:.infodocuments.It's the shadow-implementation pattern again: guessing what the lookup will request instead of recording what it did.
Request-time record
HTTP:
patchula_http::tracked(work)runs work in a task-local record. A request records that it sent credentials when it carries:Cached answers record too, since cache entries are kept per credential, so a hit is one those credentials read.
Engine: each catalog lookup runs inside
tracked, including GitHub release batches. The flag is stored with the engine's saved catalogs, so a reused catalog keeps it, and written into the dependency's metadata ascredentialed.Server:
withhelddrops exactly the dependencies whose metadata sayscredentialed.Engine::credentialed,Client::credentialedand the URL helpers only they used are deleted.Image checks: they read the same registry as the image's tag lookup, so its flag covers them.
GitHub token: requests with the GitHub token still don't count, as before. Otherwise every Actions and GitHub-release lookup would be withheld.
Also covered after review
age-catalog-v4, with no default for the new field. A catalog saved before the record existed can't be reused as uncredentialed.current.version,resolutionand advisories, plus warnings and lookup failures naming the dependency. A private repository's stored run uses them.credentialedif either had it.Tests
Follow-ups
No test drives the coalesced memo or the digest and SBOM records end to end.
A saved catalog fetched with credentials stays flagged until it expires, even if the credential is removed. That only over-withholds.
A private repository's stored run keeps the Count's own PR titles, bodies and branch messages, which name versions a credentialed lookup found. They're the bot's own text on GitHub, visible there once the repository is public.