Skip to content

feat(availability): a curation hold decides without cached metadata where the proxy refuses from the path - #480

Merged
M0Rf30 merged 1 commit into
openartifact:mainfrom
orcamedia:feat/availability-uncached-curation
Nov 13, 2026
Merged

M0Rf30 merged 1 commit into
openartifact:mainfrom
orcamedia:feat/availability-uncached-curation

Conversation

@orcamedia

Copy link
Copy Markdown
Contributor

Follow-up from the #473 review ("Curation hold on an uncached package: do it in a follow-up").

Problem

POST /availability answered unknown for a version of a package the proxy had never fetched, even when a curation rule hides it. For example, evil/backdoor 1.0.0 against a proxy that blocks evil/*.

What serving does

Formats check curation at two different points, and that decides what the batch may claim:

  • From the request path, before anything is looked up: composer (serveComposerDist), pypi (servePyPIFile), and the formats gated in Service.Serve through Hooks.Coordinates (apk, conan, deb, ivy, maven, pacman, rpm, sbt). These answer 403 whether or not the upstream has the version.
  • After the version is found in the metadata: npm (findNPMRelease), helm (findHelmFile) and the rest. A version the metadata doesn't list is a 404, so for an uncached package nothing can be said.

Change

  • Hooks.CurationFromPath: a new flag, set for composer and pypi, with a comment on what it promises.
  • proxy.CuratesFromPath(format): true for those two and for any format with Coordinates. It's a hooks fact, not a list of format names.
  • Batch: for a proxy member of such a format, a version its rules hide is held at that member, decided before the cached metadata is read. In a group this follows serving: the member's 403 ends the request even when a later member has the version. A later member's rule doesn't reach a version an earlier member serves.
  • Unchanged: npm, helm and the other formats still answer unknown for an uncached package.

One visible side effect: for these formats a curated version no longer carries published_at, and min_age is unknown when the repository has a minimum age (off otherwise). That's because the cache isn't read; the reason and rule_id are unchanged. I can read the cache opportunistically to keep published_at if you prefer.

Tests

  • Proxy (real serving code):
    • composer: a curated dist of a version the upstream doesn't publish, and of a package it never served, answers 403 with the reason; neither the upstream nor the dist host is contacted.
    • pypi: the same for a file of a project never fetched.
  • TestCuratesFromPathFormats pins the list of formats, so moving a format's curation check changes a test.
  • Batch:
    • a composer proxy with a never-fetched package answers held;
    • a version its cached metadata doesn't list answers held;
    • in a group, the earlier proxy's rule decides although only the later member lists the version;
    • a later proxy's rule doesn't apply to a version an earlier member serves;
    • an npm proxy and an npm group stay unknown;
    • a hold from the path reads no cache.
  • Real server (Composer group, Packagist proxy with block rules): evil/backdoor 1.0.0 is now held ("known malicious vendor"); it was unknown. A never-fetched package without a rule stays unknown.

Checks

  • golangci-lint run ./... passes.
  • go test -short -race passes for internal/{api,proxy,mcp}.
  • make docs-check and make deadcode pass; the -tags noai,nomcp build passes; vue-tsc --noEmit passes.

Docs: hosted-proxy-group.md ("Check many versions at once"), the OpenAPI description of the POST, and an Unreleased upgrade note.

🤖 Generated with Claude Code

…here the proxy refuses from the path

The batch answered unknown for a version of a package the proxy had not
fetched, also when a curation rule hides it. For the formats that refuse
a curated download from the request path, before they know the upstream
has the version (composer and pypi in their own Serve, the formats with
Hooks.Coordinates in Service.Serve), the 403 does not depend on the
metadata. proxy.CuratesFromPath reports those formats (new
Hooks.CurationFromPath for composer and pypi), and the batch decides such
a version as held at that proxy without reading the cache; in a group
the refusal decides even when a later member has the version. npm, helm
and the other formats apply their rules once the version is found, so
they stay unknown.

Refs openartifact#471.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@M0Rf30
M0Rf30 merged commit d515faa into openartifact:main Nov 13, 2026
23 checks passed
@orcamedia
orcamedia deleted the feat/availability-uncached-curation branch November 13, 2026 18:47
M0Rf30 pushed a commit that referenced this pull request Nov 13, 2026
…ndency in (#483)

* feat(cli): oa check --fetch warms the proxies; show what pulls a dependency in

On a fresh proxy every answer is unknown until the package manager has
fetched each package once. --fetch requests each distinct package's
metadata through the repository first (composer p2 documents, npm
packuments), at most 8 at a time, so the proxies behind it, also
through a group, fetch and cache it; a request that does not answer 200
is counted and reported, not fatal.

The lockfile parsers record which locked packages require each
dependency (composer "require", npm dependencies/optional/peer of the
packages map with aliases resolved, lockfileVersion 1 "requires"). The
table gets a REQUIRED BY column ((direct) when only the project requires
it) and --format json a required_by list. The availability request now
carries only package and version.

The upgrade notes get a new Unreleased section: the #480 note had landed
under 0.24.0, which it is not part of.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(cli): oa check review: "-" instead of (direct), --fetch warms ~dev documents

- REQUIRED BY shows "-" when no locked package requires a dependency. A
  lockfile does not record the project's own requirements, so "(direct)"
  claimed more than it knows; the help and docs say a dependency listed
  with requirers may be direct as well.
- --fetch requests p2/<name>~dev.json for a locked Composer branch
  (dev-main, 1.x-dev), the document that lists it, so it no longer stays
  unknown after warming.
- npmV1 has its doc comment back; it had merged into npmV1Requirers'.
- Tests: the request body is decoded and its keys checked instead of a
  substring match, the REQUIRED BY cell is read by column, and
  metadataPath has its own table test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Areef <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants