Commit Graph

465 Commits

Author SHA1 Message Date
Wang Yan
17ad4aca55
Merge pull request #9343 from ywk253100/191009_bug_fix
Check the existence of project before the next action
2019-10-14 11:27:34 +08:00
Steven Zou
a86afd6ebc Merge branch 'master' into feature/pluggable_scanner_s3_merge 2019-10-12 15:18:06 +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
Wang Yan
d7375992b5
Merge pull request #9363 from wy65701436/robot-refactor
refactor robot api
2019-10-11 18:16:28 +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
wang yan
8c155e0c50 fix quota migration still execute on launch even data sync success
This commit is to fix the issue for the following scenario:
1, user success migrate harbor to v1.9.0 from a previous version
2, add a project, push images into the project.
3, delete images and then to delete the project.
4, re-launch harbor.

After that, it still execute the quota migration as the condition doesn't consider the deleted projects usage.
And in this case, the harbor core crashes with a duplicate sql err, and unable to launch.

[Workaroud]
Clean table of project_blob with: TRUNCATE TABLE project_blob, and re-launch harbor, wait for quota sync success.

Signed-off-by: wang yan <wangyan@vmware.com>
2019-10-11 01:25:21 +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
Wenkai Yin
a61c928e34 Check the existence of project before the next action
Fixes #8234, check the existence of project to avoid the panic

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-10-09 16:54:10 +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
Wenkai Yin(尹文开)
cabe0b6243
Merge pull request #9253 from heww/patch-blob-upload-improvement
Patch blob upload improvement
2019-09-26 13:59:15 +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
He Weiwei
3e515bfabb feat(quota): skip to save blob size when quota disabled
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-09-25 09:19:20 +00:00
He Weiwei
d8c2bf6f86 fix(quota): handle range header missing in response
Signed-off-by: He Weiwei <hweiwei@vmware.com>
2019-09-25 09:17:22 +00: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
5498b5719b remove filter redeclared as imported package name in base.go
It's introduced by https://github.com/goharbor/harbor/pull/8976

Signed-off-by: wang yan <wangyan@vmware.com>
2019-09-17 16:36:59 +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
f36efa4dcd Add groups claim to OIDC configuration
This commit add the new setting "oidc_groups_claim" to Harbor's
configurations.
And add "group_claim" to OIDCSetting struct.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2019-09-16 15:54:14 +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
Wenkai Yin(尹文开)
d762e0730a
Merge pull request #8843 from heww/fix-chart-builder
fix(chart,quota): fix path regexp of chart creation and deletion
2019-09-02 15:59:18 +08:00
Iradier, AlvaroJose
bf9ac08c89 Handle error on OIDC callback
If wrong OIDC scopes are defined, or there are some configuration errors, the OIDC callback query string might contain "error=..." with an error message. Intercept this case and show an error to the user instead of trying to exchange the token with a missing "code" parameter.

Signed-off-by: Iradier, AlvaroJose <AlvaroJose.Iradier@adidas.com>

Change error variable name

Signed-off-by: Iradier, AlvaroJose <AlvaroJose.Iradier@adidas.com>
2019-08-30 13:44:12 +02:00
Wenkai Yin(尹文开)
8c67f71b5e
Merge pull request #8902 from wy65701436/fix-8888
fix #8888
2019-08-30 18:09:56 +08:00
wang yan
dd9f028fe0 fix #8888
the image may has the same blobs as the references, which causes the artifact & blobs
can not be inserted by unique constraint

Signed-off-by: wang yan <wangyan@vmware.com>
2019-08-30 15:30:05 +08:00