From 12991de476dfdb4f55d34e3089cc79359ab372bf Mon Sep 17 00:00:00 2001 From: Lynwee Hou Date: Fri, 1 Mar 2024 14:55:13 +0800 Subject: [PATCH 1/2] feat(plugins): add WRAP_RESPONSE_ERROR in config to avoid SSRF when testing connections --- backend/core/plugin/plugin_api.go | 15 +++++++++++++++ backend/plugins/ae/api/connection.go | 12 ++++++++++-- backend/plugins/bamboo/api/connection_api.go | 4 ++-- backend/plugins/bitbucket/api/connection_api.go | 4 ++-- backend/plugins/circleci/api/connection.go | 4 ++-- backend/plugins/feishu/api/connection.go | 4 ++-- backend/plugins/gitee/api/connection.go | 4 ++-- backend/plugins/github/api/connection_api.go | 4 ++-- backend/plugins/gitlab/api/connection_api.go | 4 ++-- backend/plugins/jenkins/api/connection_api.go | 4 ++-- backend/plugins/jira/api/connection_api.go | 4 ++-- backend/plugins/opsgenie/api/connection.go | 12 ++++++++++-- backend/plugins/pagerduty/api/connection.go | 12 ++++++++++-- backend/plugins/slack/api/connection.go | 4 ++-- backend/plugins/sonarqube/api/connection_api.go | 12 ++++++++++-- backend/plugins/tapd/api/connection.go | 4 ++-- backend/plugins/teambition/api/connection.go | 4 ++-- backend/plugins/trello/api/connection.go | 4 ++-- backend/plugins/zentao/api/connection.go | 4 ++-- env.example | 5 +++++ 20 files changed, 88 insertions(+), 36 deletions(-) diff --git a/backend/core/plugin/plugin_api.go b/backend/core/plugin/plugin_api.go index d1eb1a07a4e..8993c736c1b 100644 --- a/backend/core/plugin/plugin_api.go +++ b/backend/core/plugin/plugin_api.go @@ -18,6 +18,7 @@ limitations under the License. package plugin import ( + "github.com/apache/incubator-devlake/core/context" "github.com/apache/incubator-devlake/core/errors" "github.com/apache/incubator-devlake/core/models/common" "net/http" @@ -71,3 +72,17 @@ type ApiResourceHandler func(input *ApiResourceInput) (*ApiResourceOutput, error type PluginApi interface { ApiResources() map[string]map[string]ApiResourceHandler } + +const wrapResponseError = "WRAP_RESPONSE_ERROR" + +func WrapTestConnectionErrResp(basicRes context.BasicRes, err errors.Error) errors.Error { + if err == nil { + return err + } + if !basicRes.GetConfigReader().GetBool(wrapResponseError) { + return err + } + statusCode := err.GetType().GetHttpCode() + message := "Something is wrong when testing your connection, please check your input params." + return errors.HttpStatus(statusCode).New(message) +} diff --git a/backend/plugins/ae/api/connection.go b/backend/plugins/ae/api/connection.go index 16de356b31b..5ad29f0f8ef 100644 --- a/backend/plugins/ae/api/connection.go +++ b/backend/plugins/ae/api/connection.go @@ -73,7 +73,11 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, if err = api.Decode(input.Body, &connection, vld); err != nil { return nil, errors.BadInput.Wrap(err, "could not decode request parameters") } - return testConnection(context.TODO(), connection) + result, err := testConnection(context.TODO(), connection) + if err != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) + } + return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } // TestExistingConnection test ae connection @@ -94,7 +98,11 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource if err := api.DecodeMapStruct(input.Body, connection, false); err != nil { return nil, err } - return testConnection(context.TODO(), connection.AeConn) + result, err := testConnection(context.TODO(), connection.AeConn) + if err != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) + } + return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } // @Summary create ae connection diff --git a/backend/plugins/bamboo/api/connection_api.go b/backend/plugins/bamboo/api/connection_api.go index 1c1bb098203..cbd13cb2781 100644 --- a/backend/plugins/bamboo/api/connection_api.go +++ b/backend/plugins/bamboo/api/connection_api.go @@ -72,7 +72,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 } @@ -96,7 +96,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.BambooConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/bitbucket/api/connection_api.go b/backend/plugins/bitbucket/api/connection_api.go index f9f185389cb..7d705782201 100644 --- a/backend/plugins/bitbucket/api/connection_api.go +++ b/backend/plugins/bitbucket/api/connection_api.go @@ -86,7 +86,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 } @@ -110,7 +110,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.BitbucketConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/circleci/api/connection.go b/backend/plugins/circleci/api/connection.go index 0169b767980..909b2c77fae 100644 --- a/backend/plugins/circleci/api/connection.go +++ b/backend/plugins/circleci/api/connection.go @@ -81,7 +81,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 } @@ -106,7 +106,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.CircleciConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/feishu/api/connection.go b/backend/plugins/feishu/api/connection.go index de64f3a7b5d..6d0abb986cd 100644 --- a/backend/plugins/feishu/api/connection.go +++ b/backend/plugins/feishu/api/connection.go @@ -72,7 +72,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 } @@ -97,7 +97,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.FeishuConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/gitee/api/connection.go b/backend/plugins/gitee/api/connection.go index ee290994880..be61db56db4 100644 --- a/backend/plugins/gitee/api/connection.go +++ b/backend/plugins/gitee/api/connection.go @@ -89,7 +89,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 } @@ -114,7 +114,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.GiteeConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/github/api/connection_api.go b/backend/plugins/github/api/connection_api.go index 64556cd0135..b02b5ec1afc 100644 --- a/backend/plugins/github/api/connection_api.go +++ b/backend/plugins/github/api/connection_api.go @@ -78,7 +78,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, } testConnectionResult, err := testConnection(context.TODO(), conn) if err != nil { - return nil, errors.Convert(err) + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } @@ -394,7 +394,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource } testConnectionResult, testConnectionErr := testExistingConnection(context.TODO(), connection.GithubConn) if testConnectionErr != nil { - return nil, testConnectionErr + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) } return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } diff --git a/backend/plugins/gitlab/api/connection_api.go b/backend/plugins/gitlab/api/connection_api.go index 16f492f9f1e..5acce35e9ca 100644 --- a/backend/plugins/gitlab/api/connection_api.go +++ b/backend/plugins/gitlab/api/connection_api.go @@ -91,7 +91,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, } 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 } @@ -110,7 +110,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource return nil, errors.Convert(err) } if result, err := testConnection(context.TODO(), connection.GitlabConn); err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } else { return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/jenkins/api/connection_api.go b/backend/plugins/jenkins/api/connection_api.go index 8d24b6758c4..ce2454b0d91 100644 --- a/backend/plugins/jenkins/api/connection_api.go +++ b/backend/plugins/jenkins/api/connection_api.go @@ -92,7 +92,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 } @@ -112,7 +112,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource } // test connection if result, err := testConnection(context.TODO(), connection.JenkinsConn); err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } else { return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/jira/api/connection_api.go b/backend/plugins/jira/api/connection_api.go index 08692a72777..b06840260fc 100644 --- a/backend/plugins/jira/api/connection_api.go +++ b/backend/plugins/jira/api/connection_api.go @@ -137,7 +137,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 } @@ -157,7 +157,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource } // test connection if result, err := testConnection(context.TODO(), connection.JiraConn); err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } else { return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/opsgenie/api/connection.go b/backend/plugins/opsgenie/api/connection.go index 2b078bc8a14..d53b8b00a46 100644 --- a/backend/plugins/opsgenie/api/connection.go +++ b/backend/plugins/opsgenie/api/connection.go @@ -75,7 +75,11 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource if err := api.DecodeMapStruct(input.Body, connection, false); err != nil { return nil, err } - return testOpsgenieConn(context.Background(), connection.OpsgenieConn) + testConnectionResult, testConnectionErr := testOpsgenieConn(context.Background(), connection.OpsgenieConn) + if testConnectionErr != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) + } + return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } // TestConnection test opsgenie connection @@ -93,7 +97,11 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, if err != nil { return nil, err } - return testOpsgenieConn(context.Background(), connection) + testConnectionResult, testConnectionErr := testOpsgenieConn(context.TODO(), connection) + if testConnectionErr != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) + } + return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } // @Summary create opsgenie connection diff --git a/backend/plugins/pagerduty/api/connection.go b/backend/plugins/pagerduty/api/connection.go index 668a2c8b401..0c29062ece0 100644 --- a/backend/plugins/pagerduty/api/connection.go +++ b/backend/plugins/pagerduty/api/connection.go @@ -65,7 +65,11 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, if err != nil { return nil, err } - return testConnection(context.TODO(), connection) + testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection) + if testConnectionErr != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) + } + return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } // TestExistingConnection test pagerduty connection @@ -85,7 +89,11 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource if err := api.DecodeMapStruct(input.Body, connection, false); err != nil { return nil, err } - return testConnection(context.TODO(), connection.PagerDutyConn) + testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection.PagerDutyConn) + if testConnectionErr != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) + } + return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } // @Summary create pagerduty connection diff --git a/backend/plugins/slack/api/connection.go b/backend/plugins/slack/api/connection.go index 887f3649343..466288163ff 100644 --- a/backend/plugins/slack/api/connection.go +++ b/backend/plugins/slack/api/connection.go @@ -72,7 +72,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 } @@ -97,7 +97,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.SlackConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/sonarqube/api/connection_api.go b/backend/plugins/sonarqube/api/connection_api.go index 9c2cab11d9e..29f26370cf4 100644 --- a/backend/plugins/sonarqube/api/connection_api.go +++ b/backend/plugins/sonarqube/api/connection_api.go @@ -91,7 +91,11 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, if err = api.Decode(input.Body, &connection, vld); err != nil { return nil, err } - return testConnection(context.TODO(), connection) + testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection) + if testConnectionErr != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) + } + return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } // TestExistingConnection test sonarqube connection options @@ -108,7 +112,11 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource return nil, errors.Convert(err) } // test connection - return testConnection(context.TODO(), connection.SonarqubeConn) + testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection.SonarqubeConn) + if testConnectionErr != nil { + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) + } + return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } // PostConnections create sonarqube connection diff --git a/backend/plugins/tapd/api/connection.go b/backend/plugins/tapd/api/connection.go index ecb1f100282..56b09e92bab 100644 --- a/backend/plugins/tapd/api/connection.go +++ b/backend/plugins/tapd/api/connection.go @@ -85,7 +85,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 } @@ -110,7 +110,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource // test connection result, err := testConnection(context.TODO(), connection.TapdConn) if err != nil { - return nil, err + return nil, plugin.WrapTestConnectionErrResp(basicRes, err) } return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil } diff --git a/backend/plugins/teambition/api/connection.go b/backend/plugins/teambition/api/connection.go index 69ac33075b1..1d935f06d5f 100644 --- a/backend/plugins/teambition/api/connection.go +++ b/backend/plugins/teambition/api/connection.go @@ -99,7 +99,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 } @@ -123,7 +123,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource } testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection.TeambitionConn) if testConnectionErr != nil { - return nil, testConnectionErr + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) } return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } diff --git a/backend/plugins/trello/api/connection.go b/backend/plugins/trello/api/connection.go index ba939ae6266..0ca05430dd9 100644 --- a/backend/plugins/trello/api/connection.go +++ b/backend/plugins/trello/api/connection.go @@ -85,7 +85,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 } @@ -109,7 +109,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource } testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection.TrelloConn) if testConnectionErr != nil { - return nil, testConnectionErr + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) } return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } diff --git a/backend/plugins/zentao/api/connection.go b/backend/plugins/zentao/api/connection.go index f3eafbd4f13..7be4a768bff 100644 --- a/backend/plugins/zentao/api/connection.go +++ b/backend/plugins/zentao/api/connection.go @@ -92,7 +92,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 } @@ -116,7 +116,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource } testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection.ZentaoConn) if testConnectionErr != nil { - return nil, testConnectionErr + return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) } return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil } diff --git a/env.example b/env.example index 3812bd1f7c6..e615f98d7f9 100755 --- a/env.example +++ b/env.example @@ -62,3 +62,8 @@ ENCRYPTION_SECRET= # Set if skip verify and connect with out trusted certificate when use https ########################## IN_SECURE_SKIP_VERIFY= + +########################## +# Set if response error when requesting /connections/{connection_id}/test should be wrapped or not +########################## +WRAP_RESPONSE_ERROR= From 28bfc0751fd1a0b6ec9a1e0c6b5eed1691f97f6a Mon Sep 17 00:00:00 2001 From: Lynwee Hou Date: Fri, 1 Mar 2024 15:28:23 +0800 Subject: [PATCH 2/2] fix(plugins): update error messages --- backend/core/plugin/plugin_api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/plugin/plugin_api.go b/backend/core/plugin/plugin_api.go index 8993c736c1b..f9195d2eed4 100644 --- a/backend/core/plugin/plugin_api.go +++ b/backend/core/plugin/plugin_api.go @@ -83,6 +83,6 @@ func WrapTestConnectionErrResp(basicRes context.BasicRes, err errors.Error) erro return err } statusCode := err.GetType().GetHttpCode() - message := "Something is wrong when testing your connection, please check your input params." + message := "Something went wrong when testing your connection, please check your connection details." return errors.HttpStatus(statusCode).New(message) }