Skip to content

Add Harbor fallback for catalog and search endpoints#617

Open
pguinet wants to merge 2 commits intoFinsys:mainfrom
pguinet:fix/harbor-catalog-fallback
Open

Add Harbor fallback for catalog and search endpoints#617
pguinet wants to merge 2 commits intoFinsys:mainfrom
pguinet:fix/harbor-catalog-fallback

Conversation

@pguinet
Copy link
Copy Markdown

@pguinet pguinet commented Feb 20, 2026

Summary

  • Harbor robot accounts are denied access to the V2 _catalog endpoint (scope registry:catalog:* returns an empty JWT), making catalog browsing and image search non-functional for Harbor registries
  • This PR adds automatic Harbor detection and transparently falls back to the native Harbor project API (/api/v2.0/projects/{name}/repositories) for both catalog listing and image search
  • No configuration change required — Harbor registries are detected automatically via the WWW-Authenticate header and /api/v2.0/ping, with a 5-minute cache

Changes

src/lib/server/docker.ts

  • isHarborRegistry(): detect Harbor via WWW-Authenticate + /api/v2.0/ping (result cached 5 min)
  • harborListRepositories(): list repos through Harbor project API with pagination support
  • harborSearchRepositories(): search repos using Harbor's q=name=~{term} filter
  • HarborCatalogResult type + getHarborBasicAuth() helper

src/routes/api/registry/catalog/+server.ts

  • Harbor detection before _catalog call, delegates to handleHarborCatalog()

src/routes/api/registry/search/+server.ts

  • Harbor detection in searchCatalog(), delegates to harborSearchRepositories()

Test plan

  • Tested against a real Harbor instance with a robot account
  • Catalog listing returns repositories correctly
  • Image search returns filtered results
  • Non-Harbor registries are unaffected (fallback is only triggered for Harbor)
  • Built and deployed as fnsys/dockhand:harbor-fix

Fixes #360

🤖 Generated with Claude Code

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 20, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
9 out of 10 committers have signed the CLA.

✅ sieren
✅ matt-boris
✅ FlintyLemming
✅ vikte
✅ shamoon
✅ TimElschner
✅ flohoss
✅ pguinet
✅ artbird309
❌ jotka
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread src/lib/server/docker.ts Outdated
return { baseUrl, orgPath: parsed.path, authHeader };
}

// --- Harbor fallback pour le catalog et la recherche d'images ---
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.

hi @pguinet - we need all comments to be in english.

Copy link
Copy Markdown
Author

@pguinet pguinet Feb 20, 2026

Choose a reason for hiding this comment

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

Hello @jotka - Sorry about that! I've translated all comments to English in the latest commit. Won't happen again.

@jotka
Copy link
Copy Markdown
Contributor

jotka commented Apr 20, 2026

@pguinet can i ask you to sync your fork and rebase on main?

  git fetch upstream
  git rebase upstream/main
  git push --force

sorry for the force push.

pguinet and others added 2 commits April 20, 2026 14:29
Harbor denies access to the V2 _catalog endpoint for robot accounts
(scope registry:catalog:* returns an empty JWT). This adds automatic
Harbor detection and falls back to the native Harbor project API
(/api/v2.0/projects/{name}/repositories) for both catalog listing
and image search.

- Detect Harbor via WWW-Authenticate header + /api/v2.0/ping (cached 5min)
- List repositories through Harbor project API with pagination
- Search repositories using Harbor's q=name=~ filter
- Transparent fallback: no configuration change required

Fixes Finsys#360

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pguinet pguinet force-pushed the fix/harbor-catalog-fallback branch from 268ab61 to 4f5fe7b Compare April 20, 2026 12:30
@pguinet
Copy link
Copy Markdown
Author

pguinet commented Apr 20, 2026

@jotka done — rebased on main and force-pushed. Branch is now up to date (2 commits: Harbor fallback + English comments translation).

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.

Unable to Connect to Harbor Registry

3 participants