Skip to content

fix(replication): Normalise CORE_URL comparison in isLocalHarbor (backport #873) - #908

Open
bupd wants to merge 1 commit into
release-2.15from
backport-873-islocalharbor-2.15
Open

bupd wants to merge 1 commit into
release-2.15from
backport-873-islocalharbor-2.15

Conversation

@bupd

@bupd bupd commented Sep 14, 2026

Copy link
Copy Markdown
Member

Clean cherry-pick of #873 to release-2.15.

isLocalHarbor compared the replication adapter URL against CORE_URL byte-for-byte, so a trailing slash or default port in either value made Harbor treat itself as a remote registry. The comparison now normalises both sides before matching. Same commit as main, no adaptation needed.

…kport #873)

Core stamps the local replication source URL from its own CORE_URL and
jobservice compares the result against its own. A deployment that sets an
explicit default port on only one of the two — http://harbor-core versus
http://harbor-core:80, which the documented SBOM workaround did — made the
raw string compare fail. The secret authorizer was then skipped and the
adapter fell back to basic auth with an empty username, so every private
project failed replication with 401 while public ones still worked through
anonymous pull.

Parse both URLs and compare scheme, host and port with :80 and :443 made
explicit for http and https. If either side fails to parse, or carries no
scheme or host, the exact string compare still decides.

Signed-off-by: Prasanth Baskar <prasanth@8gears.com>
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 740230fb-e5b1-4cc3-9c8e-1fd8749ffb31

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bupd bupd added the prio/P0 Ships this wave: blocks a release, a customer, or another PR label Sep 14, 2026

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

No issues found across 2 files

Re-trigger cubic

@github-actions github-actions Bot added the tests label Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview images for this PR are available in 8gears.container-registry.com/8gcr-pr with tag pr-908.

  • 8gears.container-registry.com/8gcr-pr/harbor-core:pr-908
  • 8gears.container-registry.com/8gcr-pr/harbor-jobservice:pr-908
  • 8gears.container-registry.com/8gcr-pr/harbor-registryctl:pr-908
  • 8gears.container-registry.com/8gcr-pr/harbor-exporter:pr-908
  • 8gears.container-registry.com/8gcr-pr/harbor-portal:pr-908
  • 8gears.container-registry.com/8gcr-pr/harbor-registry:pr-908
  • 8gears.container-registry.com/8gcr-pr/trivy-adapter:pr-908

Verify a preview image:

cosign verify \
  --certificate-identity-regexp="https://github.com/container-registry/harbor-next/.github/workflows/pr-ci.yml@.*" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  8gears.container-registry.com/8gcr-pr/harbor-core:pr-908

Verify SBOM attestation:

cosign verify-attestation \
  --certificate-identity-regexp="https://github.com/container-registry/harbor-next/.github/workflows/pr-ci.yml@.*" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  --type spdxjson \
  8gears.container-registry.com/8gcr-pr/harbor-core:pr-908

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio/P0 Ships this wave: blocks a release, a customer, or another PR tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants