Repository navigation
feat(lookup): let operator registries mirror public ones - #161
Conversation
A `registries` entry can set `mirrorOf` to a public registry's URL prefix. Requests under it go to the entry's prefix instead, with the entry's credentials if it has any, and no fallback to the public registry. `auth` and `secret` become optional, so an open proxy needs neither. Dependencies keep their public identity; container registries are not mirrored. Refs #157
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Rust | Nov 3, 2026 1:47a.m. | Review ↗ | |
| JavaScript | Nov 3, 2026 1:47a.m. | Review ↗ | |
| Shell | Nov 3, 2026 1:47a.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.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | 5284f02 | Commit Preview URL Branch Preview URL |
Nov 03 2026, 01:48 AM |
There was a problem hiding this comment.
1 issue found across 8 files
You’re at about 97% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/server/src/settings.rs">
<violation number="1" location="crates/server/src/settings.rs:302">
P1: The installation-denied branch returns `withheld` before applying `mirrorOf`, so public lookups bypass the configured mirror and may use a broader public credential. Apply the mirror mapping to this withheld entry too.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| }); | ||
| // A mirror whose secret cannot be read still stands in for its | ||
| // public registry, without credentials: there is no fallback. | ||
| let mirror = |entry: patchula_http::Credential| match ®istry.mirror_of { |
There was a problem hiding this comment.
P1: The installation-denied branch returns withheld before applying mirrorOf, so public lookups bypass the configured mirror and may use a broader public credential. Apply the mirror mapping to this withheld entry too.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At crates/server/src/settings.rs, line 302:
<comment>The installation-denied branch returns `withheld` before applying `mirrorOf`, so public lookups bypass the configured mirror and may use a broader public credential. Apply the mirror mapping to this withheld entry too.</comment>
<file context>
@@ -279,20 +297,31 @@ impl Settings {
- });
+ // A mirror whose secret cannot be read still stands in for its
+ // public registry, without credentials: there is no fallback.
+ let mirror = |entry: patchula_http::Credential| match ®istry.mirror_of {
+ Some(public) => entry.mirroring(public),
+ None => Some(entry),
</file context>
There was a problem hiding this comment.
Not fixing, on purpose. allowedInstallations limits who may use the entry, and that includes its mirror: for an installation outside the list the entry does not exist, so its lookups read the public registry as they would without any settings. Routing them through the mirror would let an excluded installation use the operator's proxy (and, for a credentialed one, fail with no credentials). A broader entry that covers the public registry applies only if the operator configured one for it.
|
Docs7 for sweepies/count-patchula
Commit |
An entry without auth that also covered a container registry made its tokens and digest reads count as an account's. Docs note that container registries are not mirrored.
First part of phase 3 of #157. Operators can route lookups for a public registry through a proxy: an Artifactory remote repository, a Nexus proxy, or a corporate mirror.
Behaviour
mirrorOfprefix is rewritten to the entry's prefix, keeping the rest of the URL, before cache keys and credentials are worked out. Its responses are cached under the mirror's entry, and it carries the entry's credentials if it hasauth.authandsecretare now optional. An entry needsauth,mirrorOfor both, and an entry withoutauthsends no credentials (Auth::Anonymous).proxy.golang.org.Docs
The sources guide gets a "Mirrors" section, and the settings reference and the compatibility matrix are updated.
Testing
mise run test:unit,mise run lintandmise run docs:buildpass on the dev VM. New tests cover:auth/secretand duplicate or selfmirrorOfNext in phase 3: per-dependency registries for npm, then PyPI, Cargo, NuGet, RubyGems/Composer and Go/Terraform.