Commit Graph

437 Commits

Author SHA1 Message Date
Ziming Zhang
5622a20058 feat(pkg) move artifactselector to src/internal
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2020-03-10 17:01:25 +08:00
Ziming
890200ea19
feature(tag_retention) add webhook for deleted artifacts (#10982)
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2020-03-10 10:46:58 +08:00
Wenkai Yin(尹文开)
307dbc6fba
Accept the pagination information in the separated query string (#10991)
Accept the pagination information in the separated query string

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-03-09 22:19:42 +08:00
Wenkai Yin(尹文开)
30896f3a10
Merge pull request #10968 from ywk253100/200306_artifact_query
Add support for querying artifact by labels and tags
2020-03-09 14:10:19 +08:00
wang yan
b23111063d add no expriation limited robot account
"-1" means the robot account is a permanent account, no expiration time set.
The ExpiresAt claim is optional, so if it's not set, it will still be considered a valid claim

Signed-off-by: wang yan <wangyan@vmware.com>
2020-03-08 16:47:40 +08:00
Wenkai Yin
b14762ee17 Add support for querying artifact by labels and tags
Add support for querying artifact by labels and tags

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-03-07 11:32:15 +08:00
Wang Yan
ea45fee3fe
Merge pull request #10954 from wy65701436/fix-gc-job
Fix gc issue on clean the artifact trash
2020-03-06 14:47:05 +08:00
Wenkai Yin(尹文开)
63cf1041f7
Merge pull request #10941 from ywk253100/200304_query_label
Implement query string builder
2020-03-06 13:18:10 +08:00
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
Wenkai Yin
8abb630b4c Implement query string builder
This commit defines the API query string format and provides the builders to build query string to query model

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-03-05 17:46:11 +08:00
stonezdj(Daojun Zhang)
49619e1907
Merge pull request #10939 from wy65701436/access-log-mgr
add audit logs API
2020-03-05 16:24:21 +08:00
wang yan
df237a5b17 add audit logs API
1, add API entry for get audit logs
2. add audit log manager to hanlder CRUD

Use the new format of audit log to cover differernt resource, artifact/tag/repostory/project

Signed-off-by: wang yan <wangyan@vmware.com>
2020-03-05 11:40:51 +08:00
Wenkai Yin
76c04b0219 Persistent the URLs and annotations of artifact references in database
Persistent the URLs and annotations of artifact references in database

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-03-05 10:54:45 +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
Ziming
70dcca6579
Merge pull request #10857 from bitsf/remove_pkg_art
feat(oci) remove dead code pkg/art
2020-03-03 11:50:15 +08:00
Wang Yan
54227f1ba2 update chart sdk to support helm v3
Signed-off-by: wang yan <wangyan@vmware.com>
2020-03-02 11:39:09 +08:00
Ziming Zhang
aee2c672e7 feat(oci) remove pkg/art dead code for OCI
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2020-03-02 10:34:34 +08:00
Wenkai Yin
4c9b59c904 Migrate artifact data in 2.0
Abstract extra attributes and annotations for artifacts stored in database

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-28 18:09:02 +08:00
He Weiwei
0f5a115a65
feat(artifact): add Walk method to artifact controller (#10881)
1. Add Walk method to artifact controller.
2. Only query references when artifact is image index.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-02-28 17:19:36 +08:00
wang yan
79cf21f82f add tag controller
use the tag controller to handle CRUD of tags, especially the delete scenario, it could validate
the immutable and signature. And move the code of tag handling from artifact controller to tag controller

Signed-off-by: wang yan <wangyan@vmware.com>
2020-02-28 11:42:10 +08:00
Wenkai Yin(尹文开)
e3f73a3efd
Merge pull request #10792 from ninjadq/fix_chart_api_for_v2_0
Fix URL issue introduced by api version
2020-02-27 08:01:50 +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
Wenkai Yin
02c2647e1e Use the repository name of artifact model
As we store the repository name in the artifact table, we can use it direclty in the code to reduce the database query

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-26 13:37:09 +08:00
Wenkai Yin(尹文开)
bf4d141a77
Merge pull request #10827 from reasonerjt/refresh-notary-test-data
Refresh notary test data
2020-02-25 08:08:27 +08:00
Daniel Jiang
340726f7d3 Refresh notary test data
Refresh the valid signature data before it's expired

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2020-02-24 19:46:17 +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
ab3aad4d50 Implement the resolver for CNAB
This commit introduces a new resolver to resolver metadata for CNAB

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-23 07:23:22 +08:00
He Weiwei
f36152a560
feat(vulnerability): assemble vulnerabilities info for artifact (#10800)
1. Assemble scan overview to artifact when scanner enabled in the
project of the artifact.
2. Set addition link for vulnerabilities to artifact when scanner
enabled in the project of the artifact.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-02-22 13:29:58 +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
Wenkai Yin
9312b788dc Upgrade the artifact table
Split the table artifact into artifact and tags, and populate related data

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-21 20:37:31 +08:00
He Weiwei
88fcacd4b7
feat(middleware): add blob middlewares (#10710)
1. Add middleware to record the accepted blob size for stream blob
upload.
2. Add middleware to create blob and associate it with project after blob upload
complete.
3. Add middleware to sync blobs, create blob for manifest and associate blobs
with the manifest after put manifest.
4. Add middleware to associate blob with project after mount blob.
5. Cleanup associations for the project when artifact deleted.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-02-20 23:20:34 +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
Wenkai Yin
c4d4850845 Implement copy artifact API
Copy artifact into the repository from the specified artifact

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-20 16:59:35 +08:00
Wenkai Yin
1db0077096 Implement delete/update repository API
Implement delete/update repository API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-20 08:39:26 +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
Wang Yan
22021a988e
Merge pull request #10753 from wy65701436/artifact-trash
add artifact trash manager
2020-02-19 19:14:48 +08:00
Steven Zou
f1374737f6
Merge pull request #10694 from danielpacak/feature/install_with_trivy
chore(install): Add --with-trivy arg to the installation script
2020-02-19 16:27:57 +08:00
Wang Yan
f160505686 add artifact trash manager
1, move the deleted artifact into trash
2, disable GC to delete the untagged manifest

Signed-off-by: wang yan <wangyan@vmware.com>
2020-02-19 14:52:58 +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 Pacak
1fbc3dcb39 refactor: Allow EnsureScanners to accept multiple scanner registrations
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
2020-02-18 17:31:26 +01:00
Daniel Pacak
93f05b3643 refactor(scanners): Allow RemoveImmutableScanners() to accept multiple endpoint URLs
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
2020-02-18 12:47:27 +01:00
Wenkai Yin
9d2f1d4d66 Refactor the logic of deleting artifact
Delete the child artifacts along with the parent when deleting an artifact

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-18 16:20:17 +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
Wang Yan
e5eb711827
Merge pull request #10720 from wy65701436/chart-details
Get addition properties for chart
2020-02-17 13:36:24 +08:00
wang yan
8029f70ae5 Get addition properties for chart
1, Get readme.md content into addition
2, Get dependency of chart
3, Get values of chart

Signed-off-by: wang yan <wangyan@vmware.com>
2020-02-17 12:19:10 +08:00
Wenkai Yin(尹文开)
d7903fcf1b
Merge pull request #10682 from ywk253100/200126_label
Support add/remove label to/from artifact
2020-02-17 11:33:45 +08:00
Wenkai Yin
eceb9b2345 Fix bugs when pushing image(with index) and CNAB
1. As "List" method of artifact DAO doesn't return the artifacts that referenced by other and without tag, so we introduce a new method "GetByDigest" to check the existence of artifact
2. The "Www-Authenticate" header is needed to be returned when the request is unauthorized. This is required in the OCI distribution spec and is needed when pushing CNAB

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-14 15:24:14 +08:00
Daniel Pacak
5f110c800a feat: Initialize scanner registrations properly
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
2020-02-13 14:02:04 +01:00
Wenkai Yin
93731eeb2e Support add/remove label to/from artifact
This commit add supporting for adding/removing label to/from artifacts and populates labels when listing artifacts

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-13 10:46:23 +08:00
Wenkai Yin
0373e08e58 Add query string to listing artifact API to support specify only show the tagged artifacts
Specify the query string "tags=NOT_NULL" to the listing artifact API to only return the tagged artifacts

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-10 14:53:51 +08:00
Wang Yan
72f9e02dd9
Merge pull request #10628 from wy65701436/af-immu
set the immutable status on getting/listting tag
2020-02-05 21:03:29 +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
Wenkai Yin(尹文开)
260d43db4f
Merge pull request #10627 from ywk253100/200202_reference
Add child artifact digest in reference model
2020-02-05 13:31:12 +08:00
wang yan
a53df4863d fix issue on listing robot accounts
Update the query FuzzyMatch when to list robot accounts per project

Signed-off-by: wang yan <wangyan@vmware.com>
2020-02-05 11:36:18 +08:00
Wenkai Yin
7930e4f38a Add child artifact digest in reference model
As we only provide the API to get artifact information via project name, repository name and digest, the digest of child artifact must be returned

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-04 15:59:06 +08:00
Wenkai Yin
ef3af85a5b Register registry handler with the new methods of Route
Register registry handler with the new methods of Route

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-02-03 16:55:08 +08:00
Wenkai Yin
d0ac70d26c Implement the get/delete handler for registry API
Implement the get/delete handler for registry API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-01-28 11:01:17 +08:00
Wenkai Yin(尹文开)
a774a19823
Merge pull request #10537 from ywk253100/200115_artifact_api
Implement the listing artifact API
2020-01-22 08:05:12 +08:00
Wenkai Yin
19f4bad042 Implement the listing artifact API
Implement the listing artifact API

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-01-22 07:35:29 +08:00
Wenkai Yin(尹文开)
17318aedc3
Merge pull request #10547 from ywk253100/200120_artifact
Add foreign key to avoid the concurrent issue
2020-01-21 17:44:27 +08:00
Wenkai Yin
7dc28bcff9 Add foreign key to avoid the concurrent issue
Add foreign key to avoid the concurrent issue when operating the artifacts, tags and references

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-01-21 16:03:51 +08: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
ff1a03cccc Get the ormer from context instead of creating a new one
This commit updates the dao methods with the ormer got from context

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2020-01-14 16:35:36 +08:00
Qian Deng
ceb4bbf849
Merge pull request #10394 from heww/cherry-pick-pr-10393
[Cherry pick]fix(scanner): use new created ormer for transaction
2020-01-09 14:29:47 +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
He Weiwei
b90ac468c5 fix(scanner): use new created ormer for transaction
Use new created ormer for transaction in SetDefaultRegistration

Closes #10284

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-01-03 05:25:32 +00: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
ac605db5da Define the controller/manager interface for artifact and tag
1. Define the controller/manager interface for artifact and tag
    2. Provide a null implementation for artifact manager

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-12-24 17:12:55 +08:00
Wenkai Yin(尹文开)
5836b1eb83
Merge pull request #10138 from ywk253100/191204_artifact
Create the models for OCI supporting
2019-12-12 16:38:40 +08:00
Wenkai Yin
7b41c900a7 Create the models for OCI supporting
This commits does some basic init work for supporting OCI:
1. Create the artifact and tag model
2. Create database tables

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-12-12 16:05:38 +08:00
Steven Zou
27420b8660 fix[scan]:missing header in v1 client
- add the missing resolver calls to the v1 client

fix #10108

Signed-off-by: Steven Zou <szou@vmware.com>
2019-12-11 17:10:57 +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
3664bf36d2 populate group list when doing token review
This commit fixes #9869
It has some refactor to make sure the group is populated when user is
authenticated via tokenreview workflow.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-11-26 13:31:42 +08:00
Daniel Jiang
70a2930330
Merge pull request #9919 from wy65701436/fix-9880
add empter result to list immutable rules
2019-11-19 00:01:41 -08:00
wang yan
e854c4fa1b add empter result to list immutable rules
Fix #9880

Signed-off-by: wang yan <wangyan@vmware.com>
2019-11-19 15:27:01 +08:00
Wang Yan
bc0ff095c3
Merge pull request #9899 from heww/fix-9767
fix(scanner): process scenario reinstall without clair flag
2019-11-19 13:17:28 +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
He Weiwei
0246ca7aa4 fix(scanner): process scenario reinstall without clair flag
1. Fix name conflict when install internal clair adapter.
2. Remove all internal adapters when reinstall harbor without --with-clair flag

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-11-15 09:47:30 +00: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
Wang Yan
88773436c9
Merge pull request #9865 from wy65701436/quota-event
add quota exceed event imple
2019-11-15 11:37:19 +08:00
wang yan
f8390c5ec1 add quota exceed event imple
Signed-off-by: wang yan <wangyan@vmware.com>
2019-11-14 10:27:18 +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
Steven Zou
7bdf24961c add scan by info in the scan report summary
- fix #9795

Signed-off-by: Steven Zou <szou@vmware.com>
2019-11-08 17:35:39 +08:00
Wang Yan
9929780904
Merge pull request #9799 from wy65701436/fix-sort-immu-rule
Fix immutable rule sequence to list API
2019-11-08 14:19:29 +08:00
wang yan
cbc9414db8 Fix immutable rule sequence to list API
Signed-off-by: wang yan <wangyan@vmware.com>
2019-11-07 18:37:02 +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
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
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
Wenkai Yin(尹文开)
2101d7125c
Merge pull request #9680 from heww/install-clair-adapter-imporvement
fix(scanner): imporve clair adapter initializing
2019-11-01 10:42:04 +08: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
Wang Yan
fa784d7514
Merge pull request #9649 from wy65701436/fix-9081
add ldflags for harbor compiler and linker
2019-10-31 19:14:16 +08:00
He Weiwei
7170485a9b fix(scanner): imporve clair adapter initializing
1. Remove ping action when initialize clair adapter installed by harbor.
2. Remvoe the `IsDefault` property when initialize clair adapter that
make it switch to auto detecting.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-31 08:03:37 +00: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
He Weiwei
3c80832341 fix(quota): order by quotas only on support resources
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-30 02:42:34 +00:00
Steven Zou
19eb0ae7f4
Merge pull request #9637 from steven-zou/fix/bug_#9629
fix the bug of returning errors when nothing is updated
2019-10-29 17:37:06 +08:00
Steven Zou
cb8d4d0daf fix the bug of returning errors nothing is updated
- bug details: #9629
- root cause: the preconditions for updating may not be matched

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-29 15:34:34 +08:00
Steven Zou
35d074e849 fix bug found in the pluggable scanner
- fix #9632
- fix #9633

Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-29 15:32:51 +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
He Weiwei
28e0c0693b Upgrade clair adapter to v1.0.0
1. Upgrade clair adapter to v1.0.0.
2. Make the clair adapter which installed by harbor immutable and using internal registry address.
3. Add support to build clair adapter image from binary.
4. Switch to ScannerPull action when make authorization for the scan request.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-26 17:25:36 +00: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
Wang Yan
d18678a48d
Merge pull request #9506 from wy65701436/token-sevice
Enable robot account to support scan pull case
2019-10-24 19:52:33 +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
13499fb60b
Merge pull request #9491 from bitsf/tag_retention_webhook
implement log for tag retention immutable tags
2019-10-24 17:06:00 +08:00
Ziming Zhang
e757899b49 add special error/log for not delete immutable tag in tag retention job
Change-Id: I3440f3b888bf8c65afc75d04253eea41f20eef0e
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-10-24 15:25:48 +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
wang yan
a6ad1b2db8 update code per review comments
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-23 20:05:51 +08:00
wang yan
2fa85aefca fix per comments
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-23 18:45:30 +08:00
wang yan
5996189bb0 update per comments and fix govet error
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-23 18:45:30 +08:00
wang yan
22b4ea0f89 Enable robot account bypass policy check
1, the commit is for internal robot to bypass policy check, like vul and signature checking.
2, add a bool attribute into registry token, decode it in the harbor core and add the status into request context.
3, add a bool attribut for robot API controller, but API will not use it.y

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-23 18:45:30 +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
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
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
Wenkai Yin(尹文开)
5c5e475da4
Merge pull request #9415 from steven-zou/fix/pluggable_scanner_policy_check
do changes to let the vul policy check compatible with new framework
2019-10-18 09:39:20 +08:00
Wang Yan
51d3134e4f
Merge pull request #9427 from wy65701436/immutable-middleware
add immutable tag middleware
2019-10-17 20:28:34 +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
wang yan
da02b820ad add immutable tag middleware
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-17 16:58:11 +08:00
He Weiwei
8964a8697a build(clair): internal clair adapter when install with clair
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-10-17 12:00:51 +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(尹文开)
372875ad64
Merge pull request #9393 from wy65701436/immutable-match
add immutable match
2019-10-15 18:51:43 +08:00
wang yan
ae4c698ab4 use only 1 repo and tag selector to match
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-15 16:44:17 +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
7c16cbfeef fix scan controller test introduced by api change
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-14 14:39:46 +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
wang yan
c597e46756 do not expose visible attribute of robot account to user
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-14 14:11:09 +08:00
Steven Zou
6e8e601c8d make robot account with new robot controller
Signed-off-by: Steven Zou <szou@vmware.com>
2019-10-12 16:34:08 +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
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
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
wang yan
8317100cda continue refactor API
Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-09 23:06:35 +08: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
stonezdj
cc22a175b9 Add immutable tag API
Signed-off-by: stonezdj <stonezdj@gmail.com>
2019-09-25 15:53:56 +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
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
Ziming Zhang
f6ac2687fa fix dayspl/daysps test
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I3c654e305f774c2329109888f68e708efeca721e
2019-09-20 18:32:58 +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
42a5db83b2 refactor selector of retention
extract select from pkg/retention, move it to pkg/artselector to make it usable by immutable tag

Signed-off-by: wang yan <wangyan@vmware.com>
2019-09-18 16:38:41 +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
Daniel Jiang
76a79869df The default item list should be empty list,not null
This commit make sure that the "items" in response of project level
CVE_whitelist is not null, even when it's null in the DB the API will
return an empty list

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-09-04 17:59:56 +08:00
Ziming Zhang
22e7f22b30 tag retention fix duration and show trigger
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I7f93dd4c1b93b8d7e6b2c2a14fd4ccf128945def
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-30 11:48:11 +08:00
Wenkai Yin(尹文开)
881884786d
Merge pull request #8883 from bitsf/tag_retention_log
enhance tag retention log
2019-08-30 10:48:01 +08:00
Ziming Zhang
247ef1b884 enhance tag retention log
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: Id5946c2dd53868fdd5f5abbcca45e453bc9ba4fd
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-29 18:40:00 +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
03309680ff
Merge pull request #8873 from bitsf/tag_retention_log_time
show empty if time is 0
2019-08-29 12:39:22 +08:00
Daniel Jiang
9fa70db866
Merge pull request #8867 from bitsf/tag_retention_same_digest_tag
Tag retention same digest tag
2019-08-29 12:26:44 +08:00
Ziming Zhang
57a34a7d8d show empty if time is 0
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I5acc13714dbb1dc1d8bf3f1c6c620a7d54f86910
2019-08-29 12:10:22 +08:00
Ziming Zhang
6137065eba prevent retained tag with same digest deleted by other tag
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I527ec87f48348c6607b1c9529c90f5ad804bd8f6
2019-08-29 10:21:13 +08:00
Ziming Zhang
4248f7a45e prevent retained tag with same digest deleted by other tag
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I37a3ef0d4cff7214e35076453494d89f0ad84d43
2019-08-28 18:27:35 +08:00
Ziming Zhang
8290af6d25 prevent retained tag with same digest deleted by other tag
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: Ie5f77db58e71636cd9aaf322bb3f83a0090f8877
2019-08-28 18:24:55 +08:00
Ziming Zhang
063f2bfee9 prevent retained tag with same digest deleted by other tag
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I6a69b405b454ca0350677204e06bfa2b24616b33
2019-08-28 17:48:42 +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
Steven Zou
a80969e7af fix rule logic bug described in #8817 (#8818)
Signed-off-by: Steven Zou <szou@vmware.com>
2019-08-23 18:49:44 +08:00
Ziming Zhang
52b9fbc8f3 fix tag retention model verify
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: Ifb237bbed4c6d7272ace62da7603e027c1481aef
2019-08-23 15:48:33 +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
Wenkai Yin
661470e7bc Add status revision to retention task to handle retrying
Add status revision to retention task to handle retrying

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-22 20:04:25 +08:00
He Weiwei
311028be37
test: fix TestIsNegative (#8783)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-08-22 15:27:49 +08: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
217252a097
Merge pull request #8675 from ywk253100/190814_retention_task
Handle the retention task status updating in concurrency
2019-08-20 17:07:21 +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
He Weiwei
75772aae11
refactor(quota): new error types for quota checking (#8726)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-08-19 19:00:29 +08:00
Ziming
0c79352c9c
fix tag retention schedule none error (#8715)
Change-Id: I04cad9d4c520db751bfa413bb139317563716501
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-19 12:25:54 +08:00
Daniel Jiang
b3abd0316b
Merge pull request #8713 from reasonerjt/fix-8702
Avoid overwriting system CVE whitelist by mistake
2019-08-19 01:42:58 +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
Daniel Jiang
30bb2ddcdf Avoid overwriting system CVE whitelist by mistake
Fixes #8702
Also enforce the code to mitigate the potential risk.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-08-16 13:28:16 +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
Wenkai Yin
48b067f596 Handle the retention task status updating in concurrency
Compare the status code when updating retention task status to avoid the concurrent issue

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-15 18:36:18 +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
Steven Zou
f3ba25f656
Merge pull request #8536 from bitsf/tag_retention_task_num
add task retain num
2019-08-07 17:39:39 +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
Wenkai Yin(尹文开)
556e07f0c4
Merge pull request #8551 from nlowe/feat/retention/GH-8548-Pulled-in-the-last-N-Days
Retention: New Evaluator: Pulled within the last N Days
2019-08-07 11:37:46 +08:00
Wenkai Yin(尹文开)
a00b1aab8d
Merge pull request #8581 from ywk253100/190806_retention_disable_chart
Comment the related code for chart retention
2019-08-07 11:04:43 +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
Steven Zou
bbc7d1cb24
Merge pull request #8562 from bitsf/tag_retention_nothing_rule
retain nothing rule
2019-08-06 20:15:19 +08:00
Steven Zou
92c2cfa35a
Merge pull request #8529 from bitsf/tag_retention_disable_rule
add disable rule feature for tag retention
2019-08-06 20:05:28 +08:00
Wenkai Yin
0ac4ae687d Comment the related code for chart retention
As we don't provide the capability for chart rerention currently, this commit comments related code

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-08-06 19:07:38 +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
Ziming Zhang
57e7854beb add disable rule feature for tag retention
Change-Id: I335f1fb3e1273c945dda85999a0218440092be12
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-06 15:05:20 +08:00
Nathan Lowe
0db203a395
Fix failing test for the index
Signed-off-by: Nathan Lowe <public@nlowe.me>
2019-08-05 23:56:15 -04:00
Nathan Lowe
9f88e78381
Register the new evaluator with the index package
Signed-off-by: Nathan Lowe <public@nlowe.me>
2019-08-05 20:05:33 -04:00
Ziming Zhang
026aee75d9 add task retain num
Signed-off-by: Ziming Zhang <zziming@vmware.com>
Change-Id: I2f8b89454fe3bb9b56af237048c9e2b90783f434
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-08-05 17:57:09 +08:00
Nathan Lowe
14eff4d9f2
Add comment to make the linter happy
Signed-off-by: Nathan Lowe <public@nlowe.me>
2019-08-05 00:30:29 -04:00
Nathan Lowe
71ada8b21d
Retention: New Evaluator: Retain Images pushed within N days
Signed-off-by: Nathan Lowe <public@nlowe.me>
2019-08-04 20:12:38 -04:00