gitea/modules/private
zeripath 01c10a951b
Fix ssh deploy and user key constraints (#1357) (#5939)
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
2019-02-03 23:56:53 +00:00
..
branch.go Make gitea serv use api/internal (#4886) 2018-10-30 14:20:13 +08:00
internal.go Fix TLS errors when using acme/autocert for local connections (#5820) 2019-01-23 19:47:54 -05:00
key.go Fix ssh deploy and user key constraints (#1357) (#5939) 2019-02-03 23:56:53 +00:00
push_update.go Fix internal requests when gitea listens to unix socket or only external IP (#2234) 2017-08-03 23:32:13 +08:00
repository.go Give user a link to create PR after push (#4716) 2018-10-20 09:59:06 +03:00
wiki.go fix clone wiki failed via ssh (#5503) 2018-12-11 13:37:32 -05:00