summaryrefslogtreecommitdiffstats
path: root/modules/private
Commit message (Collapse)AuthorAgeFilesLines
* Clean up various use of escape/unescape functions for URL generation (#6334)mrsdizzie2019-03-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use PathUnescape instead of QueryUnescape when working with branch names Currently branch names with a '+' fail in certain situations because QueryUnescape replaces the + character with a blank space. Using PathUnescape should be better since it is defined as: // PathUnescape is identical to QueryUnescape except that it does not // unescape '+' to ' ' (space). Fixes #6333 * Change error to match new function name * Add new util function PathEscapeSegments This function simply runs PathEscape on each segment of a path without touching the forward slash itself. We want to use this instead of PathEscape/QueryEscape in most cases because a forward slash is a valid name for a branch etc... and we don't want that escaped in a URL. Putting this in new file url.go and also moving a couple similar functions into that file as well. * Use EscapePathSegments where appropriate Replace various uses of EscapePath/EscapeQuery with new EscapePathSegments. Also remove uncessary uses of various escape/unescape functions when the text had already been escaped or was not escaped. * Reformat comment to make drone build happy * Remove no longer used url library * Requested code changes
* Use url.PathEscape to escape the branchname (#6304)zeripath2019-03-122-2/+4
| | | | | | * Use url.PathEscape to escape the branchname * GetRepositoryByOwnerAndName should also have url.PathEscape as the owner and reponame are provided by the client
* Fix ssh deploy and user key constraints (#1357) (#5939)zeripath2019-02-031-0/+25
| | | | | | | | | | | | | | | | 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 TLS errors when using acme/autocert for local connections (#5820)Joona Hoikkala2019-01-231-0/+1
|
* fix clone wiki failed via ssh (#5503)Lunny Xiao2018-12-111-0/+33
|
* Restrict permission check on repositories and fix some problems (#5314)Lunny Xiao2018-11-281-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-303-12/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Give user a link to create PR after push (#4716)Julien Tant2018-10-201-0/+68
| | | | | | | | * Give user a link to create PR after push * Forks now create PR in the base repository + make sure PR creation is allowed * fix code style
* improve protected branch to add whitelist support (#2451)Lunny Xiao2017-09-141-0/+26
| | | | | | | | | | | | | | | | | | | | * improve protected branch to add whitelist support * fix lint * fix style check * fix tests * fix description on UI and import * fix test * bug fixed * fix tests and languages * move isSliceInt64Eq to util pkg; improve function names & typo
* Fix internal requests when gitea listens to unix socket or only external IP ↵Lauris BH2017-08-033-11/+18
| | | | | | | | (#2234) * Fix internal requests when gitea listens to unix socket or only external IP * When Gitea is set to listen using FastCGI use AppURL for LocalURL
* Drop db operations from hook commands (#1514)Lunny Xiao2017-05-043-0/+90
| | | | | | | | | | * move all database operations from hook command to web command and instead of internal routes * bug fixed * adjust the import path sequences * remove unused return value on hookSetup
* Add internal routes for ssh hook comands (#1471)Lunny Xiao2017-04-191-0/+53
* 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