Skip to content

feat(lookup): authenticate to private registries from operator settings - #160

Merged
sweepies merged 8 commits into
mainfrom
feat/registry-credentials
Nov 3, 2026
Merged

sweepies merged 8 commits into
mainfrom
feat/registry-credentials

Conversation

@sweepies

@sweepies sweepies commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Phase 2 of #157. Lookups can now authenticate to private registries, so Helm repositories, OCI/Docker registries, Maven repositories and GitLab/Gitea tags on a private host (such as the JFrog Artifactory in the issue) work.

Settings

registries {
  ["https://acme.jfrog.io/artifactory/api/helm/charts"] {
    auth = "bearer"
    secret { env = "ARTIFACTORY_TOKEN" }
  }
  ["https://registry-1.docker.io"] {
    auth = "basic"
    username = "acme"
    secret { file = "/run/secrets/dockerhub" }
    allowedInstallations { 123456 }   // server only; empty = all
  }
}
  • Keys are https URL prefixes. Paths match by whole segment on the same origin, and the longest prefix wins.
  • Secrets come from an env var or a file. The settings file never holds a secret.
  • Repository configs cannot name credentials.

Behaviour

  • HTTP layer (patchula-http): a request under a prefix carries the entry's Authorization. The cache key gains the entry's prefix (HttpKey::credential), so a read without that entry never sees responses read with it. Keys without a credential serialise exactly as before, so existing caches stay valid. Credentialed responses follow no-store/Vary. Redirects re-check the target and carry credentials only to URLs an entry covers.
  • Container registries: the basic credentials go on the first request. When the registry answers with a Bearer challenge, they are exchanged at a token service, but only one on the registry's own origin, Docker Hub's auth.docker.io or GitLab's /jwt/auth. Account tokens stay in memory.
  • Server: secrets are read again on every batch, so rotation needs no restart. An installation's engine is rebuilt when its credentials or the http settings change. An unreadable secret is logged, and that registry's lookups run without credentials.
  • CLI: an unreadable secret is a usage error (exit 2).

Public repository API

A public repository shows everything in the server's public repository API, including what private-registry lookups found, as its dependency dashboard does. A repository that is private when it runs is stored without those details: a credentialed dependency keeps what the repository declares, but loses its updates, held-back releases, lookup evidence, tag digests and image checks. If the repository later becomes public, they never appear.

Breaking

PATCHULA_DOCKERHUB_USERNAME and PATCHULA_DOCKERHUB_TOKEN are removed. Use a basic entry for https://registry-1.docker.io instead.

Not in this PR

  • npm, PyPI and the other package registries still read only their public registry (phase 3, together with mirrorOf).
  • Lockfile tools get no credentials yet (phase 4).

Docs

  • The sources guide gets a "Private registries" section.
  • The settings reference documents registries.
  • Updated: cache internals, image SBOMs, environment (the Docker Hub variables removed), compatibility, migrating, departures, and the lockfiles note.

Testing

mise run test:unit, mise run lint and mise run docs:build pass on the dev VM. New tests cover:

  • prefix matching and redaction
  • credential-scoped cache isolation, and stripping credentials on redirects
  • direct basic access and token exchange restricted to the registry's own origin
  • settings validation, secret reading and per-installation filtering

View guided diff Turn on auto-fix

Operator settings gain `registries`, keyed by https URL prefix. A request
under a prefix, matched by whole path segments, carries that entry's basic
or bearer credentials; the longest prefix wins. Secrets come from an
environment variable or a file and are read again for every server batch.

- Responses read with credentials are cached under their entry, so reads
  without it never see them.
- Container registries exchange basic credentials only at a token
  service on the registry's own origin, Docker Hub's or GitLab's, and
  account tokens stay in memory.
- Redirects carry credentials only to URLs an entry covers.
- In the server, `allowedInstallations` limits an entry; an unreadable
  secret is logged and its registry is read without credentials.

BREAKING CHANGE: PATCHULA_DOCKERHUB_USERNAME and PATCHULA_DOCKERHUB_TOKEN
are removed. Use a `basic` entry for https://registry-1.docker.io.

Refs #157
@deepsource-io

deepsource-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in f9d912e...f21c3dd 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 12:58a.m. Review ↗
JavaScript Nov 3, 2026 12:58a.m. Review ↗
Shell Nov 3, 2026 12:58a.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.

Comment thread crates/server/src/runtime.rs Outdated
if let std::collections::btree_map::Entry::Vacant(entry) = engines.entry(id) {
let mut engine = Engine::with_credentials(
let mut http = settings.http_options();
http.credentials = key.1.clone();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling `.clone()` for assignment to variable


Consider using .clone_from() instead of assigning the result of .clone().

clone_from() may perform better in some cases because some structs may have custom implementations of clone_from(), which improve performance by avoiding needless allocations.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread crates/cache/src/lib.rs Resolved
Comment thread crates/datasource/src/docker.rs Resolved
Comment thread crates/datasource/src/docker.rs Resolved
Comment thread crates/http/src/cached.rs Resolved
Comment thread docs/src/content/docs/guide/sources.md Resolved
Comment thread crates/server/src/settings.rs Resolved
Comment thread docs/src/content/docs/guide/sources.md Resolved
Comment thread crates/http/src/credentials.rs Resolved
@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 f21c3dd

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 21 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

- Cache scopes add a one-way digest of the credentials, so a rotated
  secret or another account never reads the previous one's fresh entries.
- An entry an installation may not use, or whose secret cannot be read,
  is withheld: its prefix carries nothing instead of a broader entry's
  credentials.
- A redirect into another entry's prefix is never stored under the
  original key, and a registry token issued under an entry stays within
  that entry's prefix.
- Registry tokens are kept per entry.
- Basic credentials reach a token service only with its own entry, on the
  registry's origin, at auth.docker.io, or at gitlab.com for
  registry.gitlab.com; the generic registry.* to parent-domain guess no
  longer gets them.
- Bearer tokens must be RFC 6750 b64tokens, and registry prefixes that
  differ only by a trailing slash are refused.
- Docs name Forgejo, the first registry request, and narrow the hostRules
  migration claim.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread crates/datasource/src/docker.rs Resolved
Comment thread crates/server/src/settings.rs Resolved
A token service's own entry was used even when the registry had none, so
an account token could be cached as anonymous and its answers stored
under unscoped keys. Credentials now reach a token service only for a
registry with an entry. Settings built without validation report a bad
registry prefix instead of panicking.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/src/content/docs/guide/sources.md Resolved
A leftover origin check kept a token service's own entry from being used,
so a self-hosted GitLab registry could not authenticate as documented.
A dependency looked up with registry credentials keeps what the
repository declares in the repository API, but loses its updates,
held-back releases, lookup evidence, tag digests and image checks, and
no longer counts as having updates. The datasource names such lookups
from the URL each source reads: Helm, Docker and OCI, Maven and forge
tags.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 issues found across 10 files (changes from recent commits).

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/public/tests.rs">

<violation number="1" location="crates/server/src/public/tests.rs:304">
P2: This fixture leaves `tagDigests`, `stale`, `lookup`, and `image` absent, so the test still passes if credential-derived metadata starts leaking through `public_view`. Populate those fields and assert they are cleared.</violation>
</file>

<file name="docs/src/content/docs/reference/settings.mdx">

<violation number="1" location="docs/src/content/docs/reference/settings.mdx:68">
P2: This wording implies reports are public on GitHub, but CLI JSON and `reportDirectory` reports are caller output or local files. Clarify that reports can still contain credential-derived findings; only pull requests and dashboard issues are necessarily public for public repositories.</violation>
</file>

<file name="crates/server/src/runtime.rs">

<violation number="1" location="crates/server/src/runtime.rs:577">
P2: This deep-clones and walks every report for `Lookup` and `DryRun`, although `shown` is only used in `Mode::Run`. Build the public view conditionally to avoid needless report-sized allocations on read-only requests.</violation>
</file>

<file name="crates/datasource/src/maven.rs">

<violation number="1" location="crates/datasource/src/maven.rs:71">
P2: This checks credentials only for `maven-metadata.xml`, but `maven` also HEADs per-version POMs and exposes their `Last-Modified` as `published_at`. A credential prefix limited to a POM path therefore leaves `credentialed()` false, allowing that private lookup result into the public API; account for credentials on POM requests too.</violation>
</file>

<file name="crates/server/src/public.rs">

<violation number="1" location="crates/server/src/public.rs:183">
P1: The public snapshot still exposes repository-level warnings and lookup failures from credentialed registries, including stale tag names and lookup outcomes. Filter those entries for credentialed dependencies before recording the report.</violation>

<violation number="2" location="crates/server/src/public.rs:190">
P1: A credentialed forge lookup can resolve an abbreviated action ref to a private catalog version, but this leaves that result in `current.version` and `metadata.resolution.version`. Clear those resolved fields while retaining the declared `current.value`.</violation>

<violation number="3" location="crates/server/src/public.rs:191">
P1: This still publishes findings from private images: the engine appends Docker/OCI SBOM advisories to `metadata.advisories`, but this sanitizer only clears `meta.image`. Clear those advisories for Docker/OCI dependencies too, or public snapshots reveal vulnerabilities found inside credentialed images.</violation>
</file>

<file name="crates/datasource/src/lib.rs">

<violation number="1" location="crates/datasource/src/lib.rs:187">
P1: This probes only the tags-list URL, so credentials scoped to Docker manifest reads are missed even though `registry_digest` uses them. `credentialed` then returns false and `public_view` can expose credential-derived digests and image checks; account for all registry read endpoints before treating the dependency as public.</violation>

<violation number="2" location="crates/datasource/src/lib.rs:195">
P1: This checks only the initial URL, so a Helm index redirected into a credentialed prefix is returned as private data while `credentialed()` stays false. Track credential use across redirects before allowing the server's public view to expose the lookup results.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

meta.held_back.clear();
meta.stale.clear();
meta.tag_digests.clear();
meta.lookup = None;

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: A credentialed forge lookup can resolve an abbreviated action ref to a private catalog version, but this leaves that result in current.version and metadata.resolution.version. Clear those resolved fields while retaining the declared current.value.

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/public.rs, line 190:

<comment>A credentialed forge lookup can resolve an abbreviated action ref to a private catalog version, but this leaves that result in `current.version` and `metadata.resolution.version`. Clear those resolved fields while retaining the declared `current.value`.</comment>

<file context>
@@ -164,6 +164,35 @@ struct Summary<'a> {
+        meta.held_back.clear();
+        meta.stale.clear();
+        meta.tag_digests.clear();
+        meta.lookup = None;
+        meta.image = None;
+    }
</file context>
Suggested change
meta.lookup = None;
meta.lookup = None;
meta.resolution = None;
dep.current.version = None;
Fix with cubic

let Some(meta) = dep.metadata.as_mut() else {
continue;
};
if !credentialed(&meta.source, &dep.package) {

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The public snapshot still exposes repository-level warnings and lookup failures from credentialed registries, including stale tag names and lookup outcomes. Filter those entries for credentialed dependencies before recording the report.

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/public.rs, line 183:

<comment>The public snapshot still exposes repository-level warnings and lookup failures from credentialed registries, including stale tag names and lookup outcomes. Filter those entries for credentialed dependencies before recording the report.</comment>

<file context>
@@ -164,6 +164,35 @@ struct Summary<'a> {
+        let Some(meta) = dep.metadata.as_mut() else {
+            continue;
+        };
+        if !credentialed(&meta.source, &dep.package) {
+            continue;
+        }
</file context>
Fix with cubic

let url = match source {
Source::Docker | Source::Oci => docker::identity(package)
.ok()
.map(|(host, path)| format!("https://{host}/v2/{path}/tags/list")),

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This probes only the tags-list URL, so credentials scoped to Docker manifest reads are missed even though registry_digest uses them. credentialed then returns false and public_view can expose credential-derived digests and image checks; account for all registry read endpoints before treating the dependency as public.

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/datasource/src/lib.rs, line 187:

<comment>This probes only the tags-list URL, so credentials scoped to Docker manifest reads are missed even though `registry_digest` uses them. `credentialed` then returns false and `public_view` can expose credential-derived digests and image checks; account for all registry read endpoints before treating the dependency as public.</comment>

<file context>
@@ -177,6 +177,24 @@ impl Client {
+        let url = match source {
+            Source::Docker | Source::Oci => docker::identity(package)
+                .ok()
+                .map(|(host, path)| format!("https://{host}/v2/{path}/tags/list")),
+            Source::Helm => package
+                .rsplit_once('|')
</file context>
Fix with cubic

Source::ForgeTags => forge::tags_url(package),
_ => None,
};
url.and_then(|url| self.http.credential(&url))

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This checks only the initial URL, so a Helm index redirected into a credentialed prefix is returned as private data while credentialed() stays false. Track credential use across redirects before allowing the server's public view to expose the lookup results.

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/datasource/src/lib.rs, line 195:

<comment>This checks only the initial URL, so a Helm index redirected into a credentialed prefix is returned as private data while `credentialed()` stays false. Track credential use across redirects before allowing the server's public view to expose the lookup results.</comment>

<file context>
@@ -177,6 +177,24 @@ impl Client {
+            Source::ForgeTags => forge::tags_url(package),
+            _ => None,
+        };
+        url.and_then(|url| self.http.credential(&url))
+            .is_some_and(|entry| entry.auth != patchula_http::Auth::Withheld)
+    }
</file context>
Fix with cubic

meta.stale.clear();
meta.tag_digests.clear();
meta.lookup = None;
meta.image = None;

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This still publishes findings from private images: the engine appends Docker/OCI SBOM advisories to metadata.advisories, but this sanitizer only clears meta.image. Clear those advisories for Docker/OCI dependencies too, or public snapshots reveal vulnerabilities found inside credentialed images.

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/public.rs, line 191:

<comment>This still publishes findings from private images: the engine appends Docker/OCI SBOM advisories to `metadata.advisories`, but this sanitizer only clears `meta.image`. Clear those advisories for Docker/OCI dependencies too, or public snapshots reveal vulnerabilities found inside credentialed images.</comment>

<file context>
@@ -164,6 +164,35 @@ struct Summary<'a> {
+        meta.stale.clear();
+        meta.tag_digests.clear();
+        meta.lookup = None;
+        meta.image = None;
+    }
+    report
</file context>
Suggested change
meta.image = None;
if matches!(meta.source.as_str(), "docker" | "oci") {
meta.advisories.clear();
}
meta.image = None;
Fix with cubic

"current": {"value": "1.0.0", "version": "1.0.0", "digest": null},
"updates": [{"newValue": "1.1.0", "newVersion": "1.1.0", "newDigest": null,
"updateType": "minor", "group": null}],
"metadata": {"source": source, "kinds": [], "locations": [],

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This fixture leaves tagDigests, stale, lookup, and image absent, so the test still passes if credential-derived metadata starts leaking through public_view. Populate those fields and assert they are cleared.

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/public/tests.rs, line 304:

<comment>This fixture leaves `tagDigests`, `stale`, `lookup`, and `image` absent, so the test still passes if credential-derived metadata starts leaking through `public_view`. Populate those fields and assert they are cleared.</comment>

<file context>
@@ -293,3 +293,35 @@ async fn settings_hide_repositories_or_the_whole_api() {
+            "current": {"value": "1.0.0", "version": "1.0.0", "digest": null},
+            "updates": [{"newValue": "1.1.0", "newVersion": "1.1.0", "newDigest": null,
+                "updateType": "minor", "group": null}],
+            "metadata": {"source": source, "kinds": [], "locations": [],
+                "heldBack": [{"version": "2.0.0", "updateType": "major",
+                    "publishedAt": "2026-11-01T00:00:00Z", "eligibleAt": "2026-11-02T00:00:00Z"}]}})
</file context>
Fix with cubic


The server's [repository API](/guide/server/#repository-api) hides what lookups
made with credentials found, as described there. Reports, pull requests and
the dashboard issue are unchanged: in a public repository those are public on

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This wording implies reports are public on GitHub, but CLI JSON and reportDirectory reports are caller output or local files. Clarify that reports can still contain credential-derived findings; only pull requests and dashboard issues are necessarily public for public repositories.

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 docs/src/content/docs/reference/settings.mdx, line 68:

<comment>This wording implies reports are public on GitHub, but CLI JSON and `reportDirectory` reports are caller output or local files. Clarify that reports can still contain credential-derived findings; only pull requests and dashboard issues are necessarily public for public repositories.</comment>

<file context>
@@ -63,12 +63,10 @@ A `registries` key is an https URL prefix without a user, query or fragment.
-the API already shows from earlier runs.
+The server's [repository API](/guide/server/#repository-api) hides what lookups
+made with credentials found, as described there. Reports, pull requests and
+the dashboard issue are unchanged: in a public repository those are public on
+GitHub anyway.
 
</file context>
Fix with cubic

Comment thread crates/server/src/runtime.rs Outdated
}
.map_err(|_| "the run failed on the server")?
.map_err(|_| "the run failed on the server")?;
let shown = crate::public::public_view(&report, |source, package| {

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This deep-clones and walks every report for Lookup and DryRun, although shown is only used in Mode::Run. Build the public view conditionally to avoid needless report-sized allocations on read-only requests.

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/runtime.rs, line 577:

<comment>This deep-clones and walks every report for `Lookup` and `DryRun`, although `shown` is only used in `Mode::Run`. Build the public view conditionally to avoid needless report-sized allocations on read-only requests.</comment>

<file context>
@@ -562,12 +568,16 @@ impl crate::remote::Runner for Engines {
                 }
-                .map_err(|_| "the run failed on the server")?
+                .map_err(|_| "the run failed on the server")?;
+                let shown = crate::public::public_view(&report, |source, package| {
+                    engine.credentialed(source, package)
+                });
</file context>
Fix with cubic

pub(crate) fn metadata_url(package: &str) -> Option<String> {
base(package)
.ok()
.map(|base| format!("{base}/maven-metadata.xml"))

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This checks credentials only for maven-metadata.xml, but maven also HEADs per-version POMs and exposes their Last-Modified as published_at. A credential prefix limited to a POM path therefore leaves credentialed() false, allowing that private lookup result into the public API; account for credentials on POM requests 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/datasource/src/maven.rs, line 71:

<comment>This checks credentials only for `maven-metadata.xml`, but `maven` also HEADs per-version POMs and exposes their `Last-Modified` as `published_at`. A credential prefix limited to a POM path therefore leaves `credentialed()` false, allowing that private lookup result into the public API; account for credentials on POM requests too.</comment>

<file context>
@@ -55,10 +55,26 @@ fn versions(bytes: &[u8]) -> std::result::Result<Vec<u8>, patchula_http::CacheEr
+pub(crate) fn metadata_url(package: &str) -> Option<String> {
+    base(package)
+        .ok()
+        .map(|base| format!("{base}/maven-metadata.xml"))
+}
+
</file context>
Fix with cubic

A public repository's dependency dashboard and pull requests show what
private-registry lookups found, so its public API entry does too. A
repository that is private when it runs is stored without those details,
so they never appear if it later becomes public.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files (changes from recent commits).

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/public.rs">

<violation number="1" location="crates/server/src/public.rs:278">
P1: `private` is fetched after `engine.run()` returns, so a repository made public during a run takes this branch's `else` and stores credentialed lookup results. Capture visibility before the run and withhold results for repositories that were private then; a later visibility refresh can otherwise expose this snapshot through the public API.</violation>

<violation number="2" location="crates/server/src/public.rs:279">
P1: This withholds only `package_files`; `branches` still come from the raw report actions. `BranchAction.message` includes dependency names and target versions, so a private run can persist credentialed lookup results that the public API exposes after the repository becomes public; filter those actions too.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

.collect();
let dependencies = repo.package_files.iter().flat_map(|f| &f.dependencies);
let package_files = if private {
&recorded.withheld.repositories[index].package_files

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This withholds only package_files; branches still come from the raw report actions. BranchAction.message includes dependency names and target versions, so a private run can persist credentialed lookup results that the public API exposes after the repository becomes public; filter those actions 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/public.rs, line 279:

<comment>This withholds only `package_files`; `branches` still come from the raw report actions. `BranchAction.message` includes dependency names and target versions, so a private run can persist credentialed lookup results that the public API exposes after the repository becomes public; filter those actions too.</comment>

<file context>
@@ -266,7 +275,12 @@ pub(crate) async fn record(
             .collect();
-        let dependencies = repo.package_files.iter().flat_map(|f| &f.dependencies);
+        let package_files = if private {
+            &recorded.withheld.repositories[index].package_files
+        } else {
+            &repo.package_files
</file context>
Fix with cubic

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fixing, on purpose. Branches, their commit messages and the PRs live in the repository itself, so once it becomes public GitHub shows them too: withholding them from the API would protect nothing. What is withheld is what exists only in the Count's lookup, such as updates not yet in a PR, held-back releases and lookup evidence.

})
.collect();
let dependencies = repo.package_files.iter().flat_map(|f| &f.dependencies);
let package_files = if private {

@cubic-dev-ai cubic-dev-ai Bot Nov 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: private is fetched after engine.run() returns, so a repository made public during a run takes this branch's else and stores credentialed lookup results. Capture visibility before the run and withhold results for repositories that were private then; a later visibility refresh can otherwise expose this snapshot through the public API.

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/public.rs, line 278:

<comment>`private` is fetched after `engine.run()` returns, so a repository made public during a run takes this branch's `else` and stores credentialed lookup results. Capture visibility before the run and withhold results for repositories that were private then; a later visibility refresh can otherwise expose this snapshot through the public API.</comment>

<file context>
@@ -266,7 +275,12 @@ pub(crate) async fn record(
             })
             .collect();
-        let dependencies = repo.package_files.iter().flat_map(|f| &f.dependencies);
+        let package_files = if private {
+            &recorded.withheld.repositories[index].package_files
+        } else {
</file context>
Fix with cubic

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fixing, on purpose. If a repository becomes public during a run, that run's dependency dashboard and PRs are in the now-public repository too, so its snapshot shows nothing GitHub does not. The rule is the user's: a public repository shows what private-registry lookups found, and only a private one is stored without it.

@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 f21c3dd Commit Preview URL

Branch Preview URL
Nov 03 2026, 12:59 AM

@sweepies
sweepies merged commit 1a5abe1 into main Nov 3, 2026
17 checks passed
@sweepies
sweepies deleted the feat/registry-credentials branch November 3, 2026 01:28
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