You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/03/01 07:51:48 UTC

(incubator-devlake) branch main updated: [bitbucket_server] Add WRAP_RESPONSE_ERROR in config to avoid SSRF when testing connections (#7082)

This is an automated email from the ASF dual-hosted git repository.

lynwee pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d63009c6 [bitbucket_server] Add WRAP_RESPONSE_ERROR in config to avoid SSRF when testing connections (#7082)
5d63009c6 is described below

commit 5d63009c6e81a8145836183fe565abfce5611d66
Author: Lynwee <li...@merico.dev>
AuthorDate: Fri Mar 1 15:51:43 2024 +0800

    [bitbucket_server] Add WRAP_RESPONSE_ERROR in config to avoid SSRF when testing connections (#7082)
    
    * feat(plugins): add WRAP_RESPONSE_ERROR in config to avoid SSRF when testing connections
    
    * fix(plugins): update error messages
    
    * feat(bitbucket_server): add WRAP_RESPONSE_ERROR in config to avoid SSRF when testing connections
---
 backend/plugins/bitbucket_server/api/connection.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/backend/plugins/bitbucket_server/api/connection.go b/backend/plugins/bitbucket_server/api/connection.go
index 7998b138e..74353c413 100644
--- a/backend/plugins/bitbucket_server/api/connection.go
+++ b/backend/plugins/bitbucket_server/api/connection.go
@@ -78,7 +78,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
 	// test connection
 	result, err := testConnection(context.TODO(), connection)
 	if err != nil {
-		return nil, err
+		return nil, plugin.WrapTestConnectionErrResp(basicRes, err)
 	}
 	return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil
 }
@@ -99,7 +99,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
 	// test connection
 	result, err := testConnection(context.TODO(), connection.BitbucketServerConn)
 	if err != nil {
-		return nil, err
+		return nil, plugin.WrapTestConnectionErrResp(basicRes, err)
 	}
 	return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil
 }