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

1309 Commits

Author SHA1 Message Date
Prasanth Baskar
4e07c69cbd chore(deps): bump up Go version to v1.27.3 (#24188)
Fixes GO-2026-6809: crypto/x509 now distrusts compromised intermediate
certificates. Affects go1.27.2, fixed in go1.27.3.

Signed-off-by: Prasanth Baskar <prasanth@8gears.com>
2026-10-21 14:28:50 +05:30
stonezdj(Daojun Zhang)
2b982d21c0 test(robot): expect inherited signature for unsigned index child in r… (#24026)
test(robot): expect inherited signature for unsigned index child in replication event test

Commit c3ec2b133e introduced signature inheritance for OCI index children (#23540),
marking unsigned child artifacts under a signed index with the 'signed-inherited' status
in the Portal UI instead of 'color-red' (unsigned).

In 'Test Case - Replication Triggered By Events', image2 (busybox) under the signed
index was asserted with 'Should Not Be Signed', which looked for 'color-red' icon and
failed. Add 'Should Be Inherited Signed' keyword and update the test case to assert
the inherited signature state on image2 under the signed index.

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-10-16 08:52:27 +00:00
stonezdj(Daojun Zhang)
20f8af029b test(robot): update guest member radio button locator (#24154)
Update guest radio checkbox xpath locator in Project-Members_Elements.robot to match the current DOM structure.

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-10-16 07:56:40 +00:00
stonezdj(Daojun Zhang)
502a51bdec feat(replication): separate event-triggered replication into dedicate… (#24138)
feat(replication): separate event-triggered replication into dedicated queue

Separate replication tasks generated by event-based executions into
a dedicated EVENT_REPLICATION queue in JobService with higher priority
to prevent head-of-line blocking by bulk manual or scheduled replication.

Signed-off-by: stonezdj <stonezdj@gmail.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-10-15 09:55:45 +00:00
stonezdj(Daojun Zhang)
2c94d4e213 bump: bump up Go version to v1.27.2 (#24119)
Update Go version from 1.26.4 to 1.27.2 across makefiles, configuration, CI workflows, and documentation.

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-10-12 06:28:24 +00:00
stonezdj(Daojun Zhang)
4d425b805f bump: bump up Go version to v1.26.9 (#24120)
Update Go version from 1.26.4 to 1.26.9 across makefiles, configuration, CI workflows, and documentation.

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-10-09 16:42:09 +08: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
stonezdj(Daojun Zhang)
d3e2ad0a39 fix(test): update expected CVE export toast message in Robot test (#24010)
Commit ed449fbfc0 updated the English translation for TRIGGER_EXPORT_SUCCESS
from 'Trigger exporting CVEs successfully!' to 'Triggered exporting CVEs successfully!'.
Update the Robot test keyword 'Export CVEs' to expect the updated message.

Signed-off-by: stonezdj <stonezdj@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-28 12:40:57 +00:00
stonezdj(Daojun Zhang)
ba6e562714 test(apitests): add missing get_member_role_id to project helper (#23997)
Add `get_member_role_id` method to `Project` helper class in Python API tests
to resolve AttributeError in member audit log forward test.

Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-09-28 11:16:27 +08:00
jUDASmILE
ab9e0805a4 fix: correct grammar, formatting, and non-actionable error messages (#23974)
Fix misspellings, grammatical errors, and formatting defects in
user-facing strings across API error responses, middleware, core,
and the portal English i18n.

Signed-off-by: jUDASmILE <judasmile@gmail.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-09-22 13:23:19 +08:00
jUDASmILE
3a949807e4 refactor: sanitize connection details in logs and enhance error message formatting (#23878)
* continue enhance log sanitation

Signed-off-by: jUDASmILE <judasmile@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* continue enhance log sanitation

Signed-off-by: jUDASmILE <judasmile@gmail.com>
Signed-off-by: jUDASmILE <36983889+jUDASmILE@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Signed-off-by: jUDASmILE <judasmile@gmail.com>
Signed-off-by: jUDASmILE <36983889+jUDASmILE@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 03:19:31 +00:00
Maksym Trofimenko
159f151d51 Fix. Return 404 when artefacts are requested for the non-existing repository. (#17618)
fix: 404 for artifacts requested for repository which does not exist
Fixes #17443

Signed-off-by: Maksym Trofimenko <maksym@container-registry.com>
2026-09-10 00:32:23 +00:00
Yannick Müller
fb4e240674 fix: system_cve testcase failing at end of month (#23661)
Signed-off-by: Yannick Müller <mail@ynnk.dev>
Co-authored-by: Orlix <7236111+OrlinVasilev@users.noreply.github.com>
2026-09-01 05:14:46 +00:00
fiona-xie
617cf74492 test(api): enhance stability of test_copy_disability in tag immutability (#23774)
Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
2026-08-24 07:46:01 +00:00
fiona-xie
f58e5664ca test: optimize proxy cache filter UI test with dynamic polling mechansim and cleanup local images before pulling (#23754)
test: optimize proxy cache filter UI test with dynamic polling mechansim

Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-08-24 03:01:26 +00:00
fiona-xie
837866a45a test: add api and ui integration tests for proxy cache repository filter (#23744)
- Added `do_validate_proxy_cache_filter` in `test_proxy_cache.py` to verify API pattern validation, doublestar, and regex filtering.
- Added `Test Case - Proxy Cache Filter` in `Schedule.robot` to verify the end-to-end configuration and pull restrictions via portal.
- Ensured container image cache is properly pruned before pulling to prevent false-positive cache hits.

Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
2026-08-18 06:31:14 +00:00
Ikram ALOUI
ee315015ad test: add API test for signature inheritance on OCI index children (#23707)
Covers the inherited_accessories field added in #23540. The test signs an
index with cosign and with notation, then checks that a child of that index
reports both signatures as inherited with the index digest as their subject,
while owning no accessory of its own and returning nothing extra on a request
that does not ask for them.

notation cert generate-test refuses to overwrite an existing key, so
generate_cert takes a common name and this test uses one of its own instead of
colliding with test_notation_sign_artifact.py in the same suite.

Signed-off-by: Ikram Aloui <ikram@container-registry.com>
Co-authored-by: Ikram Aloui <ikram@container-registry.com>
Co-authored-by: Prasanth Baskar <prasanth@8gears.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-08-17 06:50:41 +00:00
stonezdj(Daojun Zhang)
11a9a0c45b Exclude replication from dockerhub in github action (#23713)
Previously dockerhub allow annonymous user to list the repository and the replication test in PR is using empty username password to create registry in Harbor, but recently it return 403 for this API.
https://hub.docker.com/v2/repositories/library/?page_size=100 will return 403 error

Exclude replic_dockerhub in the github action, it is already covered in the nightly test.

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-08-12 17:06:02 +08:00
Aditya
a0bacace64 test: add UI e2e test for per-endpoint CA certificate setting (#23556)
Adds a nightly UI e2e test verifying that a registry endpoint using a
self-signed certificate can be pinged successfully with 'Verify Remote
Cert' enabled, as long as a matching per-endpoint CA certificate is
supplied — and that it fails when the CA certificate doesn't match.

Verified locally end-to-end against a real Harbor instance using the
harbor-e2e-engine test container.

Closes #22880

Signed-off-by: Aditya <amanssm221@gmail.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-07-16 09:35:23 +00:00
Vadim Bauer
7612d772b1 ci: migrate all GitHub workflows to CNCF-hosted runners (#23545)
* ci: migrate all GitHub workflows to CNCF-hosted runners

Replace the Oracle self-hosted labels and the GitHub-hosted defaults with
the CNCF runner pool:

  oracle-vm-24cpu-96gb-x86-64 -> cncf-ubuntu-16-64-x86
  ubuntu-latest               -> cncf-ubuntu-16-64-x86
  ubuntu-24.04-arm            -> cncf-ubuntu-16-64-arm

The arm64 leg of the BUILD_PACKAGE matrix keeps building natively, now on
cncf-ubuntu-16-64-arm.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

* ci: run pass-CI no-op stubs on the smallest CNCF runner

The pass-CI jobs only exist to satisfy required status checks on skipped
paths and execute nothing, so cncf-ubuntu-2-8-x86 is sufficient.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

* ci: fix silently-disabled Go caching and cache CI Go tools

actions/setup-go ran before actions/checkout, so it looked for go.sum in an
empty workspace and logged:

  Restore cache failed: Dependencies file is not found in
  /home/ubuntu/_work/harbor/harbor. Supported file pattern: go.sum

With cache: true (the v5 default) this silently no-ops, so GOMODCACHE and
GOCACHE were cold on every job of every run. Checkout now runs first, and
cache-dependency-path points at src/go.sum under the checkout path.

Also cache $GOPATH/bin and only build the three CI tools and golangci-lint
when they are missing, instead of recompiling them from source every run.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

* fix(make): resolve Go tool paths against the first GOPATH entry

CI sets GOPATH to a colon-separated list (go env GOPATH plus the workspace),
so $(shell go env GOPATH)/bin/golangci-lint expanded to the nonexistent path
'/home/ubuntu/go:/home/ubuntu/_work/harbor/harbor/bin/golangci-lint'.

This was masked because ut_install.sh installed golangci-lint using the same
broken expression, so both sides agreed on the same bogus location. Resolving
the tool against the first GOPATH entry (where go install actually writes
binaries) makes the path correct in both the single-entry and list cases.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

* test(portal): wait for pagination control before clicking

The spec queried .pagination-next immediately after whenStable() and clicked
it, so it failed whenever the datagrid had not rendered yet. Retry the lookup
until the control appears.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

* test: do not reuse cached go test results

With GOCACHE persisted across CI runs, go test replayed cached results instead
of executing the tests. Harbor's tests share a database across packages, so a
package that re-ran could observe state that the replayed packages never
created. -count=1 forces tests to run while still reusing the compilation cache.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

* ci: fix Go caching in build-package and conformance, pin misspell

build-package.yml and conformance_test.yml also ran setup-go before checkout,
so their caches failed open exactly as CI.yml's did. Checkout now runs first
in both, with cache-dependency-path set.

cover and goveralls were installed but never used: goveralls is only named in a
commented-out line in ut_run.sh, and go test -cover uses the built-in tool, not
golang.org/x/tools/cmd/cover. Drop both and pin misspell, which make misspell
does invoke, so the cached tool version is reproducible.

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>

---------

Signed-off-by: Vadim Bauer <vadim@8gears.com>
Signed-off-by: Vadim Bauer <vb@container-registry.com>
2026-07-15 13:39:43 +08:00
Ibone González Mauraza
f9a52ee1a5 feat(audit): add member create/update/delete audit events (#23228)
* feat(audit): add member create/update/delete audit events

Add dedicated audit events for member add, update, and delete operations, including unit and API test updates.

Signed-off-by: Ibone Gonzalez <ibone.gonzalez@suse.com>

* fix format

Signed-off-by: Ibone Gonzalez <ibone.gonzalez@suse.com>

* add more tests

Signed-off-by: Ibone Gonzalez <ibone.gonzalez@suse.com>

---------

Signed-off-by: Ibone Gonzalez <ibone.gonzalez@suse.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-07-09 11:32:37 +00:00
stonezdj(Daojun Zhang)
c86fd24de0 test(apitests): fix race condition in log rotation test by polling job status (#23516)
The dry-run job can finish before the stop request is processed, and the execution status
might be updated asynchronously. This change replaces a fixed sleep with a polling loop
to wait for the job to reach a terminal state (Stopped or Success).

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Signed-off-by: stonezdj(Daojun Zhang) <stonezdj@gmail.com>
2026-07-09 10:02:18 +08:00
stonezdj(Daojun Zhang)
acc362c399 Fix job service dashboard testcase failed issue (#23488)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Co-authored-by: Wang Yan <wangyan_0219@hotmail.com>
2026-07-02 07:56:13 +00:00
stonezdj(Daojun Zhang)
f6f3a6eb50 bump: bump up golang to 1.26.4 and trivy adapter version to v0.37.2-rc2 (#23460)
* bump: bump up trivy adapter version to v0.37.2-rc2

Update TRIVYADAPTERVERSION to v0.37.2-rc2 in Makefile.

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

* bump: bump up Go version to v1.26.4

Update Go version from 1.26.3 to 1.26.4 across makefiles, configuration, CI workflows, and documentation.

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

---------

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Signed-off-by: stonezdj(Daojun Zhang) <stonezdj@gmail.com>
2026-06-30 14:07:29 +00:00
fiona-xie
b859ef5b25 test(ui): add retry for Get Harbor CA to improve stability (#23396)
test(ui): add retry for Get Harbor CA

Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
2026-06-18 07:40:48 +00:00
fiona-xie
cfcdff947d test(ui): Fix db_schedule and replication failed cases after Angular&Clarity upgrade (#23394)
test(ui): remove unnecessary codes

Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
2026-06-17 16:06:29 +08:00
Vijay Ganesh
a26dea01da fix(ui): Update bindings in Project Policy Config (#22694)
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
Co-authored-by: Prasanth Baskar <bupdprasanth@gmail.com>
2026-06-15 09:54:16 +00:00
fiona-xie
bc7f636ef6 test(api_db): support dynamic OpenAPI generator and PyPI URLs via env vars (#23361)
Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
2026-06-15 07:12:09 +00:00
Wang Yan
648037f0f3 ci: use local base for component builds; fix flaky log rotation test (#23357)
* ci: use local base for component builds; fix flaky log rotation test

- build-package.yml: set PULL_BASE_FROM_DOCKERHUB=false so components
  build on the base image built in the same run, not a stale remote tag.
- test_log_rotation.py: accept Stopped or Success for the dry-run purge
  job to avoid a timing flake.

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

* fix ci failure

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

---------

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
2026-06-12 15:53:59 +08:00
Wang Yan
a37374efe9 Harden crypto usage and drop unused SMTP package (#23307)
- Use stdlib crypto/pbkdf2 instead of golang.org/x/crypto/pbkdf2 for
  password/secret hashing (output unchanged; no migration needed).
- Restrict JWT signing to RSA/RSA-PSS and reject other methods in
  pkg/token (default RS256 unchanged).
- Remove unused common/utils/email package (no references in codebase).

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Co-authored-by: wang yan <yan-yw.wang@broadcom.com>
2026-06-11 14:48:09 +08:00
fiona-xie
ee1177d331 test(UI): fix and upgrade UI robot test cases for Angular v21 / Clarity v18 (#23344)
test(UI): fix UI robot test cases and locators for Angular and Clarity upgrade

Signed-off-by: fiona-xie <fei-fx.xie@broadcom.com>
2026-06-10 17:08:53 +08:00
Ashish Patel
a821bae24a feat(portal): upgrade Angular to v21, Clarity to v18, Node.js to v22 (#22937 (#23078)
Upgrade Harbor UI to Angular 21, Clarity v18, and Node.js v22

- Upgrade the Harbor UI (src/portal) from Angular 16 to Angular 19 and subsequently to Angular 21.
- Upgrade VMware Clarity from v17 to v18, and Node.js from v20 to v22 (updated .nvmrc, CI.yml, Makefile, Dockerfile).
- Migrate Angular templates to the new @if/@for control flow syntax.
- Fix UI issues #1 through #35, including robot accounts, layout, dropdown overlay, and input styling.
- Fix unit tests: resolve NG0100 ExpressionChangedAfterItHasBeenCheckedError in policy.component.spec.ts, replace autoDetectChanges(true) with explicit detectChanges cycles, and use TestBed.overrideComponent to stub AddP2pPolicyComponent template.
- Fix Clarity v18 breaking changes: update dark-theme SCSS import, add cds-theme attribute for theming, update ClrDatagridStateInterface import path, add ClrIconModule to app module.
- Stabilize npm installs and resolve CI/CD pipeline hangs.
- Fix swagger-ui crash caused by React 19 createRoot removal:
  - swagger-ui 5.28+ resolves a nested react-dom@19 which removed createRoot
    from the main react-dom entry point (moved to react-dom/client). The
    swagger-ui-es-bundle-core.js still imports createRoot from react-dom,
    making it undefined and causing "TypeError: i is not a function" at render.
  - app-swagger-ui/webpack.prod.js: alias bare 'swagger-ui' import to
    swagger-ui-bundle.js (the standalone UMD build that ships with React 18
    already bundled), bypassing the broken external react-dom@19 entirely.
  - app-swagger-ui/package.json: add npm overrides to pin react and
    react-dom to ^18.3.1 so future npm installs do not re-introduce React 19.
  - angular.json: expose swagger-ui.bundle.js and swagger-ui-index.html
    from app-swagger-ui/dist as Angular dev-server assets, enabling the
    proxy to serve the locally built, fixed bundle during development.
- Convert eslint-plugin-header config from JSON to JS to apply the ESLint 9 schema fix at config-load time, removing the need for patch-package.
- Pin all dependency versions to exact installed versions from the lock file, and remove unused prettier-eslint package.
- Fix flake in P2pProviderService unit test by initializing date with 0 milliseconds to prevent cross-second duration calculation mismatches.

Signed-off-by: Ashish Patel <zoom2ashish@gmail.com>
Co-authored-by: stonezdj <stone.zhang@broadcom.com>
2026-06-09 15:16:20 +00:00
Chlins Zhang
13532877a1 fix(cosign): ignore tlog during verification (#23284)
Signed-off-by: chlins <chlins.zhang@gmail.com>
2026-05-26 07:57:11 +00:00
Chlins Zhang
3a7e8228a3 test(cosign): disable tlog for signing checks (#23279)
Signed-off-by: chlins <chlins.zhang@gmail.com>
2026-05-25 18:54:25 +08:00
Prasanth Baskar
889364fd5f fix: Add i18n keys and missing translations (#23002)
* updated ru-ru-lang.json
* fix(i18n): add missing PROXY_CACHE_LOCAL_ON_NOT_FOUND keys to all language files
Add translated version of PROXY_CACHE_LOCAL_ON_NOT_FOUND and
PROXY_CACHE_LOCAL_ON_NOT_FOUND_TOOLTIP
* ci: add i18n key check to UI unit test pipeline
* fix(i18n): sync Russian proxy cache keys

---------
Signed-off-by: sias32 <sias320@gmail.com>
Signed-off-by: bupd <bupdprasanth@gmail.com>
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
Co-authored-by: sias32 <sias320@gmail.com>
2026-05-18 09:05:07 +00:00
stonezdj(Daojun Zhang)
24b7300618 bump Go version from 1.25.7 to 1.26.3 (#23235)
fix UT failures for Go 1.26.3 compatibility
  Add //nolint:revive to packages whose names shadow Go stdlib
  Fix mock file import ordering (goimports compliance)
  Bump golangci-lint from v2.8.0 to v2.9.0 for Go 1.26 support
  Update CI step label to reflect Go 1.26

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-05-18 16:22:30 +08:00
stonezdj(Daojun Zhang)
11b9c51e9d support configurable PIP_INDEX_URL for swagger client build (#23241)
* support configurable PIP_INDEX_URL for swagger client build

Pass PIP_INDEX_URL through Makefile (conditional env injection),
APITest-Util.robot (robot variable with public PyPI default), and
Group3-Upgrade/run.sh (-v forwarding to robot).

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

* wait more time for proxy cache ready
refine proxy cache test in migration prepare

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

---------

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-05-18 10:32:25 +08:00
Rakshit
30cc7795d6 Fix spelling error in comments (#23217)
fixing spelling mistakes in comments

Signed-off-by: Rakshit Yadav <yadavrakshit60@gmail.com>
2026-05-13 08:53:30 +00:00
stonezdj(Daojun Zhang)
3cd5bcdd57 test: use harbor-redis-base instead of harbor-valkey-base in SecurityHub CI (#23213)
test: use harbor-redis-base instead of harbor-valkey-base in Security Hub CI

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-05-13 06:59:58 +00:00
Mandepudi Rani Chowdary
18f7abd8ed Full Multi-Architecture Enablement for Harbor (amd64 + arm64) (#22311)
Co-authored-by: Orlix <7236111+OrlinVasilev@users.noreply.github.com>
Co-authored-by: Vadim Bauer <vb@container-registry.com>
Co-authored-by: Vadim Bauer <Bauer.vadim@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: bupd <bupdprasanth@gmail.com>
2026-05-12 09:03:22 +02:00
stonezdj(Daojun Zhang)
2cc8623dd9 Fix the GC robot testcase fail issue (#23214)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-05-11 15:20:37 +08:00
stonezdj(Daojun Zhang)
62c278dfb1 Make openapi-generator-cli download URL configurable (#23186) 2026-05-01 16:11:17 +08:00
Chlins Zhang
88ab66244e feat: replace redis with valkey as cache backend (#23157)
Signed-off-by: chlins <chlins.zhang@gmail.com>
2026-04-28 14:59:43 +08:00
Chlins Zhang
ae723f5eda ci: disable exporter cache in API tests (#23177)
Signed-off-by: chlins <chlins.zhang@gmail.com>
2026-04-28 10:19:04 +08: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)
ee96bb779b Add proxy cache from dockerhub, harbor, jfrog (#23121)
default to run proxy cache from harbor
    add SKIP_PROXY_CACHE setting to skip run proxy cache testcase in github action incase
    registry.goharbor.io unstable

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
2026-04-20 21:03:23 +08:00
stonezdj(Daojun Zhang)
a1c8992812 Update wasm artifact download URL in testcase (#22977)
Signed-off-by: stonezdj <stonezdj@gmail.com>
2026-03-10 07:58:32 +00:00
Wang Yan
1006a2010f bump go and base images (#22831)
1, up go to v1.25.7.
2, up the base photon to latest.

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Co-authored-by: wang yan <yan-yw.wang@broadcom.com>
2026-02-11 17:39:35 +08:00
Wang Yan
457ca90e63 bump go to v1.25 (#22794)
1, bump go version from v1.24.6 to v1.25.6
2, temp workaround the lint issue.
3, fix the relevant compitable issues that introduced by go v1.25.

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Co-authored-by: wang yan <yan-yw.wang@broadcom.com>
2026-02-03 03:44:28 +08:00
Chlins Zhang
8d7b97327b ci: fix the publishImage script with new docker version (#22753)
Signed-off-by: chlins <chlins.zhang@gmail.com>
2026-01-21 08:06:28 +00:00