Commit Graph

46 Commits

Author SHA1 Message Date
stonezdj(Daojun Zhang) 96ba34a93c
Allow empty path in redirect_url (#20238)
fixes #20226

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
2024-04-09 02:24:57 +00:00
stonezdj(Daojun Zhang) 5b832c1724
Limit url to local path (#20025) 2024-02-24 01:34:30 +00:00
stonezdj(Daojun Zhang) b337f51e7e
Replace comma in username to avoid casbin issue (#19505)
Check username when creating user by API
   Replace comma with underscore in username for OnboardUser
   Fixes #19356

Signed-off-by: stonezdj <daojunz@vmware.com>
2023-11-02 03:50:50 +00:00
Shengwen YU 88c6018950
fix: cron string validation (#19071)
fix: cron string validation (the 1st field of a cron string must be 0 when there are 6 fields)

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2023-08-09 10:22:54 +08:00
stonezdj(Daojun Zhang) 320c64e433
Sort user and usergroup by most match order (#18273)
fixes #17859

Signed-off-by: stonezdj <daojunz@vmware.com>
2023-03-01 10:11:21 +08:00
stonezdj(Daojun Zhang) 66d34c8e0c
Return time.Time{} when cron string is empty (#17289)
change log level to debug to avoid noise

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-08-02 15:18:25 +08:00
Shengwen YU c2a9f5de64
fix: update code for golangci-lint gosimple (#16974)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
2022-06-14 13:44:09 +08:00
stonezdj(Daojun Zhang) 0dc7a6806c
Add NextScheduledTime in schedule object (#16925)
Add NextSchedule in utils
  Add NextScheduledTime in ScheduleObj to display it in UI

Signed-off-by: stonezdj <stonezdj@gmail.com>
2022-06-06 22:17:41 +08:00
chlins 9e8218f63b fix: handle codeql golang security issues
Signed-off-by: chlins <chenyuzh@vmware.com>
2021-10-22 10:51:26 +08:00
Wang Yan 248be37c3e
clean code of common util (#15287)
Remove the useless code from the common util

Signed-off-by: Wang Yan <wangyan@vmware.com>
2021-07-09 15:35:05 +08:00
stonezdj 107e468b60 Refactor configure api to new programming model
Changes include:
1. Move core/config to controller/config
2. Change the job_service and gcreadonly to depends on lib/config instead of core/config
3. Move the config related dao, manager and driver to pkg/config
4. Adjust the invocation of the config API, most of then should provide a context parameter, when accessing system config, you can call it with background context, when accessing user config, the context should provide orm.Context

Signed-off-by: stonezdj <stonezdj@gmail.com>
2021-04-09 08:10:11 +08:00
Flávio Ramalho ef6414be3e
Fix deadlock on harbor-core initialization
During the harbor core initialization if the database takes longer to
be ready there is a risk of deadlock when checking for the TCP connection
with the database.

The `TestTCPConn` function uses unbuffered channels to check when the
connection succeeds/timeouts. The timeout check is executed in parallel
with the connection check (this runs in a gorountine). The deadlock happens
when the goroutine execution takes longer than the function timeout
(hence setting `cancel <- 1`) and the DialTimeout call succeeds (hence
setting `success <- 1`). At this point both threads are waiting for the
channels values to be read.

This is reproducible mostly on slow systems where initializing the
database takes longer and finishes during the 5th time of the
`DialTimeout` call where it eventually exceeds the TestTCPConn timeout.

This fix sets the `success` and `cancel` channels as buffered
(non-blocking).

Signed-off-by: Flávio Ramalho <framalho@suse.com>
2020-10-28 17:09:34 +01:00
stonezdj 82f59cb760 Add temporary secret for harbor proxy service
Use GenerateRandomStringWithLength function to generate secret for harbor_proxyservice
Add harbor-proxyservice secret used by proxy service

Signed-off-by: stonezdj <stonezdj@gmail.com>
2020-06-15 14:43:43 +08:00
wang yan a11a70d941 move logger from common to lib
The logger is the fundamental library, so move it into lib folder
Signed-off-by: wang yan <wangyan@vmware.com>
2020-04-02 14:09:03 +08:00
He Weiwei 89dfe24f19
feat(quota): add Request and Refresh middlewares for APIs (#10907)
1. Introduce ReqquestMiddleware and RefereshMiddleware.
2. Add request middlware to copy artifact, mount blob, put blob upload,
put manifest, upload chart verson APIs.
3. Add refresh project middleware to delete manifest, delete artifact,
delete chart version, delete repository APIs.

Signed-off-by: He Weiwei <hweiwei@vmware.com>
2020-03-11 22:25:40 +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 a23ff4e448 Update pull time in artifact table for docker image pull
Signed-off-by: wang yan <wangyan@vmware.com>
2019-07-28 12:30:20 +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
Yan da0e20ec60
Add controller to onboard oidc user (#7286)
Signed-off-by: wang yan <wangyan@vmware.com>
2019-04-03 20:47:22 +08:00
stonezdj 1ae5126bb4 Refactor adminserver stage 3: replace config api and change ut settings
Signed-off-by: stonezdj <stonezdj@gmail.com>
2019-02-18 14:06:19 +08:00
clouderati 587459df15 Replacing copyright notices with "Copyright Project Harbor Authors".
Signed-off-by: clouderati <35942204+clouderati@users.noreply.github.com>
2018-09-19 16:59:36 +00:00
Wenkai Yin 1f195c2b5f
Merge pull request #5840 from Colstuwjx/fix-tcp-probe
Fix `TestTCPConn` break issue.
2018-09-10 14:46:04 +08:00
Daniel Jiang cd31cbf892
Merge pull request #5828 from stonezdj/ldap_caseinsense
LDAP group DN should be case insensitively
2018-09-07 10:48:31 +08:00
Colstuwjx e49a9de2f4 Fix `TestTCPConn` break issue.
Signed-off-by: Colstuwjx <Colstuwjx@gmail.com>
2018-09-06 14:58:04 +08:00
stonezdj 9dca49ba6e LDAP group DN should be case insensitive
Fix issue #5776, LDAP servers are case insensitive. because only LDAP
group DN is used to compare/equal operation, lowercase all LDAP group DN
when retrieves it from LDAP server, and lowercase them before save in DB

Signed-off-by: stonezdj <stonezdj@gmail.com>
2018-09-06 11:33:05 +08:00
陈德 0582db9a82 Apply consistent format for comments
Signed-off-by: 陈德 <chende@caicloud.io>
2018-09-05 16:16:31 +08:00
Wenkai Yin 49bb5cfafb Test TCP connection before upgrading database schema
This commit moves the database schema upgrading after database initialization. The init will test TCP connection.

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2018-09-05 02:07:47 +08:00
Daniel Jiang dcf4e2ee78 Update import path in go code
vmware -> goharbor

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2018-08-23 17:50:53 +08:00
Yan efdb57548f
add admin job api (#5344)
It supports Harbor admin to trigger job either manual or
schedule. The job will be populated to job service to execute. 
The api includes:
1. POST /api/system/gc
2, GET /api/system/gc/:id 
3, GET /api/system/gc/:id/log
4, PUT/GET/POST /api/system/gc/schedule
2018-07-20 19:22:37 +08:00
stonezdj f5e82f75a7 Add SafeCast function and set default value for some sytem configure
Add SafeCastString, SafeCastInt, SafeCastFloat64, SafeCastBool function to check
the type matched and avoid panic in runtime

Add default value to configure settings to avoid cannot save configure
issue
2018-07-17 17:00:06 +08:00
Wenkai Yin 9022abfc13 Fix code issues found by Gas 2018-01-29 15:17:03 +08:00
Wenkai Yin 3448fd9a2d Fix SSRF security issue #3755 in ping target, email server and LDAP server APIs 2018-01-04 12:26:17 +08:00
Wenkai Yin e79334a445 Add interfaces to implement project level policy (#3271)
* add interfaces to implement project level policy
2017-09-26 16:41:08 +08:00
Steven Zou 8f921db588 Refine scheduler 2017-07-19 16:57:22 +08:00
Steven Zou db58ca673d Fix issue of detecting configuration changes 2017-07-17 17:39:41 +08:00
Steven Zou ff889cedde Fix conflict 2017-07-07 20:15:40 +08:00
Steven Zou a0718385c1 Fix the import cycle issue 2017-07-07 20:12:01 +08:00
Wenkai Yin f7412b0c31 update auth context as Admiral's API changed 2017-07-06 18:32:22 +08:00
Wenkai Yin b2380818fd support query logs according to conditions 2017-06-08 14:44:08 +08:00
Tan Jiang da19700a1e replace math/rand with crypto/rand 2017-04-25 17:47:40 +08:00
wy65701436 53f7cfb967 replace go header 2017-04-13 03:54:58 -07:00
Wenkai Yin 414e8a8bcf Merge remote-tracking branch 'upstream/dev' into 170224_merge_config
Conflicts:
	make/docker-compose.tpl
	src/ui/service/token/authutils.go
2017-02-24 13:52:19 +08:00
Wenkai Yin dc432d5575 support multiple namespace fix #1217 2017-02-07 13:13:42 +08:00
Wenkai Yin f1f78a5649 update 2017-01-19 17:56:08 +08:00
Wenkai Yin b62a958250 configure harbor 2017-01-12 17:15:32 +08:00
yhua 311cf8da07 change code 20161019 2016-10-21 18:39:10 +08:00