1
0
mirror of https://github.com/goharbor/harbor.git synced 2026-10-23 10:08:57 +03:00

563 Commits

Author SHA1 Message Date
stonezdj(Daojun Zhang)
1edae4acdb feat(task): aggregate execution error messages and surface task failure details (#24028)
- Record and bubble up failure error messages (including tail of job logs) in Jobservice
- Store status_message on failed task and aggregate task errors into execution status_message
- Expose status_message in swagger ReplicationTask definition and handler
- Display status_message tooltip on replication tasks and execution status in UI portal

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-10-16 05:21:50 +00:00
Max
37dc02fdff feat: custom project roles (hybrid — built-ins in code, custom in DB) (#23804)
* feat: custom project roles (hybrid — built-ins in code, custom in DB)

Adds admin-defined custom project roles as an alternative to #22815, per
maintainer feedback: built-in project roles keep resolving their permissions
from the compile-time rolePoliciesMap (no DB, no cache — identical to today),
and ONLY custom roles are stored in and loaded from the database. There is no
permission cache.

Backend + API only (UI ships separately). Highlights:
- RBAC (common/rbac/project): projectRBACRole gains an optional custom *role.Role.
  The built-in path is byte-identical to upstream; the role controller is
  consulted only for non-built-in role IDs, so built-in authorization incurs no
  DB lookup. Custom roles expand their DB-loaded permissions.
- Role subsystem: pkg/role (model/dao/manager) + controller/role for CRUD and
  persistence; existing role_permission/permission_policy reused for custom perms.
- REST API: /roles endpoints (sysadmin-gated), an effective-permissions endpoint,
  anti-escalation checks on member/robot assignment, and audit events.
- Migration 0191 adds is_builtin/description/audit columns to `role`, widens the
  name, enforces name uniqueness, and marks seeded roles built-in. Built-in
  permissions are NOT seeded into the DB.

Rebased onto current main; API bindings regenerated via gen_apis.

Tracking: #18124
Alternative to: #22815

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: make role a system RBAC resource; drop checkSysAdmin & ResourceSelf

Addresses stonezdj's review on PR #23804:
- Define rbac.ResourceRole (system-level) and add it to the system permission
  catalog; gate CreateRole/UpdateRole/DeleteRole with RequireSystemAccess(action,
  ResourceRole) instead of the hand-rolled checkSysAdmin — so the permission is
  managable while still effectively system-only.
- Remove the checkSysAdmin helper and its unit tests; update handler tests to
  mock Can().
- Drop ResourceSelf from the ScopeRole permission catalog.
- Remove tests/integration/.gitignore (per-dir ignore file).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: close built-in-role escalation gap; reject nil role payloads

Addresses Copilot findings on PR #23804:
- checkNoEscalation treated built-in roles as permissionless: it read permissions
  from role_permission, which has no rows for built-in roles, so a caller with
  member:create could assign projectAdmin (or any built-in) without holding its
  permissions. Built-in permissions are now synthesized from the compile-time
  policy map via the new rbac/project.BuiltinRolePolicies; custom roles still read
  the DB. Adds TestCheckNoEscalation_BuiltinRoleSynthesized.
- role validate() now rejects nil permission/access elements (permissions:[null],
  access:[null]) with 400 instead of panicking. Adds nil-payload tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: validate that a member's custom role exists in the database

Addresses stonezdj's review on PR #23804: isValidRole returned true for any
integer above the built-in range, so a member could be assigned a non-existent
custom role ID. The member controller now holds a role manager and validateRole
verifies custom role IDs (>5) exist via roleMgr.Get, rejecting unknown IDs with
ErrInvalidRole; built-in roles (1-5) still pass without a DB lookup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: make role Create/Update/Delete atomic via orm.WithTransaction

Addresses Copilot findings on PR #23804:
- Create: the role row and its permission records are now created in one
  transaction, so a failed permission insert no longer leaves a named role with
  missing permissions (whose unique name would block a clean retry).
- Update: the field update and the delete+recreate of permissions run in one
  transaction, so the role's authorization is never observable in a partial state.
- Delete: the member-assignment guard and the role/permission deletes run in one
  transaction, serializing the guard with the delete and ensuring permission rows
  never outlive the role. (Full prevention of a concurrent assignment needs a
  DB-level FK on project_member.role — tracked as a follow-up.)

Controller unit tests inject a fake ormer (testing/lib/orm) so the transaction
wrappers resolve an ormer from context.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: group /roles/{role_id} right after /roles in swagger

Addresses stonezdj's review on PR #23804: the two role endpoints serve the same
feature and should be adjacent in the spec.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: split out role audit-log events; drop the standalone integration test

Addresses stonezdj's review on PR #23804 (shrink the PR):
- Remove the role audit-log event wiring from this PR (controller/event
  metadata/role.go, topic.go role topics/events, init.go subscriptions, and the
  notification.AddEvent calls in the role controller). It will be submitted as a
  separate follow-up PR; the code is preserved on branch 18124-role-audit-events.
- Remove tests/integration/test_custom_roles.py: it is not wired into Harbor CI
  (which uses tests/apitests) and contained the issues Copilot flagged. Feature
  behavior is covered by the Go unit tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: validate role on member UpdateRole; fix stale invalid-role message

Addresses stonezdj's follow-up review on PR #23804:
- UpdateRole (changing a member's role) now runs the same validateRole check as
  AddProjectMember, so a member can't be moved to a non-existent role.
- ErrInvalidRole no longer claims "role is not in 1,2,3"; it now states the role
  must be a built-in role (1-5) or an existing custom role.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: remove duplicate effective-permissions endpoint

Addresses stonezdj's review on PR #23804: GET /projects/{id}/permissions/effective
duplicated the existing GET /users/current/permissions, which already supports a
project scope and a `relative` flag (scope=/project/{id}&relative=true returns the
same set of project permissions the caller holds). Removed the handler and the
swagger path (bindings regenerated). The shared mapRobotToHumanResource helper is
kept — it is still used by the robot anti-escalation check.

The robot-account UI (separate PR) will use /users/current/permissions instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* fix(rbac): keep role management sysadmin-only, not delegable

Role write access is checked via RequireSystemAccess(ctx, action,
rbac.ResourceRole), but ResourceRole was also added to the grantable
ScopeSystem catalog (NolimitProvider). That published role:* as an
assignable system permission: it could be granted to a system robot
(robots evaluate system-scope policies) and listed in /permissions,
even though a human non-admin never evaluates system-scope perms.

A system robot granted role:update could then rewrite any custom
role's permission set (UpdateRole/updateV2Role has no subset guard)
= privilege escalation.

Remove the ResourceRole entries from the ScopeSystem catalog. The
admin evaluator bypasses the catalog, so sysadmins still pass the
RequireSystemAccess check and manage roles exactly as before, but
role:* is no longer assignable/enumerable to non-admins. This keeps
role management strictly sysadmin-only while still expressing it as
a first-class action+resource check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* fix(rbac): grant custom-role members baseline self:read (project visibility)

self:read (ResourceSelf) is the permission that gates viewing a project:
RequireProjectAccess(ctx, id, ActionRead) with no subresource checks
<project-ns>:"" and GetProject/GetSummary use exactly that. Built-in
roles carry self:read in rolePoliciesMap, and public projects grant it
via publicProjectPolicies, but a custom role in a private project had no
way to obtain it -- self:* is intentionally excluded from the ScopeRole
catalog, and GetPolicies returned only the role's explicit permissions.

Result: a member whose only access to a private project was a custom
role got a 403 opening that project.

Append {ResourceSelf, ActionRead} to the custom-role branch of
projectRBACRole.GetPolicies (de-duplicated), mirroring the built-in
roles and the public-project baseline. Only self:read is granted, never
self:update/self:delete (project edit/delete stay exclusive to the
projectAdmin built-in), and self:* remains out of the user-facing
catalog so it is guaranteed by the system rather than a tickable option.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* refactor(rbac): grant self:read at membership level, not per custom role

Move the baseline project-visibility grant out of the custom-role branch
of projectRBACRole.GetPolicies and into rbacUser.GetPolicies: any user
who holds at least one role in a project (len(projectRoles) > 0) is
granted self:read on that project.

This makes baseline visibility a property of project membership rather
than a per-custom-role special case, sitting beside the existing
public-project baseline (getPoliciesForPublicProject) and using the same
eval-time idiom -- no permission data seeded into the database. Built-in
and custom roles now obtain self:read the same way, and the grant stays
scoped to the membership project (ListRoles is per-project), so it never
exposes projects the user is not a member of.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* chore(deps-dev): bump webpack-cli from 4.10.0 to 7.2.3 in /src/portal/app-swagger-ui (#23850)

chore(deps-dev): bump webpack-cli in /src/portal/app-swagger-ui

Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.10.0 to 7.2.3.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.10.0...webpack-cli@7.2.3)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-version: 7.2.3
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prasanth Baskar <prasanth@8gears.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: consolidate 2.16.0 migration into 0190 and simplify robot resource map

Address two review comments from stonezdj on PR #23804:

- 2.16.0 is not released yet, so keep all its schema changes in a single
  migration file. Move the custom-role `role` table additions (columns,
  name widened to varchar(255), uq_role_name unique index, is_builtin
  update) from 0191 into 0190 and delete 0191.

- Simplify mapRobotToHumanResource: replace the single-entry
  robotToHumanResourceMap + lookup with a direct
  `if r == rbac.ResourceProject { return rbac.ResourceSelf }`.

Also commit the cross-project isolation test for the membership-level
self:read baseline (a member of one private project cannot read another).

No behavior change; robot resource-mapping tests pass unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: fix bugs from bupd's review (keep roles global + sysadmin-only)

Address the correctness findings from bupd's review of PR #23804, keeping
the global, sysadmin-managed role model (project-scoped roles remain a
separate future feature):

- evaluator: a failed custom-role load no longer drops the whole rbacUser.
  Returning nil stripped every role the member held in the project (built-ins
  included), turning a transient DB error or a dangling project_member.role
  into a total 403 / permanent lockout. Skip only the failing role instead.
- role validate(): reject any permission Effect other than "" or "allow".
  It was stored verbatim and handed to casbin, so a mis-cased "Allow" or a
  bogus value was accepted and silently granted nothing.
- read path: GET /roles(/{id}) now returns a built-in role's real permissions
  (resolved from rolePoliciesMap via BuiltinRolePolicies) instead of an empty
  set; built-ins have no role_permission rows by design. Removed the dead
  "Visible" list filter (model.Role has no such field).
- controller Delete: a custom role with no permission rows is deletable again
  (DeletePermissionsByRole's NotFound no longer rolls back the txn); dropped
  the unused variadic option parameter.
- controller Update: persist a role name change instead of silently dropping
  it (validated in the handler; DB unique index rejects collisions).
- permissions.go: restore the sysadmin-or-project-admin gate on GET
  /permissions (it had been relaxed to any authenticated user), and expose the
  role-level catalog only to sysadmins.
- rolePoliciesMap["projectAdmin"]: add metadata:list, restoring 2.15 behavior
  where a project admin can create a robot with metadata:list (the new robot
  anti-escalation check validated against projectAdmin, which lacked it).
- swagger: document that role reads are open to any authenticated user while
  writes are sysadmin-only.
- add a drift-guard test asserting the ScopeRole catalog equals projectAdmin
  minus self:{read,update,delete}, plus tests for the fixes above.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: make role name uniqueness case-insensitive

Per bupd's review: enforce uniqueness on lower(name) so "Maintainer" and
"maintainer" cannot coexist and be confused for one another. 2.16.0 is
unreleased, so the index is dropped and recreated in place.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* fix(role): correct stale TestList assertion (roles have no "visible" concept)

TestDaoTestSuite/TestList asserted that a freshly created role is NOT
returned by List (len == 0), a leftover from a removed "visible" column.
model.Role has no such field and the List DAO applies no visibility
filter, so the role is returned. Assert it is listed (len == 1) to match
the actual, intended behavior. Surfaced now that UTTEST runs on the PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

* review: robot-refresh escalation, deny-effect guard, delete-race FK, swagger 409/412

Address chlins' and Copilot's review of PR #23804:

- RefreshSec escalation (chlins #1): refreshing a robot's secret is
  equivalent to being granted the robot's permissions, so it now runs the
  same no-escalation check as create/update (load the robot with
  permissions; human callers checked via validateNoEscalation, robot
  callers via isValidPermissionScope). A member with robot:update but not
  the robot's own permissions can no longer take over a more-privileged
  robot.
- Deny-effect guard (chlins #2): member checkNoEscalation now skips
  Effect==deny accesses; they restrict rather than grant, so requiring the
  caller to hold them wrongly blocked assigning a role that merely denies
  something.
- Delete-vs-assign race (chlins #3): add FK project_member.role ->
  role(role_id) ON DELETE RESTRICT so the DB atomically rejects deleting an
  assigned role, closing the count-then-delete race; the resulting FK error
  is mapped to 412 in the role Delete controller.
- Swagger: document 409 (CreateRole duplicate-name conflict) and 412
  (DeleteRole still-assigned) responses.
- Tests: FK-race delete -> 412, and a Create failure-injection so dropping
  the transaction would fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>

---------

Signed-off-by: Max Grau Stenzel <max.grau.stenzel@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prasanth Baskar <prasanth@8gears.com>
2026-09-29 19:51:23 +08:00
Yannick Müller
de749f4e50 feat: Expose retention setting during proxy-cache project creation (#23863)
* feat: Expose retention setting during proxy-cache project creation

Signed-off-by: Yannick Müller <mail@ynnk.dev>

* refactor: remove unattached retention policy logic from project creation

Remove unattached retention policy handling and metadata.retention_id logic
from swagger.yaml and project creation handler.

Signed-off-by: stonezdj <stonezdj@gmail.com>

---------

Signed-off-by: Yannick Müller <mail@ynnk.dev>
Signed-off-by: stonezdj <stonezdj@gmail.com>
Co-authored-by: stonezdj <stonezdj@gmail.com>
2026-09-16 15:41:22 +08:00
Ikram ALOUI
c3ec2b133e fix: implement signature inheritance for OCI index children (#23540)
* fix: implement cosign signature inheritance for OCI index children

When a multi-arch OCI index is signed with cosign, its per-arch child
artifacts have no accessory of their own, so the UI shows them as
unsigned. Populate InheritedAccessories from the parent index's cosign
signature (display only, never used in copy/delete/walk) and surface it
in ListAccessories when the query filters for signature.cosign.

Ported from container-registry/harbor-next#27.

Signed-off-by: aloui ikram <ikram@container-registry.com>

* refactor: expose inherited cosign signatures as a separate API field

Rework the OCI index signature inheritance so that the accessory list
stays faithful to registry content. The parent's signature is no longer
merged into ListAccessories for a child digest; instead the already
computed InheritedAccessories is exposed as a new, explicit
inherited_accessories field on the artifact get and list endpoints.

The inherited entries keep the parent index as their subject digest, so
they remain distinguishable from a direct signature: cosign verify
against the child digest still fails, and the referrers API still does
not list them for that digest. Responses that do not ask for the field
are unchanged.

Resolving the field costs a reference lookup per artifact, so it is
opt-in behind a new with_inherited_accessory query parameter, and an
artifact that no index references short-circuits after a single indexed
lookup. with_accessory could not serve as the gate because it defaults
to true and is also set on the copy path.

The Portal reads the new field and renders a distinct icon with a
tooltip, and now fetches the child accessories inline with the artifact
instead of issuing one extra request per child.

Signed-off-by: aloui ikram <ikram@container-registry.com>

* feat: extend signature inheritance to notation

The inheritance introduced for cosign applies equally to notation. Like
cosign, notation signs a single digest and has no flag to descend into
the children of an index, so a notation-signed index leaves its children
carrying no signature of their own. The Portal already treats both kinds
as signed, so handling only cosign meant a notation-signed index still
showed every one of its children as unsigned.

Inherit both signature types, both when collecting the parent's
accessories and in the check that skips artifacts already signed in
their own right. That second place matters on its own: a child with its
own notation signature under a cosign-signed index was not recognised as
directly signed, and so was given an inherited entry, contradicting the
documented meaning of the field. Accessory kinds that are not signatures
stay excluded, since an SBOM or an accelerator on an index says nothing
about the children of that index.

Take the inherited icon colour from the Clarity neutral status token
rather than a literal, so that it follows the light and dark themes
instead of remaining darker than the text beside it in dark mode.

Signed-off-by: aloui ikram <ikram@container-registry.com>

---------

Signed-off-by: aloui ikram <ikram@container-registry.com>
Co-authored-by: aloui ikram <ikram@container-registry.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-08-10 07:15:45 +00:00
stonezdj(Daojun Zhang)
266aad1eca feat(backend): implement proxy cache repository filter API (#23527)
Introduce repository filter pattern and kind on proxy cache projects
to explicitly allow selected repositories. Requests that do not match the
filter are denied before Harbor proxies content from upstream.

Fixes #13231

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-08-07 06:20:05 +00:00
Wang Yan
95ed8f0eda fix: convert robot account ID columns and sequence to bigint (#23633)
* fix(robot): convert robot account ID columns and sequence to bigint (#23091)

Convert robot.id, creator_ref, role_permission.role_id, and robot_id_seq
to bigint in PostgreSQL migration and update swagger.yaml parameters to
format: int64.

The sequence is capped at 9007199254740991 (2^53 - 1, JavaScript's
Number.MAX_SAFE_INTEGER) instead of the bigint maximum, so every possible
robot ID stays exactly representable as a JSON number for clients that
decode into IEEE 754 doubles (portal, jq, generated JS clients). This
still provides ~4 million times the int4 range.

Unmarshaling extra_attrs using json.Decoder.UseNumber() and helper
task.Int64FromAny ensures numeric IDs above 2^53 (e.g. execution or
artifact IDs of other vendors) do not lose precision during scan task
callbacks and data exports.

Fixes: #23091
Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* resovle the review comments

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

---------

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
2026-08-06 08:53:06 +00:00
Patrick Eschenbach
abc41cc9eb Fix/api completeness (#23476)
* docs(api): fix 15 swagger gaps — descriptions, responses, lint rules

- Add missing description/summary to deleteProjectMember,
  UpdateImmuRule, DeleteImmuRule, listUsers, getCurrentUserInfo,
  getUser, updateUserProfile, setUserSysAdmin,
  getCurrentUserPermissions, listSchedules, getSchedulePaused
- Add accurate error responses traced to handler code:
  404 on member/immutable ops (RequireProjectAccess paths),
  403+500 on listAuditLogEventTypes (RequireSystemAccess),
  412 on getCurrentUserInfo (non-local security context),
  400 on listSchedules/getSchedulePaused/updateUserProfile,
  401+500 on getRentenitionMetadata (Prepare middleware),
  500 on pingOIDC
- Remove inaccurate responses: 404 from getSchedulePaused/
  listSchedules/updateUserProfile; 403 from getSchedulePaused;
  500 from getCurrentUserPermissions (in-memory only)
- Fix inline 500/401 descriptions in setUserSysAdmin and
  getCurrentUserPermissions to use shared  definitions
- Add operation-description and operation-summary-required rules
  to .spectral.yaml to prevent regression

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* chore: complete swagger changes for harbor-cli well known issues

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* docs(api): restore response codes removed in error from schedules and user endpoints

- Restore 404 on listSchedules (GET /schedules)
- Restore 403 and 404 on getSchedulePaused (GET /schedules/{job_type}/paused)
- Restore 404 on updateUserProfile (PUT /users/{id})
- Restore 500 on getCurrentUserPermissions (GET /users/current/permissions)

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* fix: clean up binaries

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* fix: add needed statements for spectral linting and api tests

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* fix: add changes for unsupported entity; more clear description

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Patrick Eschenbach <45457307+qcserestipy@users.noreply.github.com>

* fix: add changes for unsupported entity; more clear description

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Patrick Eschenbach <45457307+qcserestipy@users.noreply.github.com>

* fix: add changes for unsupported entity; more clear description

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>

---------

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
Signed-off-by: Patrick Eschenbach <45457307+qcserestipy@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-02 23:42:39 +00:00
stonezdj(Daojun Zhang)
914738c3f1 Update artifact_accessory to add source column to identify accessory (#23144)
Add project_metadata config item proxy_referrer_api
   Rename getRemoteRepo to GetRemoteRepo

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-04-24 08:11:28 +00:00
stonezdj(Daojun Zhang)
63618e8a9f Add UI option to enable proxy cache referrer API (#23151)
Add UI option to enable proxy cache referrer API (#22767)

Expose the proxy_referrer_api setting in the portal for proxy-cache
projects (create project and policy configuration), with i18n strings.

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-04-24 14:54:26 +08:00
stonezdj(Daojun Zhang)
8a610a3470 Fix issue related to scanner API (#23061)
Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-04-14 06:48:34 +00:00
Aymeric
3d45be3d03 fix: proxy cache serve local on remote not found (#22153)
* fix: proxy cache serve local on remote not found

Signed-off-by: AYDEV-FR <aymeric.deliencourt@aydev.fr>

* tests: fix proxy controller test

Signed-off-by: AYDEV-FR <aymeric.deliencourt@aydev.fr>

* Update src/controller/proxy/controller.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Vadim Bauer <Bauer.vadim@gmail.com>

* feat: add ui

Signed-off-by: AYDEV-FR <aymeric.deliencourt@aydev.fr>

* chore: add checkbox in creation project modal

Signed-off-by: AYDEV-FR <aymeric.deliencourt@aydev.fr>

* chore: fix tooltip text

Signed-off-by: AYDEV-FR <aymeric.deliencourt@aydev.fr>

---------

Signed-off-by: AYDEV-FR <aymeric.deliencourt@aydev.fr>
Signed-off-by: Vadim Bauer <Bauer.vadim@gmail.com>
Co-authored-by: Vadim Bauer <Bauer.vadim@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-10 07:02:06 +00:00
Matteo Limardo
ba13f6c6cb Swagger Replication Rule invalid JSON (#22724)
* Swagger Replication Rule invalid JSON

The 'type' field in ReplicationFilter schema caused JSON serialization issues
because swagger codegen generates it as a required string field, but the actual
value is interface{} which can be string, []string, or other types depending on
the filter type.

Removing the 'type' field from the schema fixes serialization while maintaining
backward compatibility, as the field wasn't documented or used by clients.

Changes:
- Remove 'type' from ReplicationFilter schema in swagger.yaml
- Simplify filter conversion logic in handler
- Add validation to skip invalid filters
- Add comprehensive tests for filter handling

Signed-off-by: Matteo Limardo <mlimardo@mirantis.com>

remove converFilterValue func

Signed-off-by: Matteo Limardo <mlimardo@mirantis.com>

* Update api/v2.0/swagger.yaml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Vadim Bauer <Bauer.vadim@gmail.com>

---------

Signed-off-by: Matteo Limardo <mlimardo@mirantis.com>
Signed-off-by: Vadim Bauer <Bauer.vadim@gmail.com>
Co-authored-by: Vadim Bauer <Bauer.vadim@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-11 10:12:34 +00:00
Vadim Bauer
de33aaab07 fix: correct multiline string in yaml (#22809)
Signed-off-by: Vadim Bauer <vb@container-registry.com>
2026-02-03 21:15:04 +08:00
stonezdj(Daojun Zhang)
3f25cd5ef3 Revert UI change in proxy cache referrer API (#22780)
Revert "Add UI option to enable proxy cache referrer API (#22767)"

This reverts commit 369148e3b6.

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-01-27 08:49:01 +00:00
stonezdj(Daojun Zhang)
30ba1b3cd3 Proxy the referrer's API to upstream registry (#22746)
Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-01-26 08:00:54 +00:00
stonezdj(Daojun Zhang)
369148e3b6 Add UI option to enable proxy cache referrer API (#22767)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-01-23 09:09:00 +00:00
Wang Yan
34affcbec8 update swagger file for creating tag (#22754)
fix #22582

Harbor doesn't support for creating a immutable tag. Updates the swagger to limit name field only for tag creation.
There is no breaking change.

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Co-authored-by: wang yan <yan-yw.wang@broadcom.com>
2026-01-21 19:20:05 +08:00
Wang Yan
7f5ac5b57b add per-endpoint CA certificate support for registry endpoints (#22535)
* add per-endpoint CA certificate support for registry endpoints

fixes #22203

Allowing Harbor to trust self-signed or private CA certificates for individual registry endpoints without modifying the system-level trust store.

1. Database schema changes, API updates with PEM validation.
2. HTTP transport layer modifications across all the registry adapters.
3. UI field to fill in the certificate.

The feature is backward compatible - existing installations using system-level CA trust will continue to work without any changes.

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* resolve lint failures

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* add i18n changes

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* resolve review comments

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* make the input as non-required and updates i18n

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* resolve comments

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

---------

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Co-authored-by: wang yan <yan-yw.wang@broadcom.com>
2026-01-13 17:10:22 +08:00
stonezdj(Daojun Zhang)
c004f2d3e6 Add max_upstream_conn parameter for each proxy_cache project (#22348)
limit the proxy connection to upstream registry

Signed-off-by: stonezdj <stonezdj@gmail.com>
2025-09-30 10:27:10 +00:00
Prasanth Baskar
221037378a feat: Single Active Replication (#21347)
feat(replication): add Single Active Replication per policy

* Added single_active_replication field to schema & DB table
* Updated API, controller & handler to enforce single execution per policy
* Added checkbox in UI to enable/disable single_active_replication for a
  policy
* Implemented necessary backend & frontend tests
* Prevents parallel runs per policy if single_active_replication is enabled

Signed-off-by: bupd <bupdprasanth@gmail.com>
2025-08-11 18:02:56 +08:00
stonezdj(Daojun Zhang)
171d9b4c0e Add HTTP 409 error when creating robot account (#22201)
fixes #22107

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2025-07-29 10:03:00 +00:00
Daniel Jiang
440f53ebbc Add status field to the API on secyurityHub (#22182)
This commit makes change to the API GET /api/v2.0/vul to make it include
"status" of CVEs in the response.

It also makes update in the UI to add the "Status" column to the data
grids in security hub and artifact details page.

Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com>
2025-07-18 16:02:29 +08:00
yuzhipeng
c93da7ff4b Add 400 code response in swagger.yaml for updateRegistry updateReplicationPolicy and headProject (#22165)
Signed-off-by: yuzhipeng <yuzp1996@gmail.com>
2025-07-14 14:26:12 +08:00
Wang Yan
5960bc8fb2 oidclogout (#21718)
* oidclogout

enable oidc session logout

1, give the option of logging out user session from OIDC provider.
2, try best to log out the user offline session if the offline_access in the scope.

Signed-off-by: wang yan <wangyan@vmware.com>
2025-03-18 11:52:35 +08:00
Chlins Zhang
d9e71f9dfc feat: implement the CNAI model processor (#21663)
feat: implement the AI model processor

Signed-off-by: chlins <chlins.zhang@gmail.com>
2025-03-13 02:04:45 +00:00
stonezdj(Daojun Zhang)
45659070b7 Update purge audit to purge both audit_log_ext and audit_log (#21608)
Fix integration issue with UI

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2025-02-18 09:45:46 +00:00
stonezdj(Daojun Zhang)
4d5bc19866 Implement audit log ext API (#21414)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2025-01-16 09:23:25 +00:00
Wang Yan
2140a283bf remove with_signature (#21420)
Signed-off-by: wang yan <wangyan@vmware.com>
2025-01-16 05:51:07 +00:00
Samuel Gaist
15d17a3338 Remove robotV1 from code base (#20958) (#20991)
It was deprecated in 2.4.0.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
Co-authored-by: Wang Yan <wangyan@vmware.com>
2025-01-10 13:36:28 +08:00
stonezdj(Daojun Zhang)
b0c74a0584 Add swagger api and audit_log_ext table model (#21360)
add auditlog-ext related api in swagger
  add audit_log_ext table

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2025-01-03 06:11:09 +00:00
Chlins Zhang
a548ab705f feat: extend the p2p preheat policy (#21115)
Add the field extra_attrs to the p2p preheat policy for the provider to
define their specified parameters when preheating.

Signed-off-by: chlins <chlins.zhang@gmail.com>
2024-12-18 10:30:36 +08:00
Chlins Zhang
c97253f660 Refactor: p2p preheat dragonfly driver (#20922) 2024-09-21 11:05:01 +08:00
Wang Yan
438d4c03bb update robot creator database scheme (#20918)
Signed-off-by: wang yan <wangyan@vmware.com>
2024-09-14 12:49:32 +08:00
Wang Yan
51eeb098ef add creator for robot (#20846)
* add creator for robot

add the creator for robot creation

Signed-off-by: wang yan <wangyan@vmware.com>

* resolve comments

Signed-off-by: wang yan <wangyan@vmware.com>

* fix ut

Signed-off-by: wang yan <wangyan@vmware.com>

---------

Signed-off-by: wang yan <wangyan@vmware.com>
2024-08-15 14:43:19 +08:00
Johan Kok
907709ff6d Fix typo in Swagger API docs (#20841)
Signed-off-by: Johan Kok <post@johankok.nl>
2024-08-13 16:31:10 +08:00
stonezdj(Daojun Zhang)
eb5193e0ef Parallel attach ldap group (#20705)
Parallel attach LDAP group

  Add configure LDAP group attach parallel UI
  Change the /c/login timeout from 60 (nginx default) to 900 seconds in nginx.conf

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2024-08-09 15:24:25 +08:00
Shengwen YU
1f75b7aaef feat: implement bandwidth limit for proxy-cache (#20812)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2024-08-08 19:02:54 +08:00
Wang Yan
b7f1b59495 add list project arifacts API (#20803)
* add list project arifacts API

This API supports listing all artifacts belonging to a specified project. It also allows fetching the latest artifact
in each repositry, with the option to filter by either media_type or artifact_type.

Signed-off-by: wang yan <wangyan@vmware.com>

* resolve the comments

Signed-off-by: wang yan <wangyan@vmware.com>

---------

Signed-off-by: wang yan <wangyan@vmware.com>
2024-08-06 18:29:13 +08:00
stonezdj(Daojun Zhang)
ec8d692fe6 Add scanner info and report_id to sbom_overview on listing artifact (#20358)
Add scan_status and report_id when scan has a failed task

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2024-04-25 17:00:35 +08:00
stonezdj(Daojun Zhang)
c80e9bf477 Add 422 in the swagger.yaml (#20344)
change log level with no content message
  fix time in sbom accessory
  fixes #20342 #20332 #20328

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2024-04-24 09:57:46 +08:00
stonezdj(Daojun Zhang)
fb2e0042d0 Rename scan request type (#20288)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2024-04-17 09:52:50 +00:00
stonezdj(Daojun Zhang)
654aa8edcf Add generate SBOM feature (#20251)
* Add SBOM scan feature

  Add scan handler for sbom
  Delete previous sbom accessory before the job service

Signed-off-by: stonezdj <daojunz@vmware.com>

* fix issue

Signed-off-by: stonezdj <stone.zhang@broadcom.com>

---------

Signed-off-by: stonezdj <daojunz@vmware.com>
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
2024-04-16 13:34:19 +00:00
Wang Yan
461a5fa50d add stop sbom scanning API (#20200)
* add stop sbom scanning API

1. [UI] support to stop sbom scanning #20200
2. add type for stop scanning api, make it able to support both vulnerability and sbom.
3. refactor the db query to support multiple extra attributes.

Signed-off-by: wang yan <wangyan@vmware.com>
Signed-off-by: xuelichao <xuel@vmware.com>
Co-authored-by: xuelichao <xuel@vmware.com>
2024-04-09 16:07:47 +08:00
Shengwen YU
c8370faeeb fix: test robot account permission (#20240)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2024-04-08 12:57:38 +08:00
stonezdj(Daojun Zhang)
dd76fe47ce Add SBOM scan REST API (#20215)
Update swagger API for generate SBOM

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
2024-04-03 08:38:09 +00:00
Wang Yan
2eb5464603 add type for scanner metadata (#20108)
Signed-off-by: wang yan <wangyan@vmware.com>
2024-03-25 07:02:39 +00:00
jm-nab
8bec57ffd4 Update swagger.yaml bad request permission: helm-chart:read (#20094)
* Update swagger.yaml

Signed-off-by: jm-nab <146757414+jm-nab@users.noreply.github.com>

* Update swagger.yaml

reference the rbac/const.go source code

Signed-off-by: jm-nab <146757414+jm-nab@users.noreply.github.com>

---------

Signed-off-by: jm-nab <146757414+jm-nab@users.noreply.github.com>
2024-03-12 03:00:42 +00:00
Shengwen YU
d88a32089a feat: add auto_sbom_generation for SBOM auto generation on pushing a … (#19869)
feat: add auto_sbom_generation for SBOM auto generation on pushing a subject artifact

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2024-01-24 14:13:46 +08:00
Yang Jiao
eb125419cc Add verification that robot account duration is not 0 (#19829)
Signed-off-by: Yang Jiao <yang.jiao@broadcom.com>
2024-01-15 13:25:56 +08:00
Blueswen
0d157f2254 Fix OpenAPI Specification structural error (#19782)
Fix structural error

Signed-off-by: Blueswen <blueswen.tw@gmail.com>
2024-01-03 18:16:27 +08:00