summaryrefslogtreecommitdiffstats
path: root/modules/lfs
diff options
context:
space:
mode:
authorPhilip Peterson <pc.peterso@gmail.com>2024-08-04 20:46:05 +0200
committerGusted <postmaster@gusted.xyz>2024-08-22 17:05:07 +0200
commit03508b33a8e890b05d845bbd8ead8672b8f03578 (patch)
tree88e53a4ae4e2efe16e85d819e0702f5f72bb7b98 /modules/lfs
parentMerge pull request '[SEC] Add `keying` module' (#5041) from gusted/sec-keying... (diff)
downloadforgejo-03508b33a8e890b05d845bbd8ead8672b8f03578.tar.xz
forgejo-03508b33a8e890b05d845bbd8ead8672b8f03578.zip
[FEAT] Allow pushmirror to use publickey authentication
- Continuation of https://github.com/go-gitea/gitea/pull/18835 (by @Gusted, so it's fine to change copyright holder to Forgejo). - Add the option to use SSH for push mirrors, this would allow for the deploy keys feature to be used and not require tokens to be used which cannot be limited to a specific repository. The private key is stored encrypted (via the `keying` module) on the database and NEVER given to the user, to avoid accidental exposure and misuse. - CAVEAT: This does require the `ssh` binary to be present, which may not be available in containerized environments, this could be solved by adding a SSH client into forgejo itself and use the forgejo binary as SSH command, but should be done in another PR. - CAVEAT: Mirroring of LFS content is not supported, this would require the previous stated problem to be solved due to LFS authentication (an attempt was made at forgejo/forgejo#2544). - Integration test added. - Resolves #4416
Diffstat (limited to 'modules/lfs')
-rw-r--r--modules/lfs/endpoint.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/lfs/endpoint.go b/modules/lfs/endpoint.go
index 2931defcd9..97bd7d4446 100644
--- a/modules/lfs/endpoint.go
+++ b/modules/lfs/endpoint.go
@@ -60,6 +60,10 @@ func endpointFromURL(rawurl string) *url.URL {
case "git":
u.Scheme = "https"
return u
+ case "ssh":
+ u.Scheme = "https"
+ u.User = nil
+ return u
case "file":
return u
default: