Commit Graph

552 Commits

Author SHA1 Message Date
wang yan
2b0b7576b2 Fix gc issue on clean the artifact trash
1, enable dao test for artifact trash
2, set default flush trash table to false
3, hanlder empty parameter in API call
4, add registry auth info into jobservice container

Signed-off-by: wang yan <wangyan@vmware.com>
2020-03-06 03:11:31 +08:00
He Weiwei
69119b6410
feat(addition-link): only set vuls addition link when artifact scanable (#10892)
1. Add Checker to check the scannable status of the artifact.
2. Only set vulnerabilities addition link when the artifact scanable in the
project.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-03-03 16:41:54 +08:00
DQ
bc4c25181f Fix chart api for oci registry introduece api version
currently api version part is added in url. This pr is to solve the break of chart related api

Signed-off-by: DQ <dengq@vmware.com>
2020-02-26 17:05:02 +08:00
Wang Yan
948d45604c Revise the GC job flow,
1, set harbor to readonly
2, select the candidate artifacts from Harbor DB.
3, call registry API(--delete-untagged=false) to delete manifest bases on the results of #2
4, clean keys of redis DB of registry, clean artifact trash and untagged from DB.
5, roll back readonly.

Signed-off-by: wang yan <wangyan@vmware.com>
2020-02-24 18:29:55 +08:00
Wenkai Yin
528f598268 Reimplement the registry client
This commit reimplements the registry client under directory src/pkg/registry and removes the useless code

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-24 14:36:26 +08:00
Wenkai Yin
bd204464f3 Remove dead code
Remove dead code

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-23 17:11:46 +08:00
stonezdj
29aa59ff18 Move core/notifier to pkg/notifier
Update package reference in related components

Signed-off-by: stonezdj <stonezdj@gmail.com>
2020-02-22 11:05:27 +08:00
Ziming
0bc32410f3
Merge pull request #10742 from bitsf/oci_tag_retention
requirement(oci) implement tag retention for oci
not include ChartClient yet
2020-02-20 20:31:49 +08:00
Ziming Zhang
94e23dc954 requirement(oci) implement tag retention for oci
Change-Id: Ib36660835d2666b35124e66254c33b5fc19aaf77
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2020-02-20 00:43:20 +08:00
He Weiwei
4ad02de348
Scan reorganize (#10735)
* refactor(scan,scanner): move scan and scanner controllers to api pkg

Signed-off-by: He Weiwei <hweiwei@vmware.com>

* feat(scan-all-job): move artifacts query from job to notification

Move artifact query from scan all job to its notification handler to
ensure that the components in pkg will not call controllers in api.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-02-19 12:21:54 +08:00
Daniel Jiang
5a6e9331fd
Artifact signature populate (#7)
* Populate signature status in artifact API

This Commit add signature status into response of list artifact API.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2020-02-18 01:42:56 +08:00
He Weiwei
c4f77069c8
Hide projects in global logs where user has limited guest role (#10639)
Signed-off-by: Mark Huang <mhuang@pivotal.io>

Co-authored-by: Mark Huang <mhuang@pivotal.io>
2020-02-11 10:14:30 +08:00
wang yan
596a6261ca set the immutable status on getting/listting tag
Signed-off-by: wang yan <wangyan@vmware.com>
2020-02-05 16:24:13 +08:00
He Weiwei
b1437c1341
refactor(security): add NewContext and FromContext to security pkg (#10617)
1. Add `NewContext` and `FromContext` funcs in security pkg.
2. Add `Name` func in `security.Context` interface to make the checking
for the `/api/internal/configurations` API clear.
3. Get the security from the context to prepare change the security
filter to middleware.
4. Remove `GetSecurityContext` in filter pkg.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-02-03 17:43:36 +08:00
Daniel Jiang
2064a1cd6d Switch to basic authentication for registry
1. Add basic authorizer for registry which modify the request
to add basic authorization header to request based on configuration.
2. Set basic auth header for proxy when accessing registry
3. Switche the registry to use basic auth by default and use the basic
authorizer to access Harbor.
4. Make necessary change to test cases, particularly
"test_robot_account.py" and "docker_api.py", because the error is
changed after siwtched to basic auth from token auth.  #10604 is opened
to track the follow up work.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2020-01-31 21:46:47 +09:00
He Weiwei
33dfa1ea11
feat(beego): upgrade beego to v1.12 which support middleware (#10524)
1. Upgrade beego to v1.12.0
2. Add RequestID middleware to all HTTP requests.
3. Add Orm middleware to v2 and v2.0 APIs.
4. Remove OrmFilter from all HTTP requests.
5. Fix some test cases which cause panic in API controllers.
6. Enable XSRF for test cases of CommonController.
7. Imporve ReadOnly middleware.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-01-20 16:41:49 +08:00
Wenkai Yin(尹文开)
1ea9e68178
Merge pull request #10366 from ywk253100/191219_manager
Implement tag/artifact manager and artifact controller
2020-01-08 21:24:52 +08:00
Wenkai Yin
400a47a5c5 Implement tag/artifact manager and artifact controller
1. Implement tag/artifact manager
2. Implement artifact controller
3. Onboard the artifact when pushing artifacts

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-01-08 20:19:48 +08:00
wang yan
a0f3709b3c add expiration data time when to create a robot account
Update API of creating robot accout, user can specify expiration time per account.

Signed-off-by: wang yan <wangyan@vmware.com>
2020-01-03 13:47:06 +08:00
Wenkai Yin(尹文开)
56dc0bb71f
Merge pull request #10324 from wy65701436/common-error-13
add OCI error format support
2019-12-25 17:44:35 +08:00
wang yan
ebe5bb68b9 add OCI error format support
1, Leverage go v1.13 new error feature
2, Define genernal error OCI format, so that /v2 API could return a OCI compatible error

Signed-off-by: wang yan <wangyan@vmware.com>
2019-12-25 17:07:26 +08:00
Wenkai Yin(尹文开)
c1522d3c36
Merge pull request #10261 from stonezdj/20191211_ldap_group_admin_dn
Fix admin permission not revoked when removed from LDAP admin group(Do Not Merge)
2019-12-24 14:37:28 +08:00
stonezdj
6313a55219 Fix admin permission not revoked when removed from LDAP admin group
Seperate the HasAdminRole(In DB) with the privileges from external auth, and use user.HasAdminPrivilege to check

Signed-off-by: stonezdj <stonezdj@gmail.com>
2019-12-20 13:12:22 +08:00
Ziming
e32649adb4 enhance[cicd] introduce github action for CICD
In order to replace travis.
Implement 5 CI jobs
- UTTEST
- APITEST_DB
- APITEST_LDAP
- OFFLINE
- UI_UT

Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-12-17 18:36:33 +08:00
Daniel Jiang
7bd19f497c Stastics API should handle group members
statistic API use security Context to list project rather than calling
projectmanager directly, such that the group membership will be taken
into account.
fixes #10230

It should be cherry picked to 1.9.x and 1.10.x branches

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-12-11 18:52:43 +08:00
Wenkai Yin
4043ef8aa9 Sort the tag before returning the list when calling API
Sort the tag before returning the list when calling API list tag API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-12-05 19:50:45 +08:00
Wang Yan
9016c427b9
Merge pull request #10136 from reasonerjt/rm-authproxy-case-sensitive
Get rid of case-sensitivity in authproxy setting
2019-12-05 14:26:18 +08:00
Daniel Jiang
d58f5e4bdc Get rid of case-sensitivity in authproxy setting
This commit removes the attribute to control case-sensitivity from
authproxy setting.
The result in token review status will be used as the single source of
truth, regardless the case of the letters in group names and user names.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-12-04 21:39:40 +08:00
Wenkai Yin(尹文开)
d145f4baf4
Merge pull request #10034 from ywk253100/191128_clean
Clean up admiral-related code
2019-12-04 17:33:31 +08:00
Daniel Jiang
902598fabd Support pinning to authproxy server's cert
This commit add an attribute to configurations, whose value is the
certificate of authproxy server.  When this attribute is set Harbor will
pin to this cert when connecting authproxy.
This value will also be part of the response of systemInfo API.

This commit will be cherrypicked to 1.10 and 1.9 branch.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-12-03 07:31:26 +08:00
Wenkai Yin
dd2bc0ecef Clean up admiral-related code
Clean up admiral-related code as it's useless

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-11-28 17:28:54 +08:00
Daniel Jiang
b2b531d3af Update minimum length of project name
This commit fixes #9946, that when creating a project the minimum length
should be 1, not 2.

This commit should be cherry picked to 1.9.x and 1.10.x branch .

We need to double check if this change impacts the creation of replication
rule.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-11-26 12:41:51 +08:00
He Weiwei
fec76c3d57
fix(limited-guest): fix limited guest info missing in summary page (#9957)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-11-22 10:03:02 +08:00
Wang Yan
eab974419c
Merge pull request #9825 from stonezdj/bug_9681
Avoid to create duplicated immutable tag rules in the same project
2019-11-18 17:26:22 +08:00
He Weiwei
0c068d81f5
feat(vuln-severity): map negligible to none to match CVSS v3 ratings (#9885)
BREAKING CHANGE: the value negligible of severity in project metadata will change to none in the responses of project APIs

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-11-18 14:36:51 +08:00
Wang Yan
6e03c8a54e
Merge pull request #9896 from heww/owner-check-for-project-member-robot-account
fix(robot,project-member): check owner of member, robot when update, …
2019-11-15 16:53:22 +08:00
stonezdj
15898f2069 Avoid to create duplicated immutable tag rules in the same project
Fix #9681, add constraint on immutable_tag_rule and catch the error

Signed-off-by: stonezdj <stonezdj@gmail.com>
2019-11-15 14:46:23 +08:00
He Weiwei
5bd1cfdbf2 fix(robot,project-member): check owner of member, robot when update, delete
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-11-14 07:00:44 +00:00
Wang Yan
29be93725d
Merge pull request #9860 from reasonerjt/authproxy-case-sensitive-master
Authproxy case sensitive master
2019-11-14 14:03:53 +08:00
Wang Yan
10850a06d8
Merge pull request #9859 from ywk253100/191113_subresource_1.10
Refine the implementation of replication execution API
2019-11-14 11:30:10 +08:00
stonezdj
a3c298e9fd Refactor immutable tag rule
Change implementation
Fix some nil pointer issue

Signed-off-by: stonezdj <stonezdj@gmail.com>
2019-11-13 19:09:31 +08:00
Daniel Jiang
8933ab8074 Add configuration "case sensitive" to HTTP auth proxy
This commit make case sensitivity configurable when the authentication
backend is auth proxy.
When the "http_authproxy_case_sensitive" is set to false, the name of
user/group will be converted to lower-case when onboarded to Harbor, so
as long as the authentication is successful there's no difference regardless
upper or lower case is used.  It will be mapped to one entry in Harbor's
User/Group table.
Similar to auth_mode, there is limitation that once there are users
onboarded to Harbor's DB this attribute is not configurable.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-11-13 15:00:05 +08:00
Wenkai Yin
54c5811974 Update the test cases of user API
Update the test cases of user API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-11-13 14:51:29 +08:00
Wenkai Yin
05ffb7a3c5 Refine the implementation of replication execution API
Remove the duplicated code in replication execution API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-11-13 14:26:57 +08:00
Daniel Jiang
64dc5122e6 Add role list in project response
This commit fixes #9771

It compares the roles to return the one with highest permission in the
response of `GET /api/projects`.
In addition to that, it adds the role list to the response, because a
user can have multiple roles in a project.
It also removes the togglable attribute as it's not used anywhere.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-11-11 14:03:50 +08:00
Wenkai Yin(尹文开)
d60979cdd0
Merge pull request #9762 from steven-zou/fix/add_status_2_scan-call_metrics
add status data in the scan all metrics
2019-11-08 10:30:25 +08:00
Steven Zou
a1d8c01cea add status data in the scan all metrics
Signed-off-by: Steven Zou <szou@vmware.com>

Signed-off-by: Steven Zou <szou@vmware.com>
2019-11-07 14:28:11 +08:00
Daniel Jiang
06e4e124d8
Refine request handle process (#9760)
* Refine request handle process

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-11-07 13:02:17 +08:00
Steven Zou
ee31418e8e revoke scan permission from the developer role
Signed-off-by: Steven Zou <szou@vmware.com>
2019-11-06 17:57:48 +08:00
Steven Zou
ebc5d2482b do improvements to the scan all job
- update scan all job to avoid sending too many HTTP requets
- update scan controller to support scan options
- update the db schema of the scan report to introduce requester
- introduce scan all metrics to report the overall progress of scan all job
- fix the status updating bug in scan report
- enhance the admin job status updats
- add duplicate checking before triggering generic admin job
- update the db scheme of admin job

fix #9705
fix #9722
fix #9670

Signed-off-by: Steven Zou <szou@vmware.com>
2019-11-05 15:12:07 +08:00
Steven Zou
a928928a43
Merge pull request #9686 from heww/fix-project-severity-mapping
fix(policy-checker): add func to transform project severity to vuln.Severity
2019-11-01 11:12:13 +08:00
Daniel Jiang
f2beee16b1
Merge pull request #9673 from steven-zou/fix/issue_#9668_status_conflicts
return more clear error message for scan related API
2019-11-01 11:08:43 +08:00
He Weiwei
ae8931e816 fix(policy-checker): add func to transform project severity to vuln.Severity
The severity saved in db is lowercase but the severities in vuln pkg
begin with upper letter, this fix use func to transform project severity
value from db to vuln.Severity.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-31 14:11:44 +00:00
Steven Zou
eb8ec49f4f add UT cases for the common error pkg
Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-31 21:55:27 +08:00
Steven Zou
afb46188b2 return more clear error message for scan related API
- add a common error pkg to support error with code and AsError check
- replace some errors in scan with coded errors
- fix #9668

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-31 11:35:55 +08:00
wang yan
253e87d186 inject ldflags for harbor compiler and linker
1, replace the UIVERSION file with ldflags, which is generarted by make to inject into the UI core.
2, inject additional ldflags for harbor compiler

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-30 18:31:42 +08:00
Steven Zou
10c30fde3d
Merge pull request #9618 from steven-zou/fix/bug_#9608
permission grant for scanner related actions are not correctly
2019-10-28 22:12:56 +08:00
Steven Zou
5b2ab34e03 permission grant for scanner related actions are not correctly
- add new endpoint for getting scanner candidates of specified project
- adjust the permission granting functions
- fix #9608

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-28 18:20:47 +08:00
Wang Yan
e0fd4cd609
Merge pull request #9599 from wy65701436/fix-quota-migration
Fix quota sync crash on getting the unknown mainfest
2019-10-28 17:47:46 +08:00
wang yan
fc347fc4eb Fix quota sync crash on getting the unknown mainfest
1, eat the unknown manifest error, and log it. The migration process will not crashed on it.
2, enable to persist DB of sync quota API.
3, add empty project support.

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-28 15:17:08 +08:00
Steven Zou
eba1a01ac2
Merge pull request #9595 from steven-zou/fix/update_scanner_failure
property use_internal_addr can not be updated
2019-10-25 17:39:34 +08:00
Steven Zou
9d0263fc9a property use_internal_addr can not be updated
- pick up `use_internal_addr` in the update API

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-25 15:35:43 +08:00
wang yan
f9996663d8 update immutable rule API
1, unify disable and enable
2, fix update rule error

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-25 14:11:07 +08:00
Steven Zou
868851cc51
Merge pull request #9571 from steven-zou/fix/support_internal_addr_scanner
support using internal registry addr to perform scan
2019-10-24 20:52:27 +08:00
Steven Zou
cb59ba3bbc support using internal registry addr to perform scan
- do changes to the sql schema
- add `UseInternalAddr` and `Immutable` properties to scanner registration
- support multiple authentication type
  - basic
  - bearer token

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-24 18:28:35 +08:00
Ziming
eb6708ed76
Merge pull request #8174 from bitsf/refact_replication_info
refact replication info to support special endpoints and credential
2019-10-24 15:34:01 +08:00
Steven Zou
956d9db1d5
Merge pull request #9528 from steven-zou/fix/pluggable_scanner_improvments
improve the scan controlling
2019-10-24 15:17:06 +08:00
Wang Yan
4baa35bc17
Merge pull request #9520 from ywk253100/191022_health_check
Remove the health checker for Clair in health check API
2019-10-24 14:50:01 +08:00
Ziming Zhang
1801bac03d refact replication adapter
Change-Id: Ic28854089b8dcfcbc7e42065df5c19c64d5b85e7
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-10-24 12:24:55 +08:00
Steven Zou
7fad103e46 - fix API test cases failures
Signed-off-by: Steven Zou <szou@vmware.com>

- fix scan report dao bug
2019-10-23 20:44:01 +08:00
Ziming Zhang
5419e1a844 refact replication info to support special endpoints and credential
Change-Id: I2f7a51d3aaf57bb6d1942526184f4e62ce3afeab
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-10-23 17:19:56 +08:00
Wenkai Yin(尹文开)
bd28ba43c0
Merge pull request #9478 from ywk253100/191018_test
Populate public metadata into the event
2019-10-23 15:21:53 +08:00
Steven Zou
38395e015c fix api test case failure
Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-23 13:27:03 +08:00
Wenkai Yin
9d896d4d72 Remove the health checker for Clair in health check API
As we introduce the pluggable scanner, users can add the external scanners, so we remove the Clair from the health check API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-10-23 12:55:03 +08:00
Steven Zou
962bafb7ce fix go imports order issues
Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-23 09:34:47 +08:00
Steven Zou
370a364c29 fix code conflict and rebase with master
Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-22 18:39:37 +08:00
Steven Zou
dff1ee07fc improve the scan controlling
- add LCM control to the robot account generated for scanning
- improve the scan webhook
- remove reprots when related artifact is deleted
- update report manager/scan controller and other components to support above cases
- add artifact manager/comtroller to list artifacts

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-22 18:24:46 +08:00
wang yan
424f11e697 add immutable match in the repository/tag delete api
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-21 15:53:24 +08:00
Wang Yan
71bb8815bf
Merge pull request #9461 from reasonerjt/rm-validator-cve
Remove validation for item in CVE whitelist
2019-10-21 14:52:08 +08:00
He Weiwei
e254fe3095
fix(permissions): permissions checking for member and quota info (#9490)
1. Only show project member info when has member list permission.
2. Only show quota info when has quota read permission.
3. Add quota read permission for all roles of project.
4. Refactor permission service in portoal.
5. Clear cache when clear session.

Closes #8697

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-21 14:03:52 +08:00
He Weiwei
bf6a14c9ad
feat(role): introduce a limited guest role (#9403)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-20 14:21:28 +08:00
Wenkai Yin
db7025a504 Populate public metadata into the event
Fixes #9455. Populate the public metadata into the event when doing the replication based on event

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-10-18 17:40:19 +08:00
Daniel Jiang
1a9cebd5e8 Remove validation for item in CVE whitelist
To contain various vulnerabilities in the CVE whitelist, this commit
removes the validation.
Fixes #9242

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-10-18 15:08:32 +08:00
Steven Zou
0f16913635 rebase: resolve the code confilcts with master
Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-17 17:42:41 +08:00
Steven Zou
f18afc0a3f do changes to let the vul policy check compatiable with new framework
- update the scan/scanner controller
- enhance the report summary generation
- do changes to the vulnerable handler
- remove the unused clair related code
- add more UT cases
- update the scan web hook event
- drop the unsed tables/index/triggers in sql schema

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-16 23:15:26 +08:00
Wenkai Yin(尹文开)
32a2c41c3b
Merge pull request #9273 from gavinfish/typo
Fix typos in core package
2019-10-16 17:10:35 +08:00
Wenkai Yin(尹文开)
372875ad64
Merge pull request #9393 from wy65701436/immutable-match
add immutable match
2019-10-15 18:51:43 +08:00
stonezdj(Daojun Zhang)
ff04b2c930
Merge pull request #9411 from wy65701436/fix-list-robot
fix list robot account API return an internal error
2019-10-15 17:47:38 +08:00
wang yan
288e4cc193 igonre the duplicate error when to insert project_blobs on quota syncing
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-15 14:14:58 +08:00
wang yan
5e8f7297f5 fix list robot account API return an internal error
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-15 12:29:44 +08:00
wang yan
a3546478eb add immutable match
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-14 16:21:32 +08:00
wang yan
25f638a989 Merge branch 'master' of https://github.com/goharbor/harbor into robot-invisiable 2019-10-14 14:35:45 +08:00
Steven Zou
a86afd6ebc Merge branch 'master' into feature/pluggable_scanner_s3_merge 2019-10-12 15:18:06 +08:00
wang yan
3e81bd7f1d add visible attribute to robot account
The commit is to make robot controller could create invisible robot account for internal use

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-12 00:51:48 +08:00
Wang Yan
40d80f82ba
Merge pull request #9368 from reasonerjt/set-cli-secret-api
API for user to set the CLI secret
2019-10-11 18:38:58 +08:00
Steven Zou
9fd8b6306c refactor code to reflect code review comments
- refactor the db schema \
- refactor  permission checking in API handlers \

to follow the latest code/interface changes

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-11 18:07:47 +08:00
wang yan
6f6f113f0f refactor robot api
1, add API controller for robot account, make it callable internally
2, add Manager to handler dao releate operation

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-11 17:26:18 +08:00
Daniel Jiang
53a13e165d API for user to set the CLI secret
This commit replace the API to generate CLI secret with a new API to
update the secret

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-10-11 14:15:08 +08:00
Steven Zou
58afd8e14b [stage3] support pluggable scanner
- implement scan controller
- add scan resource and update role bindings
- update registration model and related interfaces

Signed-off-by: Steven Zou <szou@vmware.com>

- implement scan API to do scan/get report/get log
- update repository rest API to produce scan report summary
- update scan job hook handler
- update some UT cases

- update robot account making content
- hidden credential in the job log

Commnet scan related API test cases which will be re-activate later
fix #8985

fix the issues found by codacy

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-11 12:53:02 +08:00
stonezdj(Daojun Zhang)
a2938c5d78
Merge pull request #9274 from wy65701436/immu-refatctor
refactor immutable dao code to align the new structure under pkg
2019-10-10 10:38:22 +08:00
wang yan
8317100cda continue refactor API
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-09 23:06:35 +08:00
He Weiwei
4ce72e37c4 fix(robot): robot account improvement for policies
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-09-27 03:07:58 +00:00
wang yan
7c4fd79b5c refactor immutable dao code to align the new structure under pkg
1, add manager
2, move model dao to /pkg/dao

Signed-off-by: wang yan <wangyan@vmware.com>
2019-09-26 20:35:58 +08:00
Jie Shen
673f6e6068 Fix typos in core package
Signed-off-by: Jie Shen <drfish.me@gmail.com>
2019-09-26 19:56:27 +08:00
stonezdj(Daojun Zhang)
ce824a6eb9
Merge pull request #9141 from stonezdj/immutable_tag_api
Immutable tag api
2019-09-25 19:01:14 +08:00
stonezdj
cc22a175b9 Add immutable tag API
Signed-off-by: stonezdj <stonezdj@gmail.com>
2019-09-25 15:53:56 +08:00
Wenkai Yin
83e7213d18 Make the username required when searching user
Make the username required when searching user and remove the support for query email

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-09-25 13:32:29 +08:00
Wenkai Yin(尹文开)
360334991e
Merge pull request #9198 from ywk253100/190923_ping
Return the common error message when testing the webhook endpoint
2019-09-24 18:51:21 +08:00
Wenkai Yin(尹文开)
4192a692cd
Merge pull request #9200 from ywk253100/190923_oidc_ping
Return a common error message when testing the oidc provider
2019-09-24 18:49:23 +08:00
Steven Zou
a73f896f23
Merge pull request #9154 from steven-zou/feature/pluggable_scanner_s2
[stage2]support pluggable scanner
2019-09-23 21:12:27 +08:00
Steven Zou
d616bc3509 add scan report CRUD supporting and
- change error collection in scan job
- add dead client checking in client pool
- change key word type to interface{} for q.Query
- update bearer authorizer
- add required UT cases

Signed-off-by: Steven Zou <szou@vmware.com>
2019-09-23 16:21:39 +08:00
Wenkai Yin
6efdfa5fb4 Return a common error message when testing the oidc provider
Returning a common error when failed to test the oidc provider and printing the detail in the log

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-09-23 14:43:38 +08:00
Wenkai Yin
7056d6604b Return the common error message when testing the webhook endpoint
This commit returns a common error message when testing the webhook endpoint and prints the detail in the log for debug

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-09-23 14:38:47 +08:00
Steven Zou
0c19eba8c2 [stage2]support pluggable scanner
- add scanner rest API v1 spec
- implement v1 client which is used to talk to scanner adapter
- adjust data/orm models
- adjust code package structure

Signed-off-by: Steven Zou <szou@vmware.com>

- implement scan client which is used to talk to scanner adapter
- implement scan job which take the work of communicating with scanner
- update scanner mgmt API routes
- add corresponding UT cases
2019-09-23 09:37:54 +08:00
Daniel Jiang
f491061b57
Merge pull request #8440 from gklp/gklp_issue_8197_wrong_header_content_type_after_redirection
All redirect operations should have content-type as json
2019-09-20 17:21:01 +08:00
Daniel Jiang
f1367064fb Address review comment
Address review comments for commit
b21f9dc6f1

and resolve conflict

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-09-20 13:42:39 +08:00
Daniel Jiang
07dd14d3b5 Generate new session ID after login
This commit mitigates the Session Fixation issue by making sure a new
session ID is generated each time user logs in to Harbor

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-09-19 20:51:50 +08:00
Daniel Jiang
b21f9dc6f1 Support OIDC groups
This commit enable project admin to add group as project member when
Harbor is configured against OIDC as AuthN backend.

It populates the information of groups from ID Token based on the claim
that is set in OIDC settings.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-09-19 17:49:31 +08:00
Steven Zou
4c4897aef1
Merge pull request #9134 from steven-zou/feature/pluggable_scanners
support pluggable scanner
2019-09-19 16:08:24 +08:00
Steven Zou
e324a4d623 support pluggable scanner
- add DAO layer for scanner registration
- add CURD manager for scanner registration
- add API controller for plug scanner
- add REST APIs for CURD of plug scanner
- add migration sql:0011_1.10.0
- add scan interface definition (no implementations)
- add related UT cases with testify

fix #8979 #8990

Signed-off-by: Steven Zou <szou@vmware.com>
2019-09-18 21:56:45 +08:00
Wang Yan
f77ce4aa3a
Merge pull request #8976 from ninjadq/add_auth_for_project_head
Fix: Add authenticate to projects head
2019-09-17 14:02:45 +08:00
Daniel Jiang
753219834e
Merge pull request #8960 from ninjadq/upgrade_hash_alg_for_pswd
Upgrade hash alg for pswd
2019-09-12 11:22:39 +08:00
DQ
ea5c27fcd5 Enhance: Upgrade encrypt alg to sha256
previous sha1 will still used for old password

Signed-off-by: DQ <dengq@vmware.com>
2019-09-09 21:48:21 +08:00
Wenkai Yin
3b07be5a72 Check the status behind error when trying to update the scan schedule
Check the status behind error when trying to update the scan schedule

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-09-09 13:31:10 +08:00
Ziming Zhang
722e45b20b add swagger for tag retention
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I0f3ed8085e231868de74c273ba85946826181d5b
2019-09-06 17:27:20 +08:00
DQ
4ac145b45b Fix: Add authenticate to projects head
Project head only allow authenticated user to call.

Signed-off-by: DQ <dengq@vmware.com>
2019-09-06 14:50:47 +08:00
gklp
dee3defeff refactored
Signed-off-by: gklp <gokalpkuscu@gmail.com>
2019-09-03 21:46:52 +03:00
wang yan
d8e17b122e add read only for quota switcher
Signed-off-by: wang yan <wangyan@vmware.com>
2019-09-03 14:08:39 +08:00
Wang Yan
2194834b41
Merge pull request #8910 from heww/foreign-layers
fix(quota): correct size quota for image with foreign layers
2019-09-03 00:29:24 +08:00
He Weiwei
f44b75f398 fix(quota): correct size quota for image with foreign layers
1. Sync blobs from manifest for image with foreign layers.
2. Ignore size of foreign layers when compute size quota.
3. Fix repo info of artifact when upgrade from 1.8 version.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-09-02 14:10:58 +00:00
Wenkai Yin(尹文开)
7d151946e0
Merge pull request #8917 from reasonerjt/fix-create-admin-user
Disallow creating an admin user when registration
2019-09-02 18:43:41 +08:00
Wang Yan
240b718508
Merge pull request #8887 from wy65701436/fix-8886
fix(quota/sync) #8886
2019-08-30 15:06:35 +08:00
wang yan
16b910e1cf fix(quota/sync) #8886
The foreign layer won't be counted into project quota
NOTE: the foreign layer will be dumped from the registry in the migration

Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-29 17:29:40 +08:00
Ziming Zhang
8fb6e2f65b verify permission of GetRetentionExecTaskLog
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I4bf4ddf3d3ed6f07a4618e242e2f3774996716d6
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-29 15:01:53 +08:00
Wang Yan
db5781bf78
Merge pull request #8860 from wy65701436/fix-quota-sync
fix quota sync issues
2019-08-29 13:45:38 +08:00
wang yan
5decb56369 update code per review comments
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-29 12:46:42 +08:00
wang yan
942e793f20 fix quota sync issues
1, fix #8858, add retry to ping backend service
2, fix #8859, split the blobs data when larger then 65535

Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-28 18:59:25 +08:00
Daniel Jiang
b6db8a8a10 Disallow creating an admin user when registration
This commit enhance the `POST /api/users` API to block request from non-admin to create
admin user.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-08-28 18:30:27 +08:00
Qian Deng
ed54b1da45
Merge pull request #8857 from wy65701436/fix-syne-readonly
fix quota sync read only setting
2019-08-28 17:04:02 +08:00
Ziming
94138137d5
add valid for rule (#8846)
Change-Id: I82215a0cf1ec32a253c8db9bfafe7e25b26c9ad9
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-28 16:58:49 +08:00
wang yan
19a37282c1 fix quota sync read only setting
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-28 14:53:01 +08:00
Wang Yan
87893abc5e
Merge pull request #8829 from ywk253100/190822_retry_status
Add status revision to handle retrying in replication task
2019-08-28 10:55:13 +08:00
Wang Yan
be1e702d9d
Merge pull request #8787 from cd1989/core-hunging
Fix core hung when stop problem
2019-08-27 15:56:21 +08:00
Wenkai Yin
7924f37d86 Add status revision to handle retrying in replication task
Add status revision to handle retrying in replication task

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-27 14:17:11 +08:00
wang yan
f343b2ec45 Revise quota errors to make it more readable
1, fix #8802, update the error formet
2, fix #8807, raise the real retag error to UI
3, fix #8832, raise the real chart error to chart client & ut

Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-26 17:00:31 +08:00
Wang Yan
e7488e37b6
Merge pull request #8788 from bitsf/tag_retention_validate_model
add tag retention model test
2019-08-23 13:57:51 +08:00
Ziming Zhang
39db65e90f add tag retention model test
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I3f8b06b994024fe6052b0dee87600ed932edaaff
2019-08-23 13:24:28 +08:00
mmpei
d5f87063e4
Merge branch 'master' into official-wehook-events-20190811 2019-08-22 22:07:12 -05:00
peimingming
599d12a04d Fix bugs by comments for webhook
Signed-off-by: peimingming <peimingming@corp.netease.com>
2019-08-23 09:44:51 +08:00
cd1989
4b59346423 Exist core when signal received
Signed-off-by: cd1989 <chende@caicloud.io>
2019-08-23 09:34:41 +08:00
Wenkai Yin(尹文开)
21f8290110
Merge pull request #8777 from heww/issue-8635
fix(rbac): NewProjectNamespace in rbac only accept projectID
2019-08-22 17:52:27 +08:00
wang yan
dfa4301b21 fix deleted project error when to migrate quota
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-22 14:51:26 +08:00
He Weiwei
8effdc6f18 fix(rbac): NewProjectNamespace in rbac only accept projectID
Closes #8635

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-08-21 19:37:28 +00:00
Ziming Zhang
06e9467b06 1. remove rule none
2. change rule orders
3. remove laber selector

Change-Id: Idc18a27cb0267f5f5c80a04b381e4a5dc6998508
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-21 20:24:33 +08:00
Steven Zou
f6067d5474
Merge pull request #8708 from bitsf/tag_retention_rule_conflict
fix rule conflict, id error
2019-08-20 16:45:21 +08:00
Wang Yan
92fa01d6cd
Merge pull request #8733 from ywk253100/190819_label
Fix bug of listing tags filtered by label
2019-08-20 14:17:41 +08:00
Wenkai Yin(尹文开)
29ab93ad9c
Merge pull request #8714 from ywk253100/190816_scheduler
Fix bug found in scheduler
2019-08-20 14:11:04 +08:00
Wenkai Yin(尹文开)
0086d1b211
Merge pull request #8586 from ethan-daocloud/patch-2
project_test.go: many typos "respose" fixup
2019-08-20 13:54:37 +08:00
Wenkai Yin
a5d292c9c6 Fix bug of listing tags filtered by label
Fixes #8249

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-19 16:10:16 +08:00
wang yan
b9d6108624 add ping for adapter to wait for service ready
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-16 16:03:12 +08:00
wang yan
6e11ecc6fc Update codes per review comments
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-16 14:58:52 +08:00
Wang Yan
7a41d89ac8 Add quota sync api toi to sync quota data with backend storage
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-16 14:55:46 +08:00
Daniel Jiang
022d4e6ae8
Merge pull request #7462 from cd1989/enable-tags-detail-param
List simple tags when detail set to false
2019-08-16 14:25:29 +08:00
Wenkai Yin
5c286d799f Fix bug found in scheduler
The scheduler hook handler doesn't parse the job status struct when handling the hook. This commit fixes it.

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-16 13:54:57 +08:00
Ziming
c279b7f3e9
fix retention rule compute error (#8664)
Change-Id: I16d7284b17508885e136f2d9ea5651978ba4a6d8
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-15 20:12:59 +08:00
Ziming Zhang
4dc6f12784 fix rule conflict, id error
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I379f3c29cee742d346fb57ade397be64fd76f59d
2019-08-15 20:11:30 +08:00
Ziming Zhang
f854d4a25d add always rule again
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I34bac3b73e693b89e0b9debb28617352656ed1d9
2019-08-15 15:26:22 +08:00
Ziming
4944799f70
Merge pull request #8651 from bitsf/remove_tagretention_always
remove tag retention rule always
2019-08-15 14:35:26 +08:00
wang yan
a947a4259d Fix quota switch fail to get project size
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-14 22:32:32 +08:00
wang yan
838a923d23 fix code by review
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-14 12:47:12 +08:00
wang yan
9e0addee55 Enable usage sync when switch quota setting
Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-14 12:47:12 +08:00
Ziming Zhang
d7e9924a01 remove tag retention rule always
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: Ide98d58f64596e8110fbb9eb0d73df6ccbd99c80
2019-08-13 21:10:57 +08:00
cd1989
da370bb331 List simple tags when detail set to false
Signed-off-by: cd1989 <chende@caicloud.io>
2019-08-12 15:16:19 +08:00
He Weiwei
c1cea42089 feat(quota,middleware): enable or disable quota per project by config
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-08-12 00:02:26 +00:00
peimingming
222c47142a Add chart and scanning event for webhook
Signed-off-by: peimingming <peimingming@corp.netease.com>
2019-08-11 18:01:07 +08:00
Steven Zou
d2fbb98a8d
Merge pull request #8592 from bitsf/tag_retention_conflict_rule
check rule conflict
2019-08-09 13:59:46 +08:00
Ziming Zhang
fb5acdc64b check rule conflict
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: Iea8c9ff4702873cb4ab3ebd943deec22bec418e6
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-08 14:23:53 +08:00
guanxiatao
e7fafd1941 webhook policy, job, event support
Signed-off-by: guanxiatao <guanxiatao@corp.netease.com>
2019-08-07 20:30:26 +08:00
Ziming Zhang
730d95edc8 check rule conflict
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I95f7e683b30fa6059b5bb49a2fc8f78dd7276079
2019-08-07 17:52:47 +08:00
Ziming Zhang
3b62addc76 check rule conflict
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I8af648f22aa3fe76024240d322a7fdae560e3fbd
2019-08-07 15:38:21 +08:00
ethan
f463b7c449 project_test.go: many typos "respose" fixup
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
2019-08-07 13:39:05 +08:00
Wenkai Yin
216ef269b3 Populate pull/push time properties to the returning data when listing tags
Populate pull/push time properties to the returning data when listing tags

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-07 11:47:05 +08:00
Nathan Lowe
9a7df265ce
Retention: New Evaluator: Pulled within the last N Days
Signed-off-by: Nathan Lowe <public@nlowe.me>
2019-08-06 22:28:28 -04:00
Wenkai Yin(尹文开)
ec4fa753d7
Merge pull request #8552 from nlowe/feat/retention/GH-8549-Pushed-in-the-last-N-Days
Retention: New Evaluator: Retain Images pushed within N days
2019-08-07 09:55:05 +08:00
Ziming Zhang
498a813299 retain nothing rule
Change-Id: I4e7a4ecb40fe39b80e41a6d9bf8b5fb3968a41af
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-06 15:10:27 +08:00
Nathan Lowe
756352d271
Add metadata for daysps to the API for the UI
Signed-off-by: Nathan Lowe <public@nlowe.me>
2019-08-05 20:08:34 -04:00
Ziming Zhang
3a80123a82 1. remove rule always
2. update i18n

Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I0e2394f0a6b283d0efef7a44ed2d4afb9745eabd
2019-08-05 17:59:00 +08:00
Ziming Zhang
decffdd6a4 add total page num for tag retention
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I58a250dbb643f6949c1e34aa3a84a01dc3e0b285
2019-08-02 14:43:52 +08:00
He Weiwei
8cc9314984
feat(helm-chart,quota): count quota support for helm chart (#8439)
* feat(helm-chart,quota): count quota support for helm chart

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-07-31 16:48:40 +08:00
wang yan
4410cc93f9 add internal reg request handler chain
this is for internal registry api call, the request should be intercpeted by quota middlerwares, like retag and delete.
Note: The api developer has to know that if the internal registry call in your api, please consider to use
NewRepositoryClientForLocal() to init the repository client, which can handle quota change.

Signed-off-by: wang yan <wangyan@vmware.com>
2019-07-30 19:39:56 +08:00
Steven Zou
4bf7f7b3e4
Merge pull request #8445 from steven-zou/fix/tag_retention
refactor index registering processes
2019-07-30 07:58:14 +08:00
Ziming Zhang
ba47b4c00f get execution status on the fly
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: Iefcf8946d7a2c7a27bc22bd326ee9723b4b79c66
2019-07-29 14:48:39 +08:00
Steven Zou
6479a22a08 refacor index registering processes
Signed-off-by: Steven Zou <szou@vmware.com>
2019-07-29 14:01:47 +08:00
Ziming Zhang
83b045f5ec add ut for tag retention controller
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I1469ee13675537ec389a068e4bc29e457b402fa4
2019-07-26 17:55:11 +08:00
He Weiwei
c566a48880 fix(api,project): fix repo, chart count missing in project summary
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-07-26 13:15:44 +08:00
wang yan
676b922c95 merge with latest master code with quota branch
Signed-off-by: wang yan <wangyan@vmware.com>
2019-07-26 01:32:45 +08:00
He Weiwei
f3a2280033
Merge pull request #8384 from heww/quota-apis
feat(quota,api): APIs for quotas
2019-07-25 15:19:46 +08:00
He Weiwei
e625f2aa11 feat(quota,api): APIs for quotas
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-07-25 13:40:26 +08:00
Steven Zou
584dcd8571 support dry run of retention
Signed-off-by: Steven Zou <szou@vmware.com>
2019-07-25 12:53:19 +08:00
wang yan
4763864dae merge with latest master code with quota feature branch
Signed-off-by: wang yan <wangyan@vmware.com>
2019-07-24 08:47:05 -07:00