summaryrefslogtreecommitdiffstats
path: root/cmd/serv.go
Commit message (Collapse)AuthorAgeFilesLines
* Fix ssh deploy and user key constraints (#1357) (#5939)zeripath2019-02-031-7/+8
| | | | | | | | | | | | | | | | 1. A key can either be an ssh user key or a deploy key. It cannot be both. 2. If a key is a user key - it can only be associated with one user. 3. If a key is a deploy key - it can be used in multiple repositories and the permissions it has on those repositories can be different. 4. If a repository is deleted, its deploy keys must be deleted too. We currently don't enforce any of this and multiple repositories access with different permissions doesn't work at all. This PR enforces the following constraints: - [x] You should not be able to add the same user key as another user - [x] You should not be able to add a ssh user key which is being used as a deploy key - [x] You should not be able to add a ssh deploy key which is being used as a user key - [x] If you add an ssh deploy key to another repository you should be able to use it in different modes without losing the ability to use it in the other mode. - [x] If you delete a repository you must delete all its deploy keys. Fix #1357
* Fix notifications on pushing with deploy keys by setting hook environment ↵zeripath2019-02-031-0/+6
| | | | | | | | | | | | | variables (#5935) The gitea prerecieve and postrecieve hooks and the gitea PushUpdate function require that the PusherID and PusherName are real users. Previously, these environment variables were not being set when using a deploy key - the main result being that pushing to empty repositories meant that is_empty status was not changed. I've also added an integration test to ensure that the is_empty status is updated on pushing with a deploy key. There is a slight issue in that the deploy key is now considered a proxy for the owner - we don't have a way of separating out the deploy key from the owner at present. This can be fixed in another PR. Fix #3795 Signed-off-by: Andrew Thornton art27@cantab.net
* Fix #5866: Silence console logger in gitea serv (#5887)zeripath2019-02-031-0/+1
| | | | | | | By default, if `setting.NewContext()` prints out any warning logs, these are printed to the stdout breaking `git receive-pack` etc. meaning that even if there is a warning because of a minor problem in your app.ini but gitea starts despite this - you **CANNOT** push or pull over SSH. This PR disables the console logger whilst in `serv.go` Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix lfs version check warning log when using ssh protocol (#5501)Lunny Xiao2018-12-191-0/+22
|
* fix clone wiki failed via ssh (#5503)Lunny Xiao2018-12-111-4/+8
|
* Restrict permission check on repositories and fix some problems (#5314)Lunny Xiao2018-11-281-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix units permission problems * fix some bugs and merge LoadUnits to repoAssignment * refactor permission struct and add some copyright heads * remove unused codes * fix routes units check * improve permission check * add unit tests for permission * fix typo * fix tests * fix some routes * fix api permission check * improve permission check * fix some permission check * fix tests * fix tests * improve some permission check * fix some permission check * refactor AccessLevel * fix bug * fix tests * fix tests * fix tests * fix AccessLevel * rename CanAccess * fix tests * fix comment * fix bug * add missing unit for test repos * fix bug * rename some functions * fix routes check
* Make gitea serv use api/internal (#4886)Antoine GIRARD2018-10-301-34/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start to move to internal/private * Add GetPublicKeyByID * Add HasDeployKey * Add private.UpdateDeployKeyUpdated * Add private.GetUserByKeyID * Add private.AccessLevel * Add private.CheckUnitUser * Fix mistakes I made * Some cleaning + moving code to separate files * Fix error handling * Remove useless error handling for setup * lint: fix comment on exported func * fix copyright header * Fix order of args
* cmd/serve: pprof cpu and memory profile dumps to disk (#4560)Jerry Jacobs2018-08-071-0/+16
|
* LFS: make HTTP auth period configurable (#4035)Inon S2018-05-291-1/+1
| | | | | | | | | | | | | | * LFS: make HTTP auth period configurable * Formatting: Removed semicolon Due to automated fmt-check failure (drone.gitea.io) * applying code reviews * Applied code review comment: Change HTTPAuthExpiry to time.Duration * Updated config cheat sheet
* Do not allow inactive users to access repositories using private keys (#3887)Lauris BH2018-05-021-0/+6
|
* Fix SSH auth lfs locks (#3152)Antoine GIRARD2018-01-271-2/+6
| | | | | | | | | | * Fix SSH auth LFS locks * Activate SSH/lock test * Remove debug * Follow @lunny recommendation for AfterLoad method
* Improvements for supporting UI Location (#3146)Lunny Xiao2017-12-141-2/+3
| | | | | | * improvements for supporting UI Location * improved the comment
* Remove GetRepositoryByRef and add GetRepositoryByOwnerAndName (#3043)Lunny Xiao2017-12-021-11/+3
| | | | | | | | | | * remove GetRepositoryByRef and add GetRepositoryByOwnerAndName * fix tests * fix tests bug * some improvements
* Set session and indexers' data files rel to AppDataPath (#2192)Guillaume Dube2017-11-031-3/+3
| | | | | | | | | | * Set session and indexers' data files rel to AppDataPath The setting AppDataPath is now relative to the working directory. The session svc's PROVIDER_CONFIG now defaults to AppDataPath/data/sessions. The issue indexer's IssuePath now defaults to AppDataPath/indexers/issues.bleves. * fix bug
* feat: add check misspelling (#1877)Bo-Yi Wu2017-06-051-1/+1
|
* fix admin lost permission caused by #947Lunny Xiao2017-05-191-1/+1
|
* Add units to team (#947)Lunny Xiao2017-05-181-0/+8
| | | | | | | | | | | | | | | | | | * add units to team * fix lint * finish team setting backend * finished permission controll on routes * fix import blank line * add unit check on ssh/http pull and push and fix test failed * fix fixtures data * remove unused code
* Remove env user salt since no need to use (#1515)Lunny Xiao2017-05-061-2/+0
| | | | | | * remove env user salt since no need to use * remove unused variable from update.go
* Add internal routes for ssh hook comands (#1471)Lunny Xiao2017-04-191-1/+2
| | | | | | | | | | | | | | | | * add internal routes for ssh hook comands * fix lint * add comment on why package named private not internal but the route name is internal * add comment above package private why package named private not internal but the route name is internal * remove exp time on internal access * move routes from /internal to /api/internal * add comment and defer on UpdatePublicKeyUpdated
* refactor: show command help message. (#1486)Bo-Yi Wu2017-04-121-1/+3
|
* refactor update ssh key use time (#1466)Lunny Xiao2017-04-071-7/+1
|
* LFS: Fix SSH authentication for trailing arguments (#1328)Fabian Zaremba2017-03-221-3/+5
| | | Fixes #1296
* Allow push to init a wiki repo (#1279)Lunny Xiao2017-03-171-0/+6
| | | | | | * allow push to init a wiki repo * compact error check
* Refactor and fix incorrect comment (#1247)Ethan Koenig2017-03-151-1/+1
|
* Move push update to post-receive and protected branch check to pre-receive ↵Lunny Xiao2017-02-251-63/+13
| | | | | | | | | | | | (#1030) * move all push update to git hook post-receive and protected branch check to git hook pre-receive * add SSH_ORIGINAL_COMMAND check back * remove all unused codes * fix the import
* Take back control of hooks (#1006)Lunny Xiao2017-02-231-0/+373
* git: delegate all server-side Git hooks (#1623) * create hooks directories * take control hooks back * fix lint * bug fixed and minor changes * fix imports style * fix migration scripts