Skip to content

fix(server): hide mirrored registry lookups from the public API - #163

Closed
sweepies wants to merge 1 commit into
mainfrom
t3/docs-daily-correctness-check-2
Closed

sweepies wants to merge 1 commit into
mainfrom
t3/docs-daily-correctness-check-2

Conversation

@sweepies

@sweepies sweepies commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

What

A registries entry with mirrorOf and credentials rewrites npm, PyPI and other package-registry requests through the mirror, and sends the entry's credentials. The server's credentialed check only recognized sources whose package carries a registry URL (Helm, OCI, Docker, Maven, forge tags), so those mirrored lookups were not withheld from the public repository API. A private repository's npm or PyPI results could therefore appear after the repository became public.

  • Count credentials that apply through a mirror in credentialed, for every source a mirror can cover.
  • Keep container registries on direct entries only, since they are not mirrored.
  • Extend the offline test with credentialed and credential-free mirrors.

Docs

  • Mirror example now uses the Go proxy, since PyPI is read through its JSON API first and a simple-only mirror does not replace it.
  • Mirrors: branch and dashboard identity wording, partial-API coverage, and release notes/advisories.
  • Image SBOMs use registry credentials; lockfile tools read the public registry or a mirror; compatibility and departures rows updated.
  • Settings reference names registry mirrors, repeated mirrorOf values and mirrors in the public API note.

Checks

  • cargo test -p patchula-http
  • cargo test -p patchula-datasource --test registry_protocol
  • cargo test -p patchula-server public
  • cargo clippy -p patchula-http -p patchula-datasource --all-targets -- -D warnings
  • mise run docs:build

View guided diff Turn on auto-fix

A lookup through a registry entry with `mirrorOf` and credentials can read
private data, but `credentialed` only recognized sources that carry their
registry's URL. A private repository's npm, PyPI and other mirrored lookups
were therefore stored with their updates, and could appear once the repository
became public. Count an entry's credentials through its mirror as well.

Docs: correct what mirrors cover, that image SBOM reads use registry
credentials, and the mirror example that only covered PyPI's simple fallback.
@deepsource-io

deepsource-io Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 79883f9...9208f93 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Nov 3, 2026 7:11a.m. Review ↗
JavaScript Nov 3, 2026 7:11a.m. Review ↗
Shell Nov 3, 2026 7:11a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 9208f93 Commit Preview URL

Branch Preview URL
Nov 03 2026, 07:12 AM

@context7

context7 Bot commented Nov 3, 2026

Copy link
Copy Markdown

Docs7 for sweepies/count-patchula

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 9208f93

@sweepies sweepies closed this Nov 3, 2026
sweepies added a commit that referenced this pull request Nov 4, 2026
…#177)

* fix(server): record at request time whether a lookup sent credentials

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).

* fix(server): record coalesced, digest and image reads; drop stale catalogs

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.

* fix(server): withhold advisories and messages; keep read records apart

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.

* fix(report): keep metadata when merging into an entry without it

An entry without metadata now takes the merged one's, so its
credentialed flag is not lost.

* fix(engine): box the futures each read record wraps

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

1 participant