diff --git a/modules/git/remote.go b/modules/git/remote.go index d7c49a44015..530a813f825 100644 --- a/modules/git/remote.go +++ b/modules/git/remote.go @@ -91,9 +91,9 @@ func IsRemoteNotExistError(err error) bool { // normalizeSSHURL converts SSH-SCP format URLs to standard ssh:// format for security func normalizeSSHURL(remoteAddr string) (string, error) { - if strings.HasPrefix(remoteAddr, "ssh://") { - return remoteAddr, nil - } + if strings.HasPrefix(remoteAddr, "ssh://") { + return remoteAddr, nil + } if strings.Contains(remoteAddr, "://") { return remoteAddr, errors.New("remoteAddr has a scheme") } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 323e0d64ac5..8230d564d70 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -3311,6 +3311,92 @@ } } }, + "/orgs/{org}/mirror-ssh-key": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get SSH public key for organization mirroring", + "operationId": "orgGetMirrorSSHKey", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "SSH public key", + "schema": { + "type": "object", + "properties": { + "fingerprint": { + "type": "string" + }, + "public_key": { + "type": "string" + } + } + } + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/mirror-ssh-key/regenerate": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Regenerate SSH keypair for organization mirroring", + "operationId": "orgRegenerateMirrorSSHKey", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "New SSH public key", + "schema": { + "type": "object", + "properties": { + "fingerprint": { + "type": "string" + }, + "public_key": { + "type": "string" + } + } + } + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/orgs/{org}/public_members": { "get": { "produces": [ @@ -19627,6 +19713,68 @@ } } }, + "/user/mirror-ssh-key": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get SSH public key for user mirroring", + "operationId": "userGetMirrorSSHKey", + "responses": { + "200": { + "description": "SSH public key", + "schema": { + "type": "object", + "properties": { + "fingerprint": { + "type": "string" + }, + "public_key": { + "type": "string" + } + } + } + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/mirror-ssh-key/regenerate": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Regenerate SSH keypair for user mirroring", + "operationId": "userRegenerateMirrorSSHKey", + "responses": { + "200": { + "description": "New SSH public key", + "schema": { + "type": "object", + "properties": { + "fingerprint": { + "type": "string" + }, + "public_key": { + "type": "string" + } + } + } + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/user/orgs": { "get": { "produces": [