Skip to content

fix: require digests for blob fetch and delete - #2304

Merged
TerryHowe merged 2 commits into
oras-project:mainfrom
TanvirTian:fix/blob-commands-require-digest
Nov 1, 2026
Merged

TerryHowe merged 2 commits into
oras-project:mainfrom
TanvirTian:fix/blob-commands-require-digest

Conversation

@TanvirTian

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
This PR fixes oras blob fetch and oras blob delete accepting tags when a digest is required. It adds validation to reject non-digest references and a unit test for the validation.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2303

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.91%. Comparing base (b50ff65) to head (816247d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2304      +/-   ##
==========================================
+ Coverage   61.90%   61.91%   +0.01%     
==========================================
  Files         140      140              
  Lines        6100     6102       +2     
==========================================
+ Hits         3776     3778       +2     
  Misses       2101     2101              
  Partials      223      223              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Thanks for picking this up. I checked the callers: only blob fetch and blob delete pass allowTag=false, so no other command changes behaviour.

A few small things:

  1. The doc comment on EnsureReferenceNotEmpty still says it only reports an empty reference. Worth updating it, or giving the digest check its own method, since the name no longer covers what it does.
  2. The new error is a plain fmt.Errorf, while the empty case just above returns oerrors.NewErrEmptyTagOrDigest with the usage line and the <name>@<digest> recommendation. Reusing that structure (or a sibling of it) would give someone who passes a tag the same guidance as someone who passes nothing.
  3. The place users actually hit this is --oci-layout, since a remote blob store already refuses a tag. An e2e case along the lines of oras blob fetch --oci-layout <layout>:<tag> --output - would pin the user-visible behaviour; the unit test covers the helper only.

Heads-up: #2002 (the v3 migration) also changes option/target.go, so this will probably need a rebase once that lands.

@TanvirTian

Copy link
Copy Markdown
Contributor Author

Thanks for picking this up. I checked the callers: only blob fetch and blob delete pass allowTag=false, so no other command changes behaviour.

A few small things:

1. The doc comment on `EnsureReferenceNotEmpty` still says it only reports an empty reference. Worth updating it, or giving the digest check its own method, since the name no longer covers what it does.

2. The new error is a plain `fmt.Errorf`, while the empty case just above returns `oerrors.NewErrEmptyTagOrDigest` with the usage line and the `<name>@<digest>` recommendation. Reusing that structure (or a sibling of it) would give someone who passes a tag the same guidance as someone who passes nothing.

3. The place users actually hit this is `--oci-layout`, since a remote blob store already refuses a tag. An e2e case along the lines of `oras blob fetch --oci-layout <layout>:<tag> --output -` would pin the user-visible behaviour; the unit test covers the helper only.

Heads-up: #2002 (the v3 migration) also changes option/target.go, so this will probably need a rebase once that lands.

Thanks for the suggestions. I have updated the doc comment, reused the existing error structure, and added OCI-layout E2E coverage for both blob fetch and blob delete. THanks

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

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 2d47c2e into oras-project:main Nov 1, 2026
10 checks passed
TerryHowe added a commit to TanvirTian/oras that referenced this pull request Nov 1, 2026
Blob delete now requires the reference to be a digest (oras-project#2304), so the
placeholder references sha256:missing and sha256:1234 fail validation
before the handler is called. Use real digests instead.

Signed-off-by: Terry Howe <[email protected]>
TerryHowe pushed a commit to oras-project/oras-www that referenced this pull request Nov 19, 2026
Fixes #701 (part of #697)

Adds a blog post announcing ORAS CLI v1.4.0 at
`blog/2026-11-19-oras-1.4.0/index.mdx`. It follows the format of the
v1.3.0 post and uses the `oras` author like the other release posts.

It covers the topics listed in the issue:

- the move to oras-go v3, with a link to the oras-go v3.0.0 post
- `oras copy` with separate credentials on the same registry
(oras-project/oras#1892) and the GitLab login fix
(oras-project/oras#2260)
- the experimental `ORAS_EXPERIMENTAL_CONTAINERS_CONFIG` mode
- `oras blob fetch`/`delete` requiring digests (oras-project/oras#2304)
and header flags rejected for OCI layout targets
(oras-project/oras#2299)
- OCI image labels (oras-project/oras#2300) and build provenance
attestations

It also links the installation page and the full release notes.

The containers config section doesn't link a how-to guide yet because
#700 is still open. I can add the link once that guide lands.

Tested locally: `npm run check-links` passes, and the post renders
correctly with `npm start` at `/blog/oras-v1.4.0`.

I used Claude to help draft this post, and I checked the content against
the v1.4.0 release notes.

---------

Signed-off-by: Ashwanijha1405 <[email protected]>
TerryHowe pushed a commit to oras-project/oras-www that referenced this pull request Nov 20, 2026
Fixes #699 (part of #697)

## Summary

ORAS CLI
[v1.4.0](https://github.com/oras-project/oras/releases/tag/v1.4.0) was
released on 2026-11-17. This PR adds 1.4 as the latest docs version,
following the post-release checklist in the oras `RELEASING.md`. There
was no 1.4 preview, so the 1.4 docs start as a copy of 1.3.

- add `"1.4"` to the top of `versions.json` and `1.4 1.4.0` to
`versions-map`
- copy `versioned_docs/version-1.3/` and
`versioned_sidebars/version-1.3-sidebars.json` to 1.4
- regenerate `versioned_docs/version-1.4/commands/` with `npm run
refresh-commands` against the v1.4.0 binary. The only difference from
1.3 is that boolean flags now show as `--flag[=true|false]`, which is
what `oras <command> --help` prints in v1.4.0. The blob digest
requirement from oras-project/oras#2304 was already reflected in the 1.3
pages, and oras-project/oras#2299 changes behavior but not the help text
- installation page: pin v1.4.0 everywhere (download snippets, WinGet,
`go install`, the `ghcr.io/oras-project/oras` image, the `doras` alias
and setup-oras). The sample `oras version` output comes from the v1.4.0
release binary and matches the one in the issue
- binary verification guide: change the example to v1.4.0. The `gpg
--verify` signature time and the `gh attestation verify` digest and
workflow refs come from the v1.4.0 release assets. The "Starting with
`v1.3.6`" sentences and the expired-key example keep their versions
because they describe when attestations started and an older release
- Go scripting guide: require `oras.land/[email protected]`
- supply chain guide: say that the `oras discover`
`--format`/`--template` flags are experimental in v1.4, which they still
are
- home page Linux install snippet: `VERSION="1.4.0"`
- fix the "pervious" typo in the copied `quickstart.mdx`. Vale checks
the whole new file, so the typo carried over from 1.3 failed the check

One thing to note: WinGet doesn't list `ORASProject.ORAS` 1.4.0 yet (the
latest manifest is 1.3.6). `winget install oras --version 1.4.0` will
work once the community manifest is published. setup-oras already
supports 1.4.0, and `ghcr.io/oras-project/oras:v1.4.0` exists.

## Validation

- downloaded the v1.4.0 release assets. `gpg --verify` passes on the
checksums file and on `oras_1.4.0_linux_amd64.tar.gz`. `shasum -a 256
--ignore-missing -c` passes. `gh attestation verify` succeeds, also with
`--source-ref refs/tags/v1.4.0`, and fails with `--source-ref
refs/tags/v1.3.6`. `oras version` on darwin/arm64 prints the output
shown on the page
- the Go scripting example builds and runs with `oras.land/[email protected]`
(Go 1.26.11)
- `npm run refresh-commands`: only
`versioned_docs/version-1.4/commands/` changes, and older versions are
untouched
- `npm test` (32 passed), `npm run check-links`, `docusaurus build`. In
the build, `/docs/` serves 1.4 with the v1.4.0 snippets, and
`/docs/1.3/` is still there with the older-version banner

Signed-off-by: NopeCharon <[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.

oras blob fetch and oras blob delete accept tags instead of digests

3 participants