Safeguard Docs
Integrations

Harbor

Connect Harbor to Safeguard. The robot account permissions Safeguard needs, which credentials work, and step-by-step setup.

Availability

This integration is switched on per workspace. If you do not see the card under Integrations, ask your Safeguard contact.

What it does

The Harbor card connects Safeguard to the projects in a Harbor registry (Harbor 2.0 or later). Safeguard lists your projects, every repository in them and every tag, and each image you select becomes a project that Safeguard scans for an SBOM and vulnerability findings. Each scan is pinned to the digest the tag points at when the scan starts, and pulls the image with the credential you connect. Beside each tag Safeguard shows Harbor's own scan summary and whether the image is signed, labelled as Harbor's; Safeguard's findings come from its own scan. Find the card under Integrations on the Project/Product tab.

Public vs private

PublicPrivate
What you enterThe Harbor URLThe Harbor URL and a robot account or user
Credential neededNone. Only projects marked Public in Harbor are readA robot account and its secret, or a user and its password or CLI secret
What you can scanPublic projectsEvery project the credential can see, or the projects you name

Supported auth methods

Method (dialog label)Use it whenNotes
Robot accountRecommendedA project robot (robot$<project>+<name>) for one project, or a system robot (robot$<name>) for several
PasswordNo robot account is allowedA Harbor user with its password, or its CLI secret when Harbor signs users in with OIDC

Permissions required

Safeguard only reads. It never pushes, deletes or retags images, and never changes project settings, except the webhook you add yourself (below).

Robot account

PermissionRequired?What Safeguard uses it for
Repository: ListRequiredListing repositories (/api/v2.0/projects/{project}/repositories)
Repository: PullRequiredReading manifests for digests and pulling images for scans
Artifact: List and ReadRequiredListing artifacts with their tags, digests, Harbor scan summary and signatures
Project: Read (system robot)Required for a system robotListing the projects it covers
Repository: Push, Delete; Artifact: Delete; any other permissionNot usedSafeguard never writes

Least privilege: a project robot on each project to scan with only Repository List and Pull and Artifact List and Read, and an expiry.

Password

RoleRequired?What Safeguard uses it for
Limited Guest (or Guest) on each projectRequiredThe same reads as above

Token types

Credential typeWorks?Notes
Project robot accountYes (recommended)Scoped to one project
System robot accountYesCovers several projects; give it only the read permissions above
User and CLI secret (OIDC)YesThe CLI secret is under User Profile > CLI secret
User and password (database or LDAP auth)YesUse a dedicated read-only user
Admin userWorks, not recommendedFar more than Safeguard needs

Expiry: set robot accounts to expire in 90 days or less, and refresh the secret before then. An expired robot fails with the "rejected the credential" message below.

What we never need: Push, Delete, Project admin or Maintainer roles, system administrator rights, or any configuration permission.

Step-by-step setup

Create the credential in Harbor

  1. Open the project, then Robot Accounts > + New Robot Account.
  2. Give it a name and an expiry, and tick only Repository: List, Pull and Artifact: List, Read.
  3. Click Add. Copy the robot's name (robot$<project>+<name>) and secret; Harbor shows the secret once.

Or with the Harbor API

curl -u admin -X POST -H "Content-Type: application/json" https://harbor.example.com/api/v2.0/robots -d '{
  "name": "safeguard", "level": "project", "duration": 90,
  "permissions": [{"kind": "project", "namespace": "<project>", "access": [
    {"resource": "repository", "action": "list"}, {"resource": "repository", "action": "pull"},
    {"resource": "artifact", "action": "list"}, {"resource": "artifact", "action": "read"}]}]}'

Connect it in Safeguard

  1. Open Integrations and choose the Project/Product tab.
  2. Click Connect on the Harbor card.
  3. Choose Private (or Public), enter a Name and the Harbor URL, for example https://harbor.example.com.
  4. Private: pick Robot account and enter the Robot account name and the secret (or Password with a username).
  5. Projects (optional): limit listing to some projects.
  6. Click Verify Credentials (or Check anonymous access). "Connected. N Docker repositories are readable." means Harbor accepted the credential.
  7. Click Next, select repositories and tags, and choose a connect option (fast, progressive or deep scan).

Webhooks and triggers

Scan on push is optional. Open the connection's edit dialog and expand Scan on push (optional) for the Webhook URL (https://api.safeguard.sh/scm/api/v1/registry-webhooks/harbor/<connection id>) and the Secret. In Harbor, open the project, then Webhooks > + New Webhook: Notify Type http, Event Type Artifact pushed, Endpoint URL the URL above, Auth Header the secret, and keep certificate verification on. Payload format Default or CloudEvents both work. Add one webhook per project.

Harbor sends the Auth Header in Authorization; Safeguard refuses deliveries without the matching secret. A pushed tag is scanned as the version <tag>-<first 12 characters of the digest>. Without a webhook, rescan on a schedule under Integrations > Scheduled.

What we read and store

  • Read: project names, repository names, artifacts with their tags, digests and push times, Harbor's scan summary and signature accessories, and the images you select for scanning.
  • Stored: the connection's settings, the SBOM and findings of each scanned image with its digest, and the credential, which is encrypted at rest and never shown again after you save it.
  • Not stored: image layers. The image is read for the scan and not kept. Harbor's own vulnerability reports are not imported as Safeguard findings.
  • No customer data from this integration is sent to third-party LLMs.

Troubleshooting

Message you seeCauseFix
Harbor rejected the credential. A robot account's username is robot$<name> (system robot) or robot$<project>+<name> (project robot), with its secret ...Wrong robot name or secret, a disabled or expired robot, or a user without its CLI secretCopy the full robot name, including robot$, and refresh its secret
The account <user> signed in but can see no projects. ...The robot covers no projectAdd the projects to the robot's permissions
The Harbor account cannot read <path> ... A project robot needs Repository: List and Pull and Artifact: Read and List on that project ...A permission is missingEdit the robot and tick the missing permissions
Harbor at <host> has no public projects. ...Public tab with no public projectMark a project Public, or use the Private tab
No Harbor v2 API at <url>. Check the URL (Harbor 2.0 or later).Wrong URL, or Harbor 1.xUse the address you sign in with; upgrade Harbor 1.x
The TLS certificate of <host> is not trusted ...A self-signed or private certificateServe Harbor with a certificate from a public certificate authority

Rotation and disconnect

  • Rotate: refresh the robot's secret (Robot Accounts > the robot > Refresh Secret), find the connection under Project Configurations on the Project/Product tab, choose Update, enter the new secret, verify and save.
  • Disconnect: choose Delete from the connection's menu under Project Configurations and confirm. Then delete the robot account and the project webhooks that point at Safeguard.

Vendor references

On this page