From 36c3398c6da0f9aa53405cacbdebf2510138d63d Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Fri, 3 Jun 2022 17:38:22 +0200 Subject: [PATCH] Datasource: Remove support for unencrypted passwords (#49987) * Datasource: Remove support for unencrypted passwords * regenerate swagger * [WIP] Remove references to datasource password and basic auth password fields (#50015) * try delete moar tings * delete provisioning stuff * remove from yaml * update snapshots * remove lingering snapshot fields * fix ds http settings * Re-generate swagger and fix swagger-api-spec make target Co-authored-by: Will Browne Co-authored-by: Will Browne --- .betterer.results | 4 +- conf/provisioning/datasources/sample.yaml | 4 - docs/sources/administration/provisioning.md | 4 - docs/sources/datasources/alertmanager.md | 3 +- docs/sources/datasources/loki.md | 3 +- packages/grafana-data/src/types/datasource.ts | 2 - .../DataSourceSettings/BasicAuthSettings.tsx | 6 +- .../CustomHeadersSettings.test.tsx | 2 - .../DataSourceHttpSettings.story.tsx | 2 - .../DataSourceHttpSettings.test.tsx | 2 - pkg/api/datasources.go | 37 ++- pkg/api/dtos/datasource.go | 41 ++- pkg/api/pluginproxy/ds_proxy_test.go | 57 ++-- pkg/models/datasource.go | 80 +++--- .../datasources/service/datasource_service.go | 4 +- .../datasources/config_reader_test.go | 2 - .../all-properties/all-properties.yaml | 2 - .../testdata/all-properties/sample.yaml | 2 - .../testdata/broken-yaml/commented.yaml | 4 - .../testdata/version-0/version-0.yaml | 2 - .../provisioning/datasources/types.go | 245 ++++++++---------- pkg/services/sqlstore/datasource.go | 76 +++--- public/api-merged.json | 39 +-- public/api-spec.json | 39 +-- .../datasources/__mocks__/dataSourcesMocks.ts | 3 - .../DataSourcesListPage.test.tsx.snap | 5 - public/app/features/datasources/mocks.ts | 2 - .../features/datasources/state/navModel.ts | 2 - .../components/ConfigEditor.test.tsx | 2 - .../__snapshots__/ConfigEditor.test.tsx.snap | 10 - .../components/ConfigEditor.test.tsx | 2 - .../influxdb/components/ConfigEditor.test.tsx | 2 - .../__snapshots__/ConfigEditor.test.tsx.snap | 8 - 33 files changed, 268 insertions(+), 430 deletions(-) diff --git a/.betterer.results b/.betterer.results index 8a00f51b03b..320c761b160 100644 --- a/.betterer.results +++ b/.betterer.results @@ -170,7 +170,7 @@ exports[`no enzyme tests`] = { "public/app/plugins/datasource/cloud-monitoring/components/Aggregation.test.tsx:3822406835": [ [1, 19, 13, "RegExp match", "2409514259"] ], - "public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx:1224072551": [ + "public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx:227258837": [ [0, 19, 13, "RegExp match", "2409514259"] ], "public/app/plugins/datasource/cloudwatch/components/LogsQueryField.test.tsx:1501504663": [ @@ -182,7 +182,7 @@ exports[`no enzyme tests`] = { "public/app/plugins/datasource/elasticsearch/configuration/DataLinks.test.tsx:248699332": [ [0, 17, 13, "RegExp match", "2409514259"] ], - "public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx:3456478975": [ + "public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx:57753101": [ [0, 19, 13, "RegExp match", "2409514259"] ], "public/app/plugins/datasource/loki/components/LokiExploreQueryEditor.test.tsx:1488067923": [ diff --git a/conf/provisioning/datasources/sample.yaml b/conf/provisioning/datasources/sample.yaml index 7bef8618a31..2d9bae8ee56 100644 --- a/conf/provisioning/datasources/sample.yaml +++ b/conf/provisioning/datasources/sample.yaml @@ -19,8 +19,6 @@ apiVersion: 1 # orgId: 1 # # url # url: http://localhost:8080 -# # database password, if used -# password: # # database user, if used # user: # # database name, if used @@ -29,8 +27,6 @@ apiVersion: 1 # basicAuth: # # basic auth username # basicAuthUser: -# # basic auth password -# basicAuthPassword: # # enable/disable with credentials headers # withCredentials: # # mark as default datasource. Max one per org diff --git a/docs/sources/administration/provisioning.md b/docs/sources/administration/provisioning.md index ea4b0589af2..eda7e20eeb0 100644 --- a/docs/sources/administration/provisioning.md +++ b/docs/sources/administration/provisioning.md @@ -98,8 +98,6 @@ datasources: uid: my_unique_uid # url url: http://localhost:8080 - # Deprecated, use secureJsonData.password - password: # database user, if used user: # database name, if used @@ -108,8 +106,6 @@ datasources: basicAuth: # basic auth username basicAuthUser: - # Deprecated, use secureJsonData.basicAuthPassword - basicAuthPassword: # enable/disable with credentials headers withCredentials: # mark as default datasource. Max one per org diff --git a/docs/sources/datasources/alertmanager.md b/docs/sources/datasources/alertmanager.md index d2df3d05c61..27522a8f0f9 100644 --- a/docs/sources/datasources/alertmanager.md +++ b/docs/sources/datasources/alertmanager.md @@ -37,5 +37,6 @@ datasources: # optionally basicAuth: true basicAuthUser: my_user - basicAuthPassword: test_password + secureJsonData: + basicAuthPassword: test_password ``` diff --git a/docs/sources/datasources/loki.md b/docs/sources/datasources/loki.md index 737dd17f66c..d6cf28f7663 100644 --- a/docs/sources/datasources/loki.md +++ b/docs/sources/datasources/loki.md @@ -255,7 +255,6 @@ datasources: url: http://localhost:3100 basicAuth: true basicAuthUser: my_user - basicAuthPassword: test_password jsonData: maxLines: 1000 derivedFields: @@ -272,6 +271,8 @@ datasources: - matcherRegex: "traceID=(\\w+)" name: TraceID url: 'http://localhost:16686/trace/$${__value.raw}' + secureJsonData: + basicAuthPassword: test_password ``` Here's an example of a Jaeger data source corresponding to the above example. Note that the Jaeger `uid` value does match the Loki `datasourceUid` value. diff --git a/packages/grafana-data/src/types/datasource.ts b/packages/grafana-data/src/types/datasource.ts index ca269d76d0f..435ae27828a 100644 --- a/packages/grafana-data/src/types/datasource.ts +++ b/packages/grafana-data/src/types/datasource.ts @@ -536,11 +536,9 @@ export interface DataSourceSettings = ({ dataSourceConfi const onPasswordReset = () => { onChange({ ...dataSourceConfig, - basicAuthPassword: '', secureJsonData: { ...dataSourceConfig.secureJsonData, basicAuthPassword: '', @@ -48,10 +47,7 @@ export const BasicAuthSettings: React.FC = ({ dataSourceConfi { typeLogoUrl: '', access: 'direct', url: 'http://localhost:8086', - password: '', user: 'grafana', database: 'site', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, isDefault: false, jsonData: { diff --git a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx index 17ebfcc7b66..9df51502347 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx @@ -17,12 +17,10 @@ const settingsMock: DataSourceSettings = { typeLogoUrl: '', access: 'direct', url: 'http://localhost:8086', - password: '', user: 'grafana', database: 'site', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, isDefault: false, jsonData: { diff --git a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.test.tsx b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.test.tsx index 0f072dde808..2daebd46a92 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.test.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.test.tsx @@ -18,12 +18,10 @@ const setup = (propOverrides?: object) => { typeLogoUrl: '', access: 'direct', url: 'http://localhost:8086', - password: '', user: 'grafana', database: 'site', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, isDefault: false, jsonData: { diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go index 1c43d9f7263..ee331ae92a8 100644 --- a/pkg/api/datasources.go +++ b/pkg/api/datasources.go @@ -48,7 +48,6 @@ func (hs *HTTPServer) GetDataSources(c *models.ReqContext) response.Response { Type: ds.Type, TypeName: ds.Type, Access: ds.Access, - Password: ds.Password, Database: ds.Database, User: ds.User, BasicAuth: ds.BasicAuth, @@ -481,25 +480,23 @@ func (hs *HTTPServer) CallDatasourceResourceWithUID(c *models.ReqContext) { func (hs *HTTPServer) convertModelToDtos(ctx context.Context, ds *models.DataSource) dtos.DataSource { dto := dtos.DataSource{ - Id: ds.Id, - UID: ds.Uid, - OrgId: ds.OrgId, - Name: ds.Name, - Url: ds.Url, - Type: ds.Type, - Access: ds.Access, - Password: ds.Password, - Database: ds.Database, - User: ds.User, - BasicAuth: ds.BasicAuth, - BasicAuthUser: ds.BasicAuthUser, - BasicAuthPassword: ds.BasicAuthPassword, - WithCredentials: ds.WithCredentials, - IsDefault: ds.IsDefault, - JsonData: ds.JsonData, - SecureJsonFields: map[string]bool{}, - Version: ds.Version, - ReadOnly: ds.ReadOnly, + Id: ds.Id, + UID: ds.Uid, + OrgId: ds.OrgId, + Name: ds.Name, + Url: ds.Url, + Type: ds.Type, + Access: ds.Access, + Database: ds.Database, + User: ds.User, + BasicAuth: ds.BasicAuth, + BasicAuthUser: ds.BasicAuthUser, + WithCredentials: ds.WithCredentials, + IsDefault: ds.IsDefault, + JsonData: ds.JsonData, + SecureJsonFields: map[string]bool{}, + Version: ds.Version, + ReadOnly: ds.ReadOnly, } secrets, err := hs.DataSourcesService.DecryptedValues(ctx, ds) diff --git a/pkg/api/dtos/datasource.go b/pkg/api/dtos/datasource.go index 6321d08d7b2..47219992213 100644 --- a/pkg/api/dtos/datasource.go +++ b/pkg/api/dtos/datasource.go @@ -9,27 +9,25 @@ import ( ) type DataSource struct { - Id int64 `json:"id"` - UID string `json:"uid"` - OrgId int64 `json:"orgId"` - Name string `json:"name"` - Type string `json:"type"` - TypeLogoUrl string `json:"typeLogoUrl"` - Access models.DsAccess `json:"access"` - Url string `json:"url"` - Password string `json:"password"` - User string `json:"user"` - Database string `json:"database"` - BasicAuth bool `json:"basicAuth"` - BasicAuthUser string `json:"basicAuthUser"` - BasicAuthPassword string `json:"basicAuthPassword"` - WithCredentials bool `json:"withCredentials"` - IsDefault bool `json:"isDefault"` - JsonData *simplejson.Json `json:"jsonData,omitempty"` - SecureJsonFields map[string]bool `json:"secureJsonFields"` - Version int `json:"version"` - ReadOnly bool `json:"readOnly"` - AccessControl accesscontrol.Metadata `json:"accessControl,omitempty"` + Id int64 `json:"id"` + UID string `json:"uid"` + OrgId int64 `json:"orgId"` + Name string `json:"name"` + Type string `json:"type"` + TypeLogoUrl string `json:"typeLogoUrl"` + Access models.DsAccess `json:"access"` + Url string `json:"url"` + User string `json:"user"` + Database string `json:"database"` + BasicAuth bool `json:"basicAuth"` + BasicAuthUser string `json:"basicAuthUser"` + WithCredentials bool `json:"withCredentials"` + IsDefault bool `json:"isDefault"` + JsonData *simplejson.Json `json:"jsonData,omitempty"` + SecureJsonFields map[string]bool `json:"secureJsonFields"` + Version int `json:"version"` + ReadOnly bool `json:"readOnly"` + AccessControl accesscontrol.Metadata `json:"accessControl,omitempty"` } type DataSourceListItemDTO struct { @@ -42,7 +40,6 @@ type DataSourceListItemDTO struct { TypeLogoUrl string `json:"typeLogoUrl"` Access models.DsAccess `json:"access"` Url string `json:"url"` - Password string `json:"password"` User string `json:"user"` Database string `json:"database"` BasicAuth bool `json:"basicAuth"` diff --git a/pkg/api/pluginproxy/ds_proxy_test.go b/pkg/api/pluginproxy/ds_proxy_test.go index 6e0016868c2..ca90e4271e7 100644 --- a/pkg/api/pluginproxy/ds_proxy_test.go +++ b/pkg/api/pluginproxy/ds_proxy_test.go @@ -366,7 +366,6 @@ func TestDataSourceProxy_routeRule(t *testing.T) { Url: "http://influxdb:8083", Database: "site", User: "user", - Password: "password", } ctx := &models.ReqContext{} @@ -557,18 +556,18 @@ func TestDataSourceProxy_routeRule(t *testing.T) { secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) tests := []*testCase{ - createAuthTest(t, secretsStore, models.DS_INFLUXDB_08, "http://localhost:9090", authTypePassword, authCheckQuery, false), - createAuthTest(t, secretsStore, models.DS_INFLUXDB_08, "http://localhost:9090", authTypePassword, authCheckQuery, true), - createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader, true), - createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader, false), - createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader, true), - createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader, false), + createAuthTest(t, secretsStore, models.DS_INFLUXDB_08, "http://localhost:9090", authTypePassword, authCheckQuery), + createAuthTest(t, secretsStore, models.DS_INFLUXDB_08, "http://localhost:9090", authTypePassword, authCheckQuery), + createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader), + createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader), + createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader), + createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader), // These two should be enough for any other datasource at the moment. Proxy has special handling // only for Influx, others have the same path and only BasicAuth. Non BasicAuth datasources // do not go through proxy but through TSDB API which is not tested here. - createAuthTest(t, secretsStore, models.DS_ES, "http://localhost:9200", authTypeBasic, authCheckHeader, false), - createAuthTest(t, secretsStore, models.DS_ES, "http://localhost:9200", authTypeBasic, authCheckHeader, true), + createAuthTest(t, secretsStore, models.DS_ES, "http://localhost:9200", authTypeBasic, authCheckHeader), + createAuthTest(t, secretsStore, models.DS_ES, "http://localhost:9200", authTypeBasic, authCheckHeader), } for _, test := range tests { runDatasourceAuthTest(t, secretsService, secretsStore, cfg, test) @@ -918,7 +917,7 @@ const ( authCheckHeader = "header" ) -func createAuthTest(t *testing.T, secretsStore kvstore.SecretsKVStore, dsType string, url string, authType string, authCheck string, useSecureJsonData bool) *testCase { +func createAuthTest(t *testing.T, secretsStore kvstore.SecretsKVStore, dsType string, url string, authType string, authCheck string) *testCase { // Basic user:password base64AuthHeader := "Basic dXNlcjpwYXNzd29yZA==" @@ -926,7 +925,7 @@ func createAuthTest(t *testing.T, secretsStore kvstore.SecretsKVStore, dsType st datasource: &models.DataSource{ Id: 1, OrgId: 1, - Name: fmt.Sprintf("%s,%s,%s,%s,%t", dsType, url, authType, authCheck, useSecureJsonData), + Name: fmt.Sprintf("%s,%s,%s,%s", dsType, url, authType, authCheck), Type: dsType, JsonData: simplejson.New(), Url: url, @@ -937,38 +936,28 @@ func createAuthTest(t *testing.T, secretsStore kvstore.SecretsKVStore, dsType st if authType == authTypePassword { message = fmt.Sprintf("%v should add username and password", dsType) test.datasource.User = "user" - if useSecureJsonData { - secureJsonData, err := json.Marshal(map[string]string{ - "password": "password", - }) - require.NoError(t, err) + secureJsonData, err := json.Marshal(map[string]string{ + "password": "password", + }) + require.NoError(t, err) - err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData)) - require.NoError(t, err) - } else { - test.datasource.Password = "password" - } + err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData)) + require.NoError(t, err) } else { message = fmt.Sprintf("%v should add basic auth username and password", dsType) test.datasource.BasicAuth = true test.datasource.BasicAuthUser = "user" - if useSecureJsonData { - secureJsonData, err := json.Marshal(map[string]string{ - "basicAuthPassword": "password", - }) - require.NoError(t, err) + secureJsonData, err := json.Marshal(map[string]string{ + "basicAuthPassword": "password", + }) + require.NoError(t, err) - err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData)) - require.NoError(t, err) - } else { - test.datasource.BasicAuthPassword = "password" - } + err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData)) + require.NoError(t, err) } require.NoError(t, err) - if useSecureJsonData { - message += " from securejsondata" - } + message += " from securejsondata" if authCheck == authCheckQuery { message += " to query params" diff --git a/pkg/models/datasource.go b/pkg/models/datasource.go index 58d1f391c8e..dc2b3e2614a 100644 --- a/pkg/models/datasource.go +++ b/pkg/models/datasource.go @@ -46,16 +46,18 @@ type DataSource struct { OrgId int64 `json:"orgId"` Version int `json:"version"` - Name string `json:"name"` - Type string `json:"type"` - Access DsAccess `json:"access"` - Url string `json:"url"` - Password string `json:"password"` - User string `json:"user"` - Database string `json:"database"` - BasicAuth bool `json:"basicAuth"` - BasicAuthUser string `json:"basicAuthUser"` - BasicAuthPassword string `json:"basicAuthPassword"` + Name string `json:"name"` + Type string `json:"type"` + Access DsAccess `json:"access"` + Url string `json:"url"` + // swagger:ignore + Password string `json:"-"` + User string `json:"user"` + Database string `json:"database"` + BasicAuth bool `json:"basicAuth"` + BasicAuthUser string `json:"basicAuthUser"` + // swagger:ignore + BasicAuthPassword string `json:"-"` WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData *simplejson.Json `json:"jsonData"` @@ -84,21 +86,19 @@ func (ds DataSource) AllowedCookies() []string { // Also acts as api DTO type AddDataSourceCommand struct { - Name string `json:"name" binding:"Required"` - Type string `json:"type" binding:"Required"` - Access DsAccess `json:"access" binding:"Required"` - Url string `json:"url"` - Password string `json:"password"` - Database string `json:"database"` - User string `json:"user"` - BasicAuth bool `json:"basicAuth"` - BasicAuthUser string `json:"basicAuthUser"` - BasicAuthPassword string `json:"basicAuthPassword"` - WithCredentials bool `json:"withCredentials"` - IsDefault bool `json:"isDefault"` - JsonData *simplejson.Json `json:"jsonData"` - SecureJsonData map[string]string `json:"secureJsonData"` - Uid string `json:"uid"` + Name string `json:"name" binding:"Required"` + Type string `json:"type" binding:"Required"` + Access DsAccess `json:"access" binding:"Required"` + Url string `json:"url"` + Database string `json:"database"` + User string `json:"user"` + BasicAuth bool `json:"basicAuth"` + BasicAuthUser string `json:"basicAuthUser"` + WithCredentials bool `json:"withCredentials"` + IsDefault bool `json:"isDefault"` + JsonData *simplejson.Json `json:"jsonData"` + SecureJsonData map[string]string `json:"secureJsonData"` + Uid string `json:"uid"` OrgId int64 `json:"-"` UserId int64 `json:"-"` @@ -110,22 +110,20 @@ type AddDataSourceCommand struct { // Also acts as api DTO type UpdateDataSourceCommand struct { - Name string `json:"name" binding:"Required"` - Type string `json:"type" binding:"Required"` - Access DsAccess `json:"access" binding:"Required"` - Url string `json:"url"` - Password string `json:"password"` - User string `json:"user"` - Database string `json:"database"` - BasicAuth bool `json:"basicAuth"` - BasicAuthUser string `json:"basicAuthUser"` - BasicAuthPassword string `json:"basicAuthPassword"` - WithCredentials bool `json:"withCredentials"` - IsDefault bool `json:"isDefault"` - JsonData *simplejson.Json `json:"jsonData"` - SecureJsonData map[string]string `json:"secureJsonData"` - Version int `json:"version"` - Uid string `json:"uid"` + Name string `json:"name" binding:"Required"` + Type string `json:"type" binding:"Required"` + Access DsAccess `json:"access" binding:"Required"` + Url string `json:"url"` + User string `json:"user"` + Database string `json:"database"` + BasicAuth bool `json:"basicAuth"` + BasicAuthUser string `json:"basicAuthUser"` + WithCredentials bool `json:"withCredentials"` + IsDefault bool `json:"isDefault"` + JsonData *simplejson.Json `json:"jsonData"` + SecureJsonData map[string]string `json:"secureJsonData"` + Version int `json:"version"` + Uid string `json:"uid"` OrgId int64 `json:"-"` Id int64 `json:"-"` diff --git a/pkg/services/datasources/service/datasource_service.go b/pkg/services/datasources/service/datasource_service.go index b17ccb618fe..1a12960103d 100644 --- a/pkg/services/datasources/service/datasource_service.go +++ b/pkg/services/datasources/service/datasource_service.go @@ -340,7 +340,7 @@ func (s *Service) DecryptedBasicAuthPassword(ctx context.Context, ds *models.Dat return value, nil } - return ds.BasicAuthPassword, err + return "", err } func (s *Service) DecryptedPassword(ctx context.Context, ds *models.DataSource) (string, error) { @@ -349,7 +349,7 @@ func (s *Service) DecryptedPassword(ctx context.Context, ds *models.DataSource) return value, nil } - return ds.Password, err + return "", err } func (s *Service) httpClientOptions(ctx context.Context, ds *models.DataSource) (*sdkhttpclient.Options, error) { diff --git a/pkg/services/provisioning/datasources/config_reader_test.go b/pkg/services/provisioning/datasources/config_reader_test.go index fb0811f540b..ed09119fb59 100644 --- a/pkg/services/provisioning/datasources/config_reader_test.go +++ b/pkg/services/provisioning/datasources/config_reader_test.go @@ -240,11 +240,9 @@ func validateDatasource(t *testing.T, dsCfg *configs) { require.Equal(t, ds.OrgID, int64(2)) require.Equal(t, ds.URL, "url") require.Equal(t, ds.User, "user") - require.Equal(t, ds.Password, "password") require.Equal(t, ds.Database, "database") require.True(t, ds.BasicAuth) require.Equal(t, ds.BasicAuthUser, "basic_auth_user") - require.Equal(t, ds.BasicAuthPassword, "basic_auth_password") require.True(t, ds.WithCredentials) require.True(t, ds.IsDefault) require.True(t, ds.Editable) diff --git a/pkg/services/provisioning/datasources/testdata/all-properties/all-properties.yaml b/pkg/services/provisioning/datasources/testdata/all-properties/all-properties.yaml index 0aabaeae8d2..f5f9f6dbc3a 100644 --- a/pkg/services/provisioning/datasources/testdata/all-properties/all-properties.yaml +++ b/pkg/services/provisioning/datasources/testdata/all-properties/all-properties.yaml @@ -6,12 +6,10 @@ datasources: access: proxy orgId: 2 url: url - password: password user: user database: database basicAuth: true basicAuthUser: basic_auth_user - basicAuthPassword: basic_auth_password withCredentials: true isDefault: true jsonData: diff --git a/pkg/services/provisioning/datasources/testdata/all-properties/sample.yaml b/pkg/services/provisioning/datasources/testdata/all-properties/sample.yaml index 2187eabdc46..1876acfa4ec 100644 --- a/pkg/services/provisioning/datasources/testdata/all-properties/sample.yaml +++ b/pkg/services/provisioning/datasources/testdata/all-properties/sample.yaml @@ -9,12 +9,10 @@ apiVersion: 1 # access: proxy # orgId: 2 # url: url -# password: password # user: user # database: database # basicAuth: true # basicAuthUser: basic_auth_user -# basicAuthPassword: basic_auth_password # withCredentials: true # jsonData: # graphiteVersion: "1.1" diff --git a/pkg/services/provisioning/datasources/testdata/broken-yaml/commented.yaml b/pkg/services/provisioning/datasources/testdata/broken-yaml/commented.yaml index b532c9012ec..1f0f5a89ce3 100644 --- a/pkg/services/provisioning/datasources/testdata/broken-yaml/commented.yaml +++ b/pkg/services/provisioning/datasources/testdata/broken-yaml/commented.yaml @@ -16,8 +16,6 @@ # org_id: 1 # # url # url: http://localhost:8080 -# # database password, if used -# password: # # database user, if used # user: # # database name, if used @@ -26,8 +24,6 @@ # basic_auth: # # basic auth username # basic_auth_user: -# # basic auth password -# basic_auth_password: # # enable/disable with credentials headers # with_credentials: # # mark as default datasource. Max one per org diff --git a/pkg/services/provisioning/datasources/testdata/version-0/version-0.yaml b/pkg/services/provisioning/datasources/testdata/version-0/version-0.yaml index fcd4ddd6b01..6a72bc9aa28 100644 --- a/pkg/services/provisioning/datasources/testdata/version-0/version-0.yaml +++ b/pkg/services/provisioning/datasources/testdata/version-0/version-0.yaml @@ -4,12 +4,10 @@ datasources: access: proxy org_id: 2 url: url - password: password user: user database: database basic_auth: true basic_auth_user: basic_auth_user - basic_auth_password: basic_auth_password with_credentials: true is_default: true json_data: diff --git a/pkg/services/provisioning/datasources/types.go b/pkg/services/provisioning/datasources/types.go index b52b9cad3af..64ae67c8111 100644 --- a/pkg/services/provisioning/datasources/types.go +++ b/pkg/services/provisioning/datasources/types.go @@ -32,22 +32,20 @@ type upsertDataSourceFromConfig struct { OrgID int64 Version int - Name string - Type string - Access string - URL string - Password string - User string - Database string - BasicAuth bool - BasicAuthUser string - BasicAuthPassword string - WithCredentials bool - IsDefault bool - JSONData map[string]interface{} - SecureJSONData map[string]string - Editable bool - UID string + Name string + Type string + Access string + URL string + User string + Database string + BasicAuth bool + BasicAuthUser string + WithCredentials bool + IsDefault bool + JSONData map[string]interface{} + SecureJSONData map[string]string + Editable bool + UID string } type configsV0 struct { @@ -76,44 +74,40 @@ type deleteDatasourceConfigV1 struct { } type upsertDataSourceFromConfigV0 struct { - OrgID int64 `json:"org_id" yaml:"org_id"` - Version int `json:"version" yaml:"version"` - Name string `json:"name" yaml:"name"` - Type string `json:"type" yaml:"type"` - Access string `json:"access" yaml:"access"` - URL string `json:"url" yaml:"url"` - Password string `json:"password" yaml:"password"` - User string `json:"user" yaml:"user"` - Database string `json:"database" yaml:"database"` - BasicAuth bool `json:"basic_auth" yaml:"basic_auth"` - BasicAuthUser string `json:"basic_auth_user" yaml:"basic_auth_user"` - BasicAuthPassword string `json:"basic_auth_password" yaml:"basic_auth_password"` - WithCredentials bool `json:"with_credentials" yaml:"with_credentials"` - IsDefault bool `json:"is_default" yaml:"is_default"` - JSONData map[string]interface{} `json:"json_data" yaml:"json_data"` - SecureJSONData map[string]string `json:"secure_json_data" yaml:"secure_json_data"` - Editable bool `json:"editable" yaml:"editable"` + OrgID int64 `json:"org_id" yaml:"org_id"` + Version int `json:"version" yaml:"version"` + Name string `json:"name" yaml:"name"` + Type string `json:"type" yaml:"type"` + Access string `json:"access" yaml:"access"` + URL string `json:"url" yaml:"url"` + User string `json:"user" yaml:"user"` + Database string `json:"database" yaml:"database"` + BasicAuth bool `json:"basic_auth" yaml:"basic_auth"` + BasicAuthUser string `json:"basic_auth_user" yaml:"basic_auth_user"` + WithCredentials bool `json:"with_credentials" yaml:"with_credentials"` + IsDefault bool `json:"is_default" yaml:"is_default"` + JSONData map[string]interface{} `json:"json_data" yaml:"json_data"` + SecureJSONData map[string]string `json:"secure_json_data" yaml:"secure_json_data"` + Editable bool `json:"editable" yaml:"editable"` } type upsertDataSourceFromConfigV1 struct { - OrgID values.Int64Value `json:"orgId" yaml:"orgId"` - Version values.IntValue `json:"version" yaml:"version"` - Name values.StringValue `json:"name" yaml:"name"` - Type values.StringValue `json:"type" yaml:"type"` - Access values.StringValue `json:"access" yaml:"access"` - URL values.StringValue `json:"url" yaml:"url"` - Password values.StringValue `json:"password" yaml:"password"` - User values.StringValue `json:"user" yaml:"user"` - Database values.StringValue `json:"database" yaml:"database"` - BasicAuth values.BoolValue `json:"basicAuth" yaml:"basicAuth"` - BasicAuthUser values.StringValue `json:"basicAuthUser" yaml:"basicAuthUser"` - BasicAuthPassword values.StringValue `json:"basicAuthPassword" yaml:"basicAuthPassword"` - WithCredentials values.BoolValue `json:"withCredentials" yaml:"withCredentials"` - IsDefault values.BoolValue `json:"isDefault" yaml:"isDefault"` - JSONData values.JSONValue `json:"jsonData" yaml:"jsonData"` - SecureJSONData values.StringMapValue `json:"secureJsonData" yaml:"secureJsonData"` - Editable values.BoolValue `json:"editable" yaml:"editable"` - UID values.StringValue `json:"uid" yaml:"uid"` + OrgID values.Int64Value `json:"orgId" yaml:"orgId"` + Version values.IntValue `json:"version" yaml:"version"` + Name values.StringValue `json:"name" yaml:"name"` + Type values.StringValue `json:"type" yaml:"type"` + Access values.StringValue `json:"access" yaml:"access"` + URL values.StringValue `json:"url" yaml:"url"` + User values.StringValue `json:"user" yaml:"user"` + Database values.StringValue `json:"database" yaml:"database"` + BasicAuth values.BoolValue `json:"basicAuth" yaml:"basicAuth"` + BasicAuthUser values.StringValue `json:"basicAuthUser" yaml:"basicAuthUser"` + WithCredentials values.BoolValue `json:"withCredentials" yaml:"withCredentials"` + IsDefault values.BoolValue `json:"isDefault" yaml:"isDefault"` + JSONData values.JSONValue `json:"jsonData" yaml:"jsonData"` + SecureJSONData values.StringMapValue `json:"secureJsonData" yaml:"secureJsonData"` + Editable values.BoolValue `json:"editable" yaml:"editable"` + UID values.StringValue `json:"uid" yaml:"uid"` } func (cfg *configsV1) mapToDatasourceFromConfig(apiVersion int64) *configs { @@ -127,42 +121,23 @@ func (cfg *configsV1) mapToDatasourceFromConfig(apiVersion int64) *configs { for _, ds := range cfg.Datasources { r.Datasources = append(r.Datasources, &upsertDataSourceFromConfig{ - OrgID: ds.OrgID.Value(), - Name: ds.Name.Value(), - Type: ds.Type.Value(), - Access: ds.Access.Value(), - URL: ds.URL.Value(), - Password: ds.Password.Value(), - User: ds.User.Value(), - Database: ds.Database.Value(), - BasicAuth: ds.BasicAuth.Value(), - BasicAuthUser: ds.BasicAuthUser.Value(), - BasicAuthPassword: ds.BasicAuthPassword.Value(), - WithCredentials: ds.WithCredentials.Value(), - IsDefault: ds.IsDefault.Value(), - JSONData: ds.JSONData.Value(), - SecureJSONData: ds.SecureJSONData.Value(), - Editable: ds.Editable.Value(), - Version: ds.Version.Value(), - UID: ds.UID.Value(), + OrgID: ds.OrgID.Value(), + Name: ds.Name.Value(), + Type: ds.Type.Value(), + Access: ds.Access.Value(), + URL: ds.URL.Value(), + User: ds.User.Value(), + Database: ds.Database.Value(), + BasicAuth: ds.BasicAuth.Value(), + BasicAuthUser: ds.BasicAuthUser.Value(), + WithCredentials: ds.WithCredentials.Value(), + IsDefault: ds.IsDefault.Value(), + JSONData: ds.JSONData.Value(), + SecureJSONData: ds.SecureJSONData.Value(), + Editable: ds.Editable.Value(), + Version: ds.Version.Value(), + UID: ds.UID.Value(), }) - - // Using Raw value for the warnings here so that even if it uses env interpolation and the env var is empty - // it will still warn - if len(ds.Password.Raw) > 0 { - cfg.log.Warn( - "[Deprecated] the use of password field is deprecated. Please use secureJsonData.password", - "datasource name", - ds.Name.Value(), - ) - } - if len(ds.BasicAuthPassword.Raw) > 0 { - cfg.log.Warn( - "[Deprecated] the use of basicAuthPassword field is deprecated. Please use secureJsonData.basicAuthPassword", - "datasource name", - ds.Name.Value(), - ) - } } for _, ds := range cfg.DeleteDatasources { @@ -186,23 +161,21 @@ func (cfg *configsV0) mapToDatasourceFromConfig(apiVersion int64) *configs { for _, ds := range cfg.Datasources { r.Datasources = append(r.Datasources, &upsertDataSourceFromConfig{ - OrgID: ds.OrgID, - Name: ds.Name, - Type: ds.Type, - Access: ds.Access, - URL: ds.URL, - Password: ds.Password, - User: ds.User, - Database: ds.Database, - BasicAuth: ds.BasicAuth, - BasicAuthUser: ds.BasicAuthUser, - BasicAuthPassword: ds.BasicAuthPassword, - WithCredentials: ds.WithCredentials, - IsDefault: ds.IsDefault, - JSONData: ds.JSONData, - SecureJSONData: ds.SecureJSONData, - Editable: ds.Editable, - Version: ds.Version, + OrgID: ds.OrgID, + Name: ds.Name, + Type: ds.Type, + Access: ds.Access, + URL: ds.URL, + User: ds.User, + Database: ds.Database, + BasicAuth: ds.BasicAuth, + BasicAuthUser: ds.BasicAuthUser, + WithCredentials: ds.WithCredentials, + IsDefault: ds.IsDefault, + JSONData: ds.JSONData, + SecureJSONData: ds.SecureJSONData, + Editable: ds.Editable, + Version: ds.Version, }) } @@ -225,23 +198,21 @@ func createInsertCommand(ds *upsertDataSourceFromConfig) *models.AddDataSourceCo } cmd := &models.AddDataSourceCommand{ - OrgId: ds.OrgID, - Name: ds.Name, - Type: ds.Type, - Access: models.DsAccess(ds.Access), - Url: ds.URL, - Password: ds.Password, - User: ds.User, - Database: ds.Database, - BasicAuth: ds.BasicAuth, - BasicAuthUser: ds.BasicAuthUser, - BasicAuthPassword: ds.BasicAuthPassword, - WithCredentials: ds.WithCredentials, - IsDefault: ds.IsDefault, - JsonData: jsonData, - SecureJsonData: ds.SecureJSONData, - ReadOnly: !ds.Editable, - Uid: ds.UID, + OrgId: ds.OrgID, + Name: ds.Name, + Type: ds.Type, + Access: models.DsAccess(ds.Access), + Url: ds.URL, + User: ds.User, + Database: ds.Database, + BasicAuth: ds.BasicAuth, + BasicAuthUser: ds.BasicAuthUser, + WithCredentials: ds.WithCredentials, + IsDefault: ds.IsDefault, + JsonData: jsonData, + SecureJsonData: ds.SecureJSONData, + ReadOnly: !ds.Editable, + Uid: ds.UID, } if cmd.Uid == "" { @@ -266,23 +237,21 @@ func createUpdateCommand(ds *upsertDataSourceFromConfig, id int64) *models.Updat } return &models.UpdateDataSourceCommand{ - Id: id, - Uid: ds.UID, - OrgId: ds.OrgID, - Name: ds.Name, - Type: ds.Type, - Access: models.DsAccess(ds.Access), - Url: ds.URL, - Password: ds.Password, - User: ds.User, - Database: ds.Database, - BasicAuth: ds.BasicAuth, - BasicAuthUser: ds.BasicAuthUser, - BasicAuthPassword: ds.BasicAuthPassword, - WithCredentials: ds.WithCredentials, - IsDefault: ds.IsDefault, - JsonData: jsonData, - SecureJsonData: ds.SecureJSONData, - ReadOnly: !ds.Editable, + Id: id, + Uid: ds.UID, + OrgId: ds.OrgID, + Name: ds.Name, + Type: ds.Type, + Access: models.DsAccess(ds.Access), + Url: ds.URL, + User: ds.User, + Database: ds.Database, + BasicAuth: ds.BasicAuth, + BasicAuthUser: ds.BasicAuthUser, + WithCredentials: ds.WithCredentials, + IsDefault: ds.IsDefault, + JsonData: jsonData, + SecureJsonData: ds.SecureJSONData, + ReadOnly: !ds.Editable, } } diff --git a/pkg/services/sqlstore/datasource.go b/pkg/services/sqlstore/datasource.go index 28f93f366b3..7a7f431e99e 100644 --- a/pkg/services/sqlstore/datasource.go +++ b/pkg/services/sqlstore/datasource.go @@ -152,26 +152,24 @@ func (ss *SQLStore) AddDataSource(ctx context.Context, cmd *models.AddDataSource } ds := &models.DataSource{ - OrgId: cmd.OrgId, - Name: cmd.Name, - Type: cmd.Type, - Access: cmd.Access, - Url: cmd.Url, - User: cmd.User, - Password: cmd.Password, - Database: cmd.Database, - IsDefault: cmd.IsDefault, - BasicAuth: cmd.BasicAuth, - BasicAuthUser: cmd.BasicAuthUser, - BasicAuthPassword: cmd.BasicAuthPassword, - WithCredentials: cmd.WithCredentials, - JsonData: cmd.JsonData, - SecureJsonData: cmd.EncryptedSecureJsonData, - Created: time.Now(), - Updated: time.Now(), - Version: 1, - ReadOnly: cmd.ReadOnly, - Uid: cmd.Uid, + OrgId: cmd.OrgId, + Name: cmd.Name, + Type: cmd.Type, + Access: cmd.Access, + Url: cmd.Url, + User: cmd.User, + Database: cmd.Database, + IsDefault: cmd.IsDefault, + BasicAuth: cmd.BasicAuth, + BasicAuthUser: cmd.BasicAuthUser, + WithCredentials: cmd.WithCredentials, + JsonData: cmd.JsonData, + SecureJsonData: cmd.EncryptedSecureJsonData, + Created: time.Now(), + Updated: time.Now(), + Version: 1, + ReadOnly: cmd.ReadOnly, + Uid: cmd.Uid, } if _, err := sess.Insert(ds); err != nil { @@ -215,26 +213,24 @@ func (ss *SQLStore) UpdateDataSource(ctx context.Context, cmd *models.UpdateData } ds := &models.DataSource{ - Id: cmd.Id, - OrgId: cmd.OrgId, - Name: cmd.Name, - Type: cmd.Type, - Access: cmd.Access, - Url: cmd.Url, - User: cmd.User, - Password: cmd.Password, - Database: cmd.Database, - IsDefault: cmd.IsDefault, - BasicAuth: cmd.BasicAuth, - BasicAuthUser: cmd.BasicAuthUser, - BasicAuthPassword: cmd.BasicAuthPassword, - WithCredentials: cmd.WithCredentials, - JsonData: cmd.JsonData, - SecureJsonData: cmd.EncryptedSecureJsonData, - Updated: time.Now(), - ReadOnly: cmd.ReadOnly, - Version: cmd.Version + 1, - Uid: cmd.Uid, + Id: cmd.Id, + OrgId: cmd.OrgId, + Name: cmd.Name, + Type: cmd.Type, + Access: cmd.Access, + Url: cmd.Url, + User: cmd.User, + Database: cmd.Database, + IsDefault: cmd.IsDefault, + BasicAuth: cmd.BasicAuth, + BasicAuthUser: cmd.BasicAuthUser, + WithCredentials: cmd.WithCredentials, + JsonData: cmd.JsonData, + SecureJsonData: cmd.EncryptedSecureJsonData, + Updated: time.Now(), + ReadOnly: cmd.ReadOnly, + Version: cmd.Version + 1, + Uid: cmd.Uid, } sess.UseBool("is_default") diff --git a/public/api-merged.json b/public/api-merged.json index 58a4a345080..c34f9112ddc 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -6832,13 +6832,6 @@ "summary": "Add External Group.", "operationId": "addTeamGroupApi", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -6846,6 +6839,13 @@ "schema": { "$ref": "#/definitions/TeamGroupMapping" } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], "responses": { @@ -6879,14 +6879,14 @@ { "type": "integer", "format": "int64", - "name": "teamId", + "name": "groupId", "in": "path", "required": true }, { "type": "integer", "format": "int64", - "name": "groupId", + "name": "teamId", "in": "path", "required": true } @@ -8002,9 +8002,6 @@ "basicAuth": { "type": "boolean" }, - "basicAuthPassword": { - "type": "string" - }, "basicAuthUser": { "type": "string" }, @@ -8020,9 +8017,6 @@ "name": { "type": "string" }, - "password": { - "type": "string" - }, "secureJsonData": { "type": "object", "additionalProperties": { @@ -9711,9 +9705,6 @@ "basicAuth": { "type": "boolean" }, - "basicAuthPassword": { - "type": "string" - }, "basicAuthUser": { "type": "string" }, @@ -9737,9 +9728,6 @@ "type": "integer", "format": "int64" }, - "password": { - "type": "string" - }, "readOnly": { "type": "boolean" }, @@ -9808,9 +9796,6 @@ "type": "integer", "format": "int64" }, - "password": { - "type": "string" - }, "readOnly": { "type": "boolean" }, @@ -14454,9 +14439,6 @@ "basicAuth": { "type": "boolean" }, - "basicAuthPassword": { - "type": "string" - }, "basicAuthUser": { "type": "string" }, @@ -14472,9 +14454,6 @@ "name": { "type": "string" }, - "password": { - "type": "string" - }, "secureJsonData": { "type": "object", "additionalProperties": { diff --git a/public/api-spec.json b/public/api-spec.json index 72d83fb5c56..2133d32b73b 100644 --- a/public/api-spec.json +++ b/public/api-spec.json @@ -6832,13 +6832,6 @@ "summary": "Add External Group.", "operationId": "addTeamGroupApi", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true - }, { "name": "body", "in": "body", @@ -6846,6 +6839,13 @@ "schema": { "$ref": "#/definitions/TeamGroupMapping" } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], "responses": { @@ -6879,14 +6879,14 @@ { "type": "integer", "format": "int64", - "name": "teamId", + "name": "groupId", "in": "path", "required": true }, { "type": "integer", "format": "int64", - "name": "groupId", + "name": "teamId", "in": "path", "required": true } @@ -7993,9 +7993,6 @@ "basicAuth": { "type": "boolean" }, - "basicAuthPassword": { - "type": "string" - }, "basicAuthUser": { "type": "string" }, @@ -8011,9 +8008,6 @@ "name": { "type": "string" }, - "password": { - "type": "string" - }, "secureJsonData": { "type": "object", "additionalProperties": { @@ -9455,9 +9449,6 @@ "basicAuth": { "type": "boolean" }, - "basicAuthPassword": { - "type": "string" - }, "basicAuthUser": { "type": "string" }, @@ -9481,9 +9472,6 @@ "type": "integer", "format": "int64" }, - "password": { - "type": "string" - }, "readOnly": { "type": "boolean" }, @@ -9552,9 +9540,6 @@ "type": "integer", "format": "int64" }, - "password": { - "type": "string" - }, "readOnly": { "type": "boolean" }, @@ -11772,9 +11757,6 @@ "basicAuth": { "type": "boolean" }, - "basicAuthPassword": { - "type": "string" - }, "basicAuthUser": { "type": "string" }, @@ -11790,9 +11772,6 @@ "name": { "type": "string" }, - "password": { - "type": "string" - }, "secureJsonData": { "type": "object", "additionalProperties": { diff --git a/public/app/features/datasources/__mocks__/dataSourcesMocks.ts b/public/app/features/datasources/__mocks__/dataSourcesMocks.ts index 26a3bfe0392..0d8fd898ee4 100644 --- a/public/app/features/datasources/__mocks__/dataSourcesMocks.ts +++ b/public/app/features/datasources/__mocks__/dataSourcesMocks.ts @@ -13,7 +13,6 @@ export const getMockDataSources = (amount: number) => { jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' }, name: `dataSource-${i}`, orgId: 1, - password: '', readOnly: false, type: 'cloudwatch', typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png', @@ -30,7 +29,6 @@ export const getMockDataSource = (): DataSourceSettings => { access: '', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, database: '', id: 13, @@ -40,7 +38,6 @@ export const getMockDataSource = (): DataSourceSettings => { name: 'gdev-cloudwatch', typeName: 'Cloudwatch', orgId: 1, - password: '', readOnly: false, type: 'cloudwatch', typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png', diff --git a/public/app/features/datasources/__snapshots__/DataSourcesListPage.test.tsx.snap b/public/app/features/datasources/__snapshots__/DataSourcesListPage.test.tsx.snap index 19de550a2b1..90e246afa70 100644 --- a/public/app/features/datasources/__snapshots__/DataSourcesListPage.test.tsx.snap +++ b/public/app/features/datasources/__snapshots__/DataSourcesListPage.test.tsx.snap @@ -43,7 +43,6 @@ exports[`Render should render action bar and datasources 1`] = ` }, "name": "dataSource-0", "orgId": 1, - "password": "", "readOnly": false, "type": "cloudwatch", "typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", @@ -62,7 +61,6 @@ exports[`Render should render action bar and datasources 1`] = ` }, "name": "dataSource-1", "orgId": 1, - "password": "", "readOnly": false, "type": "cloudwatch", "typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", @@ -81,7 +79,6 @@ exports[`Render should render action bar and datasources 1`] = ` }, "name": "dataSource-2", "orgId": 1, - "password": "", "readOnly": false, "type": "cloudwatch", "typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", @@ -100,7 +97,6 @@ exports[`Render should render action bar and datasources 1`] = ` }, "name": "dataSource-3", "orgId": 1, - "password": "", "readOnly": false, "type": "cloudwatch", "typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", @@ -119,7 +115,6 @@ exports[`Render should render action bar and datasources 1`] = ` }, "name": "dataSource-4", "orgId": 1, - "password": "", "readOnly": false, "type": "cloudwatch", "typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", diff --git a/public/app/features/datasources/mocks.ts b/public/app/features/datasources/mocks.ts index f03e3504317..07ad30f1d6c 100644 --- a/public/app/features/datasources/mocks.ts +++ b/public/app/features/datasources/mocks.ts @@ -11,11 +11,9 @@ export function createDatasourceSettings(jsonData: T): DataSourceSettings typeName: 'Datasource', access: 'server', url: 'http://localhost', - password: '', user: '', database: '', basicAuth: false, - basicAuthPassword: '', basicAuthUser: '', isDefault: false, jsonData, diff --git a/public/app/features/datasources/state/navModel.ts b/public/app/features/datasources/state/navModel.ts index 4e0b1ed593d..117ea026dca 100644 --- a/public/app/features/datasources/state/navModel.ts +++ b/public/app/features/datasources/state/navModel.ts @@ -154,7 +154,6 @@ export function getDataSourceLoadingNav(pageName: string): NavModel { access: '', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, database: '', id: 1, @@ -163,7 +162,6 @@ export function getDataSourceLoadingNav(pageName: string): NavModel { jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' }, name: 'Loading', orgId: 1, - password: '', readOnly: false, type: loadingDSType, typeName: loadingDSType, diff --git a/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx index 3947939384f..ac4ca34f1e1 100644 --- a/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx @@ -34,9 +34,7 @@ const setup = (propOverrides?: object) => { type: 'cloudwatch', typeName: 'Cloudwatch', user: '', - password: '', basicAuth: false, - basicAuthPassword: '', basicAuthUser: '', isDefault: true, readOnly: false, diff --git a/public/app/plugins/datasource/cloudwatch/components/__snapshots__/ConfigEditor.test.tsx.snap b/public/app/plugins/datasource/cloudwatch/components/__snapshots__/ConfigEditor.test.tsx.snap index 35d0bb1046e..b082deb3683 100644 --- a/public/app/plugins/datasource/cloudwatch/components/__snapshots__/ConfigEditor.test.tsx.snap +++ b/public/app/plugins/datasource/cloudwatch/components/__snapshots__/ConfigEditor.test.tsx.snap @@ -8,7 +8,6 @@ exports[`Render should disable access key id field 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 1, @@ -24,7 +23,6 @@ exports[`Render should disable access key id field 1`] = ` }, "name": "CloudWatch", "orgId": 1, - "password": "", "readOnly": false, "secureJsonData": Object { "accessKey": "", @@ -99,7 +97,6 @@ exports[`Render should render component 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 1, @@ -115,7 +112,6 @@ exports[`Render should render component 1`] = ` }, "name": "CloudWatch", "orgId": 1, - "password": "", "readOnly": false, "secureJsonData": Object { "accessKey": "", @@ -190,7 +186,6 @@ exports[`Render should show access key and secret access key fields 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 1, @@ -206,7 +201,6 @@ exports[`Render should show access key and secret access key fields 1`] = ` }, "name": "CloudWatch", "orgId": 1, - "password": "", "readOnly": false, "secureJsonData": Object { "accessKey": "", @@ -281,7 +275,6 @@ exports[`Render should show arn role field 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 1, @@ -297,7 +290,6 @@ exports[`Render should show arn role field 1`] = ` }, "name": "CloudWatch", "orgId": 1, - "password": "", "readOnly": false, "secureJsonData": Object { "accessKey": "", @@ -372,7 +364,6 @@ exports[`Render should show credentials profile name field 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 1, @@ -388,7 +379,6 @@ exports[`Render should show credentials profile name field 1`] = ` }, "name": "CloudWatch", "orgId": 1, - "password": "", "readOnly": false, "secureJsonData": Object { "accessKey": "", diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ConfigEditor.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ConfigEditor.test.tsx index 259d155f322..41769111071 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ConfigEditor.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/ConfigEditor.test.tsx @@ -14,12 +14,10 @@ describe('AppInsights ConfigEditor', () => { typeName: 'Azure', access: 'proxy', url: '', - password: '', user: '', database: '', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, isDefault: false, jsonData: {}, diff --git a/public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx b/public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx index b77656b1dfe..5962125520c 100644 --- a/public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx +++ b/public/app/plugins/datasource/influxdb/components/ConfigEditor.test.tsx @@ -26,12 +26,10 @@ const setup = (propOverrides?: object) => { typeLogoUrl: '', access: 'proxy', url: '', - password: '', user: '', database: '', basicAuth: false, basicAuthUser: '', - basicAuthPassword: '', withCredentials: false, isDefault: false, jsonData: { diff --git a/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap b/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap index bbe95469557..c90c24e4927 100644 --- a/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap +++ b/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap @@ -57,7 +57,6 @@ exports[`Render should disable basic auth password input 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 21, @@ -68,7 +67,6 @@ exports[`Render should disable basic auth password input 1`] = ` }, "name": "InfluxDB-3", "orgId": 1, - "password": "", "readOnly": false, "secureJsonFields": Object {}, "type": "influxdb", @@ -322,7 +320,6 @@ exports[`Render should hide basic auth fields when switch off 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 21, @@ -333,7 +330,6 @@ exports[`Render should hide basic auth fields when switch off 1`] = ` }, "name": "InfluxDB-3", "orgId": 1, - "password": "", "readOnly": false, "secureJsonFields": Object {}, "type": "influxdb", @@ -587,7 +583,6 @@ exports[`Render should hide white listed cookies input when browser access chose Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 21, @@ -598,7 +593,6 @@ exports[`Render should hide white listed cookies input when browser access chose }, "name": "InfluxDB-3", "orgId": 1, - "password": "", "readOnly": false, "secureJsonFields": Object {}, "type": "influxdb", @@ -852,7 +846,6 @@ exports[`Render should render component 1`] = ` Object { "access": "proxy", "basicAuth": false, - "basicAuthPassword": "", "basicAuthUser": "", "database": "", "id": 21, @@ -863,7 +856,6 @@ exports[`Render should render component 1`] = ` }, "name": "InfluxDB-3", "orgId": 1, - "password": "", "readOnly": false, "secureJsonFields": Object {}, "type": "influxdb",