Skip to content

fix: bound tag and referrer list pagination to prevent unbounded requests#1215

Merged
TerryHowe merged 1 commit into
oras-project:v2from
TerryHowe:fix/bound-referrer-tag-pagination-v2
Jul 2, 2026
Merged

fix: bound tag and referrer list pagination to prevent unbounded requests#1215
TerryHowe merged 1 commit into
oras-project:v2from
TerryHowe:fix/bound-referrer-tag-pagination-v2

Conversation

@TerryHowe

Copy link
Copy Markdown
Member

Summary

Backport of the tag/referrer pagination bound to the v2 line (oras.land/oras-go/v2).

Tag and referrer listing in Repository follow the server-provided Link: rel="next" header until the registry stops sending one, with no cap on the number of pages. A malicious or misbehaving registry can advertise an endless chain of pages — including a self-referential next link pointing back at the same endpoint — and force the client into unbounded HTTP requests and resource consumption (a client-side denial of service).

This is the library-side mitigation for the pagination issue described in GHSA-298f-872v-2rcx.

Changes

  • Add TagListMaxPages and ReferrerListMaxPages fields to Repository (propagated via clone()), bounding the number of pages followed during tag and referrer listing.
  • Enforce the caps in Tags() and referrersByAPI(); when the limit is exceeded, listing returns the new errdef.ErrTooManyPages.
  • Zero — the default — means unlimited, preserving existing behavior; callers opt in by setting a limit.

Tests

  • TestRepository_Tags_MaxPages and TestRepository_Referrers_MaxPages drive an httptest server that returns an endless Link chain and assert the listing terminates with errdef.ErrTooManyPages.

Notes

This addresses the oras-go (pagination) half of GHSA-298f-872v-2rcx. The advisory also describes a recursive oras discover graph traversal issue, which lives in the oras CLI rather than this library. The equivalent change for the development line is in #1214.

🤖 Generated with Claude Code

…ests

Tag and referrer listing follow the server-provided Link: rel="next"
header until the registry stops sending one, with no cap on the number
of pages. A malicious or misbehaving registry can advertise an endless
chain of pages (including a self-referential next link) and force the
client into unbounded requests and resource consumption, a client-side
denial of service.

Add TagListMaxPages and ReferrerListMaxPages to Repository so callers
can bound the number of pages followed during tag and referrer listing.
When the limit is exceeded the listing returns errdef.ErrTooManyPages.
Zero, the default, means unlimited and preserves existing behavior.

Refs GHSA-298f-872v-2rcx

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@TerryHowe
TerryHowe merged commit 314e836 into oras-project:v2 Jul 2, 2026
1 check passed
@TerryHowe TerryHowe mentioned this pull request Jul 7, 2026
TerryHowe added a commit that referenced this pull request Jul 10, 2026
This is a security patch release addressing advisories in the content
and remote layers, plus additional hardening and bug fixes since v2.6.1.

## Security Fixes

- Resolve the hardlink (`TypeLink`) target before passing it to
`os.Link`, preventing a crafted OCI artifact from hardlinking a file
outside the extraction directory via the process CWD (#1232,
[GHSA-fxhp-mv3v-67qp](GHSA-fxhp-mv3v-67qp)
/ CVE-2026-50163)
- Bound tag and referrer list pagination to prevent a malicious or
misbehaving registry from advertising an endless page chain and forcing
unbounded client requests (client-side DoS) (#1215)

## Bug Fixes

- Bound `content.ReadAll` allocation by actual content read rather than
the descriptor size, correcting the over-broad 32 MiB cap introduced for
GHSA-f36w-mj3v-6jqv so legitimate in-memory
`Push`/`FetchAll`/`FetchBytes` are not rejected (#1223)

## Other Changes

- Bump `golang.org/x/sync` from 0.20.0 to 0.21.0 (#1208)

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
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