Skip to content

[CHERRY-PICK] fix(security): validate blob-mount source project and reject tokens missing iat (#23270) - #23297

Merged
chlins merged 1 commit into
goharbor:release-2.15.0from
Vad1mo:cherry-pick/v2token-blobmount-and-nil-iat-2.15
May 29, 2026
Merged

[CHERRY-PICK] fix(security): validate blob-mount source project and reject tokens missing iat (#23270)#23297
chlins merged 1 commit into
goharbor:release-2.15.0from
Vad1mo:cherry-pick/v2token-blobmount-and-nil-iat-2.15

Conversation

@Vad1mo

@Vad1mo Vad1mo commented May 28, 2026

Copy link
Copy Markdown
Member

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Cherry-pick of #23270 onto release-2.15.0.

#23270 was a follow-up to #22900 (the project-recreation defense) that closed two remaining gaps in tokenIssuedAfterProjectCreation:

Issue being fixed

Cherry-pick of #23270.

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

…eject tokens missing iat (goharbor#23270)

Follow-up to goharbor#22900.

tokenIssuedAfterProjectCreation only validated info.ProjectName. A
cross-repository blob mount (POST /v2/<repo>/blobs/uploads/?from=<src>)
also requires pull access to the source project, so a token issued
before the source project was deleted and recreated with the same name
would still be accepted. Validate the issued-at time against the
blob-mount source project as well.

Also fail closed when the token has no iat claim: claims.IssuedAt is a
*NumericDate pointer and was dereferenced unconditionally, panicking the
request handler for a token without iat instead of rejecting it.

Signed-off-by: Vadim Bauer <vb@container-registry.com>
(cherry picked from commit 8b82233)
@Vad1mo
Vad1mo requested a review from a team as a code owner May 28, 2026 14:22
@Vad1mo Vad1mo added the release-note/update Update or Fix label May 28, 2026
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-2.15.0@8c7276b). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##             release-2.15.0   #23297   +/-   ##
=================================================
  Coverage                  ?   65.98%           
=================================================
  Files                     ?     1074           
  Lines                     ?   116754           
  Branches                  ?     2952           
=================================================
  Hits                      ?    77039           
  Misses                    ?    35438           
  Partials                  ?     4277           
Flag Coverage Δ
unittests 65.98% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/server/middleware/security/v2_token.go 78.46% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wy65701436 wy65701436 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

@chlins chlins 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

@chlins
chlins merged commit 38530e5 into goharbor:release-2.15.0 May 29, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/update Update or Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants