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 <will.browne@grafana.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
Marcus Efraimsson
2022-06-03 17:38:22 +02:00
committed by GitHub
parent b344f48e68
commit 36c3398c6d
33 changed files with 268 additions and 430 deletions

View File

@@ -170,7 +170,7 @@ exports[`no enzyme tests`] = {
"public/app/plugins/datasource/cloud-monitoring/components/Aggregation.test.tsx:3822406835": [ "public/app/plugins/datasource/cloud-monitoring/components/Aggregation.test.tsx:3822406835": [
[1, 19, 13, "RegExp match", "2409514259"] [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"] [0, 19, 13, "RegExp match", "2409514259"]
], ],
"public/app/plugins/datasource/cloudwatch/components/LogsQueryField.test.tsx:1501504663": [ "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": [ "public/app/plugins/datasource/elasticsearch/configuration/DataLinks.test.tsx:248699332": [
[0, 17, 13, "RegExp match", "2409514259"] [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"] [0, 19, 13, "RegExp match", "2409514259"]
], ],
"public/app/plugins/datasource/loki/components/LokiExploreQueryEditor.test.tsx:1488067923": [ "public/app/plugins/datasource/loki/components/LokiExploreQueryEditor.test.tsx:1488067923": [

View File

@@ -19,8 +19,6 @@ apiVersion: 1
# orgId: 1 # orgId: 1
# # <string> url # # <string> url
# url: http://localhost:8080 # url: http://localhost:8080
# # <string> database password, if used
# password:
# # <string> database user, if used # # <string> database user, if used
# user: # user:
# # <string> database name, if used # # <string> database name, if used
@@ -29,8 +27,6 @@ apiVersion: 1
# basicAuth: # basicAuth:
# # <string> basic auth username # # <string> basic auth username
# basicAuthUser: # basicAuthUser:
# # <string> basic auth password
# basicAuthPassword:
# # <bool> enable/disable with credentials headers # # <bool> enable/disable with credentials headers
# withCredentials: # withCredentials:
# # <bool> mark as default datasource. Max one per org # # <bool> mark as default datasource. Max one per org

View File

@@ -98,8 +98,6 @@ datasources:
uid: my_unique_uid uid: my_unique_uid
# <string> url # <string> url
url: http://localhost:8080 url: http://localhost:8080
# <string> Deprecated, use secureJsonData.password
password:
# <string> database user, if used # <string> database user, if used
user: user:
# <string> database name, if used # <string> database name, if used
@@ -108,8 +106,6 @@ datasources:
basicAuth: basicAuth:
# <string> basic auth username # <string> basic auth username
basicAuthUser: basicAuthUser:
# <string> Deprecated, use secureJsonData.basicAuthPassword
basicAuthPassword:
# <bool> enable/disable with credentials headers # <bool> enable/disable with credentials headers
withCredentials: withCredentials:
# <bool> mark as default datasource. Max one per org # <bool> mark as default datasource. Max one per org

View File

@@ -37,5 +37,6 @@ datasources:
# optionally # optionally
basicAuth: true basicAuth: true
basicAuthUser: my_user basicAuthUser: my_user
basicAuthPassword: test_password secureJsonData:
basicAuthPassword: test_password
``` ```

View File

@@ -255,7 +255,6 @@ datasources:
url: http://localhost:3100 url: http://localhost:3100
basicAuth: true basicAuth: true
basicAuthUser: my_user basicAuthUser: my_user
basicAuthPassword: test_password
jsonData: jsonData:
maxLines: 1000 maxLines: 1000
derivedFields: derivedFields:
@@ -272,6 +271,8 @@ datasources:
- matcherRegex: "traceID=(\\w+)" - matcherRegex: "traceID=(\\w+)"
name: TraceID name: TraceID
url: 'http://localhost:16686/trace/$${__value.raw}' 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. 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.

View File

@@ -536,11 +536,9 @@ export interface DataSourceSettings<T extends DataSourceJsonData = DataSourceJso
typeName: string; typeName: string;
access: string; access: string;
url: string; url: string;
password: string;
user: string; user: string;
database: string; database: string;
basicAuth: boolean; basicAuth: boolean;
basicAuthPassword: string;
basicAuthUser: string; basicAuthUser: string;
isDefault: boolean; isDefault: boolean;
jsonData: T; jsonData: T;

View File

@@ -12,7 +12,6 @@ export const BasicAuthSettings: React.FC<HttpSettingsProps> = ({ dataSourceConfi
const onPasswordReset = () => { const onPasswordReset = () => {
onChange({ onChange({
...dataSourceConfig, ...dataSourceConfig,
basicAuthPassword: '',
secureJsonData: { secureJsonData: {
...dataSourceConfig.secureJsonData, ...dataSourceConfig.secureJsonData,
basicAuthPassword: '', basicAuthPassword: '',
@@ -48,10 +47,7 @@ export const BasicAuthSettings: React.FC<HttpSettingsProps> = ({ dataSourceConfi
</InlineField> </InlineField>
<InlineField> <InlineField>
<SecretFormField <SecretFormField
isConfigured={ isConfigured={!!(dataSourceConfig.secureJsonFields && dataSourceConfig.secureJsonFields.basicAuthPassword)}
!!dataSourceConfig.basicAuthPassword ||
!!(dataSourceConfig.secureJsonFields && dataSourceConfig.secureJsonFields.basicAuthPassword)
}
value={password || ''} value={password || ''}
inputWidth={18} inputWidth={18}
labelWidth={10} labelWidth={10}

View File

@@ -17,12 +17,10 @@ const setup = (propOverrides?: object) => {
typeLogoUrl: '', typeLogoUrl: '',
access: 'direct', access: 'direct',
url: 'http://localhost:8086', url: 'http://localhost:8086',
password: '',
user: 'grafana', user: 'grafana',
database: 'site', database: 'site',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
isDefault: false, isDefault: false,
jsonData: { jsonData: {

View File

@@ -17,12 +17,10 @@ const settingsMock: DataSourceSettings<any, any> = {
typeLogoUrl: '', typeLogoUrl: '',
access: 'direct', access: 'direct',
url: 'http://localhost:8086', url: 'http://localhost:8086',
password: '',
user: 'grafana', user: 'grafana',
database: 'site', database: 'site',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
isDefault: false, isDefault: false,
jsonData: { jsonData: {

View File

@@ -18,12 +18,10 @@ const setup = (propOverrides?: object) => {
typeLogoUrl: '', typeLogoUrl: '',
access: 'direct', access: 'direct',
url: 'http://localhost:8086', url: 'http://localhost:8086',
password: '',
user: 'grafana', user: 'grafana',
database: 'site', database: 'site',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
isDefault: false, isDefault: false,
jsonData: { jsonData: {

View File

@@ -48,7 +48,6 @@ func (hs *HTTPServer) GetDataSources(c *models.ReqContext) response.Response {
Type: ds.Type, Type: ds.Type,
TypeName: ds.Type, TypeName: ds.Type,
Access: ds.Access, Access: ds.Access,
Password: ds.Password,
Database: ds.Database, Database: ds.Database,
User: ds.User, User: ds.User,
BasicAuth: ds.BasicAuth, 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 { func (hs *HTTPServer) convertModelToDtos(ctx context.Context, ds *models.DataSource) dtos.DataSource {
dto := dtos.DataSource{ dto := dtos.DataSource{
Id: ds.Id, Id: ds.Id,
UID: ds.Uid, UID: ds.Uid,
OrgId: ds.OrgId, OrgId: ds.OrgId,
Name: ds.Name, Name: ds.Name,
Url: ds.Url, Url: ds.Url,
Type: ds.Type, Type: ds.Type,
Access: ds.Access, Access: ds.Access,
Password: ds.Password, Database: ds.Database,
Database: ds.Database, User: ds.User,
User: ds.User, BasicAuth: ds.BasicAuth,
BasicAuth: ds.BasicAuth, BasicAuthUser: ds.BasicAuthUser,
BasicAuthUser: ds.BasicAuthUser, WithCredentials: ds.WithCredentials,
BasicAuthPassword: ds.BasicAuthPassword, IsDefault: ds.IsDefault,
WithCredentials: ds.WithCredentials, JsonData: ds.JsonData,
IsDefault: ds.IsDefault, SecureJsonFields: map[string]bool{},
JsonData: ds.JsonData, Version: ds.Version,
SecureJsonFields: map[string]bool{}, ReadOnly: ds.ReadOnly,
Version: ds.Version,
ReadOnly: ds.ReadOnly,
} }
secrets, err := hs.DataSourcesService.DecryptedValues(ctx, ds) secrets, err := hs.DataSourcesService.DecryptedValues(ctx, ds)

View File

@@ -9,27 +9,25 @@ import (
) )
type DataSource struct { type DataSource struct {
Id int64 `json:"id"` Id int64 `json:"id"`
UID string `json:"uid"` UID string `json:"uid"`
OrgId int64 `json:"orgId"` OrgId int64 `json:"orgId"`
Name string `json:"name"` Name string `json:"name"`
Type string `json:"type"` Type string `json:"type"`
TypeLogoUrl string `json:"typeLogoUrl"` TypeLogoUrl string `json:"typeLogoUrl"`
Access models.DsAccess `json:"access"` Access models.DsAccess `json:"access"`
Url string `json:"url"` Url string `json:"url"`
Password string `json:"password"` User string `json:"user"`
User string `json:"user"` Database string `json:"database"`
Database string `json:"database"` BasicAuth bool `json:"basicAuth"`
BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"`
BasicAuthUser string `json:"basicAuthUser"` WithCredentials bool `json:"withCredentials"`
BasicAuthPassword string `json:"basicAuthPassword"` IsDefault bool `json:"isDefault"`
WithCredentials bool `json:"withCredentials"` JsonData *simplejson.Json `json:"jsonData,omitempty"`
IsDefault bool `json:"isDefault"` SecureJsonFields map[string]bool `json:"secureJsonFields"`
JsonData *simplejson.Json `json:"jsonData,omitempty"` Version int `json:"version"`
SecureJsonFields map[string]bool `json:"secureJsonFields"` ReadOnly bool `json:"readOnly"`
Version int `json:"version"` AccessControl accesscontrol.Metadata `json:"accessControl,omitempty"`
ReadOnly bool `json:"readOnly"`
AccessControl accesscontrol.Metadata `json:"accessControl,omitempty"`
} }
type DataSourceListItemDTO struct { type DataSourceListItemDTO struct {
@@ -42,7 +40,6 @@ type DataSourceListItemDTO struct {
TypeLogoUrl string `json:"typeLogoUrl"` TypeLogoUrl string `json:"typeLogoUrl"`
Access models.DsAccess `json:"access"` Access models.DsAccess `json:"access"`
Url string `json:"url"` Url string `json:"url"`
Password string `json:"password"`
User string `json:"user"` User string `json:"user"`
Database string `json:"database"` Database string `json:"database"`
BasicAuth bool `json:"basicAuth"` BasicAuth bool `json:"basicAuth"`

View File

@@ -366,7 +366,6 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
Url: "http://influxdb:8083", Url: "http://influxdb:8083",
Database: "site", Database: "site",
User: "user", User: "user",
Password: "password",
} }
ctx := &models.ReqContext{} ctx := &models.ReqContext{}
@@ -557,18 +556,18 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore())
tests := []*testCase{ 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),
createAuthTest(t, secretsStore, models.DS_INFLUXDB_08, "http://localhost:9090", authTypePassword, authCheckQuery, true), createAuthTest(t, secretsStore, models.DS_INFLUXDB_08, "http://localhost:9090", authTypePassword, authCheckQuery),
createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader, true), createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader),
createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader, false), createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypePassword, authCheckHeader),
createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader, true), createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader),
createAuthTest(t, secretsStore, models.DS_INFLUXDB, "http://localhost:9090", authTypeBasic, authCheckHeader, false), 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 // 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 // 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. // 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),
createAuthTest(t, secretsStore, models.DS_ES, "http://localhost:9200", authTypeBasic, authCheckHeader, true), createAuthTest(t, secretsStore, models.DS_ES, "http://localhost:9200", authTypeBasic, authCheckHeader),
} }
for _, test := range tests { for _, test := range tests {
runDatasourceAuthTest(t, secretsService, secretsStore, cfg, test) runDatasourceAuthTest(t, secretsService, secretsStore, cfg, test)
@@ -918,7 +917,7 @@ const (
authCheckHeader = "header" 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 // Basic user:password
base64AuthHeader := "Basic dXNlcjpwYXNzd29yZA==" base64AuthHeader := "Basic dXNlcjpwYXNzd29yZA=="
@@ -926,7 +925,7 @@ func createAuthTest(t *testing.T, secretsStore kvstore.SecretsKVStore, dsType st
datasource: &models.DataSource{ datasource: &models.DataSource{
Id: 1, Id: 1,
OrgId: 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, Type: dsType,
JsonData: simplejson.New(), JsonData: simplejson.New(),
Url: url, Url: url,
@@ -937,38 +936,28 @@ func createAuthTest(t *testing.T, secretsStore kvstore.SecretsKVStore, dsType st
if authType == authTypePassword { if authType == authTypePassword {
message = fmt.Sprintf("%v should add username and password", dsType) message = fmt.Sprintf("%v should add username and password", dsType)
test.datasource.User = "user" test.datasource.User = "user"
if useSecureJsonData { secureJsonData, err := json.Marshal(map[string]string{
secureJsonData, err := json.Marshal(map[string]string{ "password": "password",
"password": "password", })
}) require.NoError(t, err)
require.NoError(t, err)
err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData)) err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData))
require.NoError(t, err) require.NoError(t, err)
} else {
test.datasource.Password = "password"
}
} else { } else {
message = fmt.Sprintf("%v should add basic auth username and password", dsType) message = fmt.Sprintf("%v should add basic auth username and password", dsType)
test.datasource.BasicAuth = true test.datasource.BasicAuth = true
test.datasource.BasicAuthUser = "user" test.datasource.BasicAuthUser = "user"
if useSecureJsonData { secureJsonData, err := json.Marshal(map[string]string{
secureJsonData, err := json.Marshal(map[string]string{ "basicAuthPassword": "password",
"basicAuthPassword": "password", })
}) require.NoError(t, err)
require.NoError(t, err)
err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData)) err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData))
require.NoError(t, err) require.NoError(t, err)
} else {
test.datasource.BasicAuthPassword = "password"
}
} }
require.NoError(t, err) require.NoError(t, err)
if useSecureJsonData { message += " from securejsondata"
message += " from securejsondata"
}
if authCheck == authCheckQuery { if authCheck == authCheckQuery {
message += " to query params" message += " to query params"

View File

@@ -46,16 +46,18 @@ type DataSource struct {
OrgId int64 `json:"orgId"` OrgId int64 `json:"orgId"`
Version int `json:"version"` Version int `json:"version"`
Name string `json:"name"` Name string `json:"name"`
Type string `json:"type"` Type string `json:"type"`
Access DsAccess `json:"access"` Access DsAccess `json:"access"`
Url string `json:"url"` Url string `json:"url"`
Password string `json:"password"` // swagger:ignore
User string `json:"user"` Password string `json:"-"`
Database string `json:"database"` User string `json:"user"`
BasicAuth bool `json:"basicAuth"` Database string `json:"database"`
BasicAuthUser string `json:"basicAuthUser"` BasicAuth bool `json:"basicAuth"`
BasicAuthPassword string `json:"basicAuthPassword"` BasicAuthUser string `json:"basicAuthUser"`
// swagger:ignore
BasicAuthPassword string `json:"-"`
WithCredentials bool `json:"withCredentials"` WithCredentials bool `json:"withCredentials"`
IsDefault bool `json:"isDefault"` IsDefault bool `json:"isDefault"`
JsonData *simplejson.Json `json:"jsonData"` JsonData *simplejson.Json `json:"jsonData"`
@@ -84,21 +86,19 @@ func (ds DataSource) AllowedCookies() []string {
// Also acts as api DTO // Also acts as api DTO
type AddDataSourceCommand struct { type AddDataSourceCommand struct {
Name string `json:"name" binding:"Required"` Name string `json:"name" binding:"Required"`
Type string `json:"type" binding:"Required"` Type string `json:"type" binding:"Required"`
Access DsAccess `json:"access" binding:"Required"` Access DsAccess `json:"access" binding:"Required"`
Url string `json:"url"` Url string `json:"url"`
Password string `json:"password"` Database string `json:"database"`
Database string `json:"database"` User string `json:"user"`
User string `json:"user"` BasicAuth bool `json:"basicAuth"`
BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"`
BasicAuthUser string `json:"basicAuthUser"` WithCredentials bool `json:"withCredentials"`
BasicAuthPassword string `json:"basicAuthPassword"` IsDefault bool `json:"isDefault"`
WithCredentials bool `json:"withCredentials"` JsonData *simplejson.Json `json:"jsonData"`
IsDefault bool `json:"isDefault"` SecureJsonData map[string]string `json:"secureJsonData"`
JsonData *simplejson.Json `json:"jsonData"` Uid string `json:"uid"`
SecureJsonData map[string]string `json:"secureJsonData"`
Uid string `json:"uid"`
OrgId int64 `json:"-"` OrgId int64 `json:"-"`
UserId int64 `json:"-"` UserId int64 `json:"-"`
@@ -110,22 +110,20 @@ type AddDataSourceCommand struct {
// Also acts as api DTO // Also acts as api DTO
type UpdateDataSourceCommand struct { type UpdateDataSourceCommand struct {
Name string `json:"name" binding:"Required"` Name string `json:"name" binding:"Required"`
Type string `json:"type" binding:"Required"` Type string `json:"type" binding:"Required"`
Access DsAccess `json:"access" binding:"Required"` Access DsAccess `json:"access" binding:"Required"`
Url string `json:"url"` Url string `json:"url"`
Password string `json:"password"` User string `json:"user"`
User string `json:"user"` Database string `json:"database"`
Database string `json:"database"` BasicAuth bool `json:"basicAuth"`
BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"`
BasicAuthUser string `json:"basicAuthUser"` WithCredentials bool `json:"withCredentials"`
BasicAuthPassword string `json:"basicAuthPassword"` IsDefault bool `json:"isDefault"`
WithCredentials bool `json:"withCredentials"` JsonData *simplejson.Json `json:"jsonData"`
IsDefault bool `json:"isDefault"` SecureJsonData map[string]string `json:"secureJsonData"`
JsonData *simplejson.Json `json:"jsonData"` Version int `json:"version"`
SecureJsonData map[string]string `json:"secureJsonData"` Uid string `json:"uid"`
Version int `json:"version"`
Uid string `json:"uid"`
OrgId int64 `json:"-"` OrgId int64 `json:"-"`
Id int64 `json:"-"` Id int64 `json:"-"`

View File

@@ -340,7 +340,7 @@ func (s *Service) DecryptedBasicAuthPassword(ctx context.Context, ds *models.Dat
return value, nil return value, nil
} }
return ds.BasicAuthPassword, err return "", err
} }
func (s *Service) DecryptedPassword(ctx context.Context, ds *models.DataSource) (string, error) { 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 value, nil
} }
return ds.Password, err return "", err
} }
func (s *Service) httpClientOptions(ctx context.Context, ds *models.DataSource) (*sdkhttpclient.Options, error) { func (s *Service) httpClientOptions(ctx context.Context, ds *models.DataSource) (*sdkhttpclient.Options, error) {

View File

@@ -240,11 +240,9 @@ func validateDatasource(t *testing.T, dsCfg *configs) {
require.Equal(t, ds.OrgID, int64(2)) require.Equal(t, ds.OrgID, int64(2))
require.Equal(t, ds.URL, "url") require.Equal(t, ds.URL, "url")
require.Equal(t, ds.User, "user") require.Equal(t, ds.User, "user")
require.Equal(t, ds.Password, "password")
require.Equal(t, ds.Database, "database") require.Equal(t, ds.Database, "database")
require.True(t, ds.BasicAuth) require.True(t, ds.BasicAuth)
require.Equal(t, ds.BasicAuthUser, "basic_auth_user") 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.WithCredentials)
require.True(t, ds.IsDefault) require.True(t, ds.IsDefault)
require.True(t, ds.Editable) require.True(t, ds.Editable)

View File

@@ -6,12 +6,10 @@ datasources:
access: proxy access: proxy
orgId: 2 orgId: 2
url: url url: url
password: password
user: user user: user
database: database database: database
basicAuth: true basicAuth: true
basicAuthUser: basic_auth_user basicAuthUser: basic_auth_user
basicAuthPassword: basic_auth_password
withCredentials: true withCredentials: true
isDefault: true isDefault: true
jsonData: jsonData:

View File

@@ -9,12 +9,10 @@ apiVersion: 1
# access: proxy # access: proxy
# orgId: 2 # orgId: 2
# url: url # url: url
# password: password
# user: user # user: user
# database: database # database: database
# basicAuth: true # basicAuth: true
# basicAuthUser: basic_auth_user # basicAuthUser: basic_auth_user
# basicAuthPassword: basic_auth_password
# withCredentials: true # withCredentials: true
# jsonData: # jsonData:
# graphiteVersion: "1.1" # graphiteVersion: "1.1"

View File

@@ -16,8 +16,6 @@
# org_id: 1 # org_id: 1
# # <string> url # # <string> url
# url: http://localhost:8080 # url: http://localhost:8080
# # <string> database password, if used
# password:
# # <string> database user, if used # # <string> database user, if used
# user: # user:
# # <string> database name, if used # # <string> database name, if used
@@ -26,8 +24,6 @@
# basic_auth: # basic_auth:
# # <string> basic auth username # # <string> basic auth username
# basic_auth_user: # basic_auth_user:
# # <string> basic auth password
# basic_auth_password:
# # <bool> enable/disable with credentials headers # # <bool> enable/disable with credentials headers
# with_credentials: # with_credentials:
# # <bool> mark as default datasource. Max one per org # # <bool> mark as default datasource. Max one per org

View File

@@ -4,12 +4,10 @@ datasources:
access: proxy access: proxy
org_id: 2 org_id: 2
url: url url: url
password: password
user: user user: user
database: database database: database
basic_auth: true basic_auth: true
basic_auth_user: basic_auth_user basic_auth_user: basic_auth_user
basic_auth_password: basic_auth_password
with_credentials: true with_credentials: true
is_default: true is_default: true
json_data: json_data:

View File

@@ -32,22 +32,20 @@ type upsertDataSourceFromConfig struct {
OrgID int64 OrgID int64
Version int Version int
Name string Name string
Type string Type string
Access string Access string
URL string URL string
Password string User string
User string Database string
Database string BasicAuth bool
BasicAuth bool BasicAuthUser string
BasicAuthUser string WithCredentials bool
BasicAuthPassword string IsDefault bool
WithCredentials bool JSONData map[string]interface{}
IsDefault bool SecureJSONData map[string]string
JSONData map[string]interface{} Editable bool
SecureJSONData map[string]string UID string
Editable bool
UID string
} }
type configsV0 struct { type configsV0 struct {
@@ -76,44 +74,40 @@ type deleteDatasourceConfigV1 struct {
} }
type upsertDataSourceFromConfigV0 struct { type upsertDataSourceFromConfigV0 struct {
OrgID int64 `json:"org_id" yaml:"org_id"` OrgID int64 `json:"org_id" yaml:"org_id"`
Version int `json:"version" yaml:"version"` Version int `json:"version" yaml:"version"`
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"` Type string `json:"type" yaml:"type"`
Access string `json:"access" yaml:"access"` Access string `json:"access" yaml:"access"`
URL string `json:"url" yaml:"url"` URL string `json:"url" yaml:"url"`
Password string `json:"password" yaml:"password"` User string `json:"user" yaml:"user"`
User string `json:"user" yaml:"user"` Database string `json:"database" yaml:"database"`
Database string `json:"database" yaml:"database"` BasicAuth bool `json:"basic_auth" yaml:"basic_auth"`
BasicAuth bool `json:"basic_auth" yaml:"basic_auth"` BasicAuthUser string `json:"basic_auth_user" yaml:"basic_auth_user"`
BasicAuthUser string `json:"basic_auth_user" yaml:"basic_auth_user"` WithCredentials bool `json:"with_credentials" yaml:"with_credentials"`
BasicAuthPassword string `json:"basic_auth_password" yaml:"basic_auth_password"` IsDefault bool `json:"is_default" yaml:"is_default"`
WithCredentials bool `json:"with_credentials" yaml:"with_credentials"` JSONData map[string]interface{} `json:"json_data" yaml:"json_data"`
IsDefault bool `json:"is_default" yaml:"is_default"` SecureJSONData map[string]string `json:"secure_json_data" yaml:"secure_json_data"`
JSONData map[string]interface{} `json:"json_data" yaml:"json_data"` Editable bool `json:"editable" yaml:"editable"`
SecureJSONData map[string]string `json:"secure_json_data" yaml:"secure_json_data"`
Editable bool `json:"editable" yaml:"editable"`
} }
type upsertDataSourceFromConfigV1 struct { type upsertDataSourceFromConfigV1 struct {
OrgID values.Int64Value `json:"orgId" yaml:"orgId"` OrgID values.Int64Value `json:"orgId" yaml:"orgId"`
Version values.IntValue `json:"version" yaml:"version"` Version values.IntValue `json:"version" yaml:"version"`
Name values.StringValue `json:"name" yaml:"name"` Name values.StringValue `json:"name" yaml:"name"`
Type values.StringValue `json:"type" yaml:"type"` Type values.StringValue `json:"type" yaml:"type"`
Access values.StringValue `json:"access" yaml:"access"` Access values.StringValue `json:"access" yaml:"access"`
URL values.StringValue `json:"url" yaml:"url"` URL values.StringValue `json:"url" yaml:"url"`
Password values.StringValue `json:"password" yaml:"password"` User values.StringValue `json:"user" yaml:"user"`
User values.StringValue `json:"user" yaml:"user"` Database values.StringValue `json:"database" yaml:"database"`
Database values.StringValue `json:"database" yaml:"database"` BasicAuth values.BoolValue `json:"basicAuth" yaml:"basicAuth"`
BasicAuth values.BoolValue `json:"basicAuth" yaml:"basicAuth"` BasicAuthUser values.StringValue `json:"basicAuthUser" yaml:"basicAuthUser"`
BasicAuthUser values.StringValue `json:"basicAuthUser" yaml:"basicAuthUser"` WithCredentials values.BoolValue `json:"withCredentials" yaml:"withCredentials"`
BasicAuthPassword values.StringValue `json:"basicAuthPassword" yaml:"basicAuthPassword"` IsDefault values.BoolValue `json:"isDefault" yaml:"isDefault"`
WithCredentials values.BoolValue `json:"withCredentials" yaml:"withCredentials"` JSONData values.JSONValue `json:"jsonData" yaml:"jsonData"`
IsDefault values.BoolValue `json:"isDefault" yaml:"isDefault"` SecureJSONData values.StringMapValue `json:"secureJsonData" yaml:"secureJsonData"`
JSONData values.JSONValue `json:"jsonData" yaml:"jsonData"` Editable values.BoolValue `json:"editable" yaml:"editable"`
SecureJSONData values.StringMapValue `json:"secureJsonData" yaml:"secureJsonData"` UID values.StringValue `json:"uid" yaml:"uid"`
Editable values.BoolValue `json:"editable" yaml:"editable"`
UID values.StringValue `json:"uid" yaml:"uid"`
} }
func (cfg *configsV1) mapToDatasourceFromConfig(apiVersion int64) *configs { func (cfg *configsV1) mapToDatasourceFromConfig(apiVersion int64) *configs {
@@ -127,42 +121,23 @@ func (cfg *configsV1) mapToDatasourceFromConfig(apiVersion int64) *configs {
for _, ds := range cfg.Datasources { for _, ds := range cfg.Datasources {
r.Datasources = append(r.Datasources, &upsertDataSourceFromConfig{ r.Datasources = append(r.Datasources, &upsertDataSourceFromConfig{
OrgID: ds.OrgID.Value(), OrgID: ds.OrgID.Value(),
Name: ds.Name.Value(), Name: ds.Name.Value(),
Type: ds.Type.Value(), Type: ds.Type.Value(),
Access: ds.Access.Value(), Access: ds.Access.Value(),
URL: ds.URL.Value(), URL: ds.URL.Value(),
Password: ds.Password.Value(), User: ds.User.Value(),
User: ds.User.Value(), Database: ds.Database.Value(),
Database: ds.Database.Value(), BasicAuth: ds.BasicAuth.Value(),
BasicAuth: ds.BasicAuth.Value(), BasicAuthUser: ds.BasicAuthUser.Value(),
BasicAuthUser: ds.BasicAuthUser.Value(), WithCredentials: ds.WithCredentials.Value(),
BasicAuthPassword: ds.BasicAuthPassword.Value(), IsDefault: ds.IsDefault.Value(),
WithCredentials: ds.WithCredentials.Value(), JSONData: ds.JSONData.Value(),
IsDefault: ds.IsDefault.Value(), SecureJSONData: ds.SecureJSONData.Value(),
JSONData: ds.JSONData.Value(), Editable: ds.Editable.Value(),
SecureJSONData: ds.SecureJSONData.Value(), Version: ds.Version.Value(),
Editable: ds.Editable.Value(), UID: ds.UID.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 { for _, ds := range cfg.DeleteDatasources {
@@ -186,23 +161,21 @@ func (cfg *configsV0) mapToDatasourceFromConfig(apiVersion int64) *configs {
for _, ds := range cfg.Datasources { for _, ds := range cfg.Datasources {
r.Datasources = append(r.Datasources, &upsertDataSourceFromConfig{ r.Datasources = append(r.Datasources, &upsertDataSourceFromConfig{
OrgID: ds.OrgID, OrgID: ds.OrgID,
Name: ds.Name, Name: ds.Name,
Type: ds.Type, Type: ds.Type,
Access: ds.Access, Access: ds.Access,
URL: ds.URL, URL: ds.URL,
Password: ds.Password, User: ds.User,
User: ds.User, Database: ds.Database,
Database: ds.Database, BasicAuth: ds.BasicAuth,
BasicAuth: ds.BasicAuth, BasicAuthUser: ds.BasicAuthUser,
BasicAuthUser: ds.BasicAuthUser, WithCredentials: ds.WithCredentials,
BasicAuthPassword: ds.BasicAuthPassword, IsDefault: ds.IsDefault,
WithCredentials: ds.WithCredentials, JSONData: ds.JSONData,
IsDefault: ds.IsDefault, SecureJSONData: ds.SecureJSONData,
JSONData: ds.JSONData, Editable: ds.Editable,
SecureJSONData: ds.SecureJSONData, Version: ds.Version,
Editable: ds.Editable,
Version: ds.Version,
}) })
} }
@@ -225,23 +198,21 @@ func createInsertCommand(ds *upsertDataSourceFromConfig) *models.AddDataSourceCo
} }
cmd := &models.AddDataSourceCommand{ cmd := &models.AddDataSourceCommand{
OrgId: ds.OrgID, OrgId: ds.OrgID,
Name: ds.Name, Name: ds.Name,
Type: ds.Type, Type: ds.Type,
Access: models.DsAccess(ds.Access), Access: models.DsAccess(ds.Access),
Url: ds.URL, Url: ds.URL,
Password: ds.Password, User: ds.User,
User: ds.User, Database: ds.Database,
Database: ds.Database, BasicAuth: ds.BasicAuth,
BasicAuth: ds.BasicAuth, BasicAuthUser: ds.BasicAuthUser,
BasicAuthUser: ds.BasicAuthUser, WithCredentials: ds.WithCredentials,
BasicAuthPassword: ds.BasicAuthPassword, IsDefault: ds.IsDefault,
WithCredentials: ds.WithCredentials, JsonData: jsonData,
IsDefault: ds.IsDefault, SecureJsonData: ds.SecureJSONData,
JsonData: jsonData, ReadOnly: !ds.Editable,
SecureJsonData: ds.SecureJSONData, Uid: ds.UID,
ReadOnly: !ds.Editable,
Uid: ds.UID,
} }
if cmd.Uid == "" { if cmd.Uid == "" {
@@ -266,23 +237,21 @@ func createUpdateCommand(ds *upsertDataSourceFromConfig, id int64) *models.Updat
} }
return &models.UpdateDataSourceCommand{ return &models.UpdateDataSourceCommand{
Id: id, Id: id,
Uid: ds.UID, Uid: ds.UID,
OrgId: ds.OrgID, OrgId: ds.OrgID,
Name: ds.Name, Name: ds.Name,
Type: ds.Type, Type: ds.Type,
Access: models.DsAccess(ds.Access), Access: models.DsAccess(ds.Access),
Url: ds.URL, Url: ds.URL,
Password: ds.Password, User: ds.User,
User: ds.User, Database: ds.Database,
Database: ds.Database, BasicAuth: ds.BasicAuth,
BasicAuth: ds.BasicAuth, BasicAuthUser: ds.BasicAuthUser,
BasicAuthUser: ds.BasicAuthUser, WithCredentials: ds.WithCredentials,
BasicAuthPassword: ds.BasicAuthPassword, IsDefault: ds.IsDefault,
WithCredentials: ds.WithCredentials, JsonData: jsonData,
IsDefault: ds.IsDefault, SecureJsonData: ds.SecureJSONData,
JsonData: jsonData, ReadOnly: !ds.Editable,
SecureJsonData: ds.SecureJSONData,
ReadOnly: !ds.Editable,
} }
} }

View File

@@ -152,26 +152,24 @@ func (ss *SQLStore) AddDataSource(ctx context.Context, cmd *models.AddDataSource
} }
ds := &models.DataSource{ ds := &models.DataSource{
OrgId: cmd.OrgId, OrgId: cmd.OrgId,
Name: cmd.Name, Name: cmd.Name,
Type: cmd.Type, Type: cmd.Type,
Access: cmd.Access, Access: cmd.Access,
Url: cmd.Url, Url: cmd.Url,
User: cmd.User, User: cmd.User,
Password: cmd.Password, Database: cmd.Database,
Database: cmd.Database, IsDefault: cmd.IsDefault,
IsDefault: cmd.IsDefault, BasicAuth: cmd.BasicAuth,
BasicAuth: cmd.BasicAuth, BasicAuthUser: cmd.BasicAuthUser,
BasicAuthUser: cmd.BasicAuthUser, WithCredentials: cmd.WithCredentials,
BasicAuthPassword: cmd.BasicAuthPassword, JsonData: cmd.JsonData,
WithCredentials: cmd.WithCredentials, SecureJsonData: cmd.EncryptedSecureJsonData,
JsonData: cmd.JsonData, Created: time.Now(),
SecureJsonData: cmd.EncryptedSecureJsonData, Updated: time.Now(),
Created: time.Now(), Version: 1,
Updated: time.Now(), ReadOnly: cmd.ReadOnly,
Version: 1, Uid: cmd.Uid,
ReadOnly: cmd.ReadOnly,
Uid: cmd.Uid,
} }
if _, err := sess.Insert(ds); err != nil { if _, err := sess.Insert(ds); err != nil {
@@ -215,26 +213,24 @@ func (ss *SQLStore) UpdateDataSource(ctx context.Context, cmd *models.UpdateData
} }
ds := &models.DataSource{ ds := &models.DataSource{
Id: cmd.Id, Id: cmd.Id,
OrgId: cmd.OrgId, OrgId: cmd.OrgId,
Name: cmd.Name, Name: cmd.Name,
Type: cmd.Type, Type: cmd.Type,
Access: cmd.Access, Access: cmd.Access,
Url: cmd.Url, Url: cmd.Url,
User: cmd.User, User: cmd.User,
Password: cmd.Password, Database: cmd.Database,
Database: cmd.Database, IsDefault: cmd.IsDefault,
IsDefault: cmd.IsDefault, BasicAuth: cmd.BasicAuth,
BasicAuth: cmd.BasicAuth, BasicAuthUser: cmd.BasicAuthUser,
BasicAuthUser: cmd.BasicAuthUser, WithCredentials: cmd.WithCredentials,
BasicAuthPassword: cmd.BasicAuthPassword, JsonData: cmd.JsonData,
WithCredentials: cmd.WithCredentials, SecureJsonData: cmd.EncryptedSecureJsonData,
JsonData: cmd.JsonData, Updated: time.Now(),
SecureJsonData: cmd.EncryptedSecureJsonData, ReadOnly: cmd.ReadOnly,
Updated: time.Now(), Version: cmd.Version + 1,
ReadOnly: cmd.ReadOnly, Uid: cmd.Uid,
Version: cmd.Version + 1,
Uid: cmd.Uid,
} }
sess.UseBool("is_default") sess.UseBool("is_default")

View File

@@ -6832,13 +6832,6 @@
"summary": "Add External Group.", "summary": "Add External Group.",
"operationId": "addTeamGroupApi", "operationId": "addTeamGroupApi",
"parameters": [ "parameters": [
{
"type": "integer",
"format": "int64",
"name": "teamId",
"in": "path",
"required": true
},
{ {
"name": "body", "name": "body",
"in": "body", "in": "body",
@@ -6846,6 +6839,13 @@
"schema": { "schema": {
"$ref": "#/definitions/TeamGroupMapping" "$ref": "#/definitions/TeamGroupMapping"
} }
},
{
"type": "integer",
"format": "int64",
"name": "teamId",
"in": "path",
"required": true
} }
], ],
"responses": { "responses": {
@@ -6879,14 +6879,14 @@
{ {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"name": "teamId", "name": "groupId",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"name": "groupId", "name": "teamId",
"in": "path", "in": "path",
"required": true "required": true
} }
@@ -8002,9 +8002,6 @@
"basicAuth": { "basicAuth": {
"type": "boolean" "type": "boolean"
}, },
"basicAuthPassword": {
"type": "string"
},
"basicAuthUser": { "basicAuthUser": {
"type": "string" "type": "string"
}, },
@@ -8020,9 +8017,6 @@
"name": { "name": {
"type": "string" "type": "string"
}, },
"password": {
"type": "string"
},
"secureJsonData": { "secureJsonData": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
@@ -9711,9 +9705,6 @@
"basicAuth": { "basicAuth": {
"type": "boolean" "type": "boolean"
}, },
"basicAuthPassword": {
"type": "string"
},
"basicAuthUser": { "basicAuthUser": {
"type": "string" "type": "string"
}, },
@@ -9737,9 +9728,6 @@
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"password": {
"type": "string"
},
"readOnly": { "readOnly": {
"type": "boolean" "type": "boolean"
}, },
@@ -9808,9 +9796,6 @@
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"password": {
"type": "string"
},
"readOnly": { "readOnly": {
"type": "boolean" "type": "boolean"
}, },
@@ -14454,9 +14439,6 @@
"basicAuth": { "basicAuth": {
"type": "boolean" "type": "boolean"
}, },
"basicAuthPassword": {
"type": "string"
},
"basicAuthUser": { "basicAuthUser": {
"type": "string" "type": "string"
}, },
@@ -14472,9 +14454,6 @@
"name": { "name": {
"type": "string" "type": "string"
}, },
"password": {
"type": "string"
},
"secureJsonData": { "secureJsonData": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {

View File

@@ -6832,13 +6832,6 @@
"summary": "Add External Group.", "summary": "Add External Group.",
"operationId": "addTeamGroupApi", "operationId": "addTeamGroupApi",
"parameters": [ "parameters": [
{
"type": "integer",
"format": "int64",
"name": "teamId",
"in": "path",
"required": true
},
{ {
"name": "body", "name": "body",
"in": "body", "in": "body",
@@ -6846,6 +6839,13 @@
"schema": { "schema": {
"$ref": "#/definitions/TeamGroupMapping" "$ref": "#/definitions/TeamGroupMapping"
} }
},
{
"type": "integer",
"format": "int64",
"name": "teamId",
"in": "path",
"required": true
} }
], ],
"responses": { "responses": {
@@ -6879,14 +6879,14 @@
{ {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"name": "teamId", "name": "groupId",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"name": "groupId", "name": "teamId",
"in": "path", "in": "path",
"required": true "required": true
} }
@@ -7993,9 +7993,6 @@
"basicAuth": { "basicAuth": {
"type": "boolean" "type": "boolean"
}, },
"basicAuthPassword": {
"type": "string"
},
"basicAuthUser": { "basicAuthUser": {
"type": "string" "type": "string"
}, },
@@ -8011,9 +8008,6 @@
"name": { "name": {
"type": "string" "type": "string"
}, },
"password": {
"type": "string"
},
"secureJsonData": { "secureJsonData": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
@@ -9455,9 +9449,6 @@
"basicAuth": { "basicAuth": {
"type": "boolean" "type": "boolean"
}, },
"basicAuthPassword": {
"type": "string"
},
"basicAuthUser": { "basicAuthUser": {
"type": "string" "type": "string"
}, },
@@ -9481,9 +9472,6 @@
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"password": {
"type": "string"
},
"readOnly": { "readOnly": {
"type": "boolean" "type": "boolean"
}, },
@@ -9552,9 +9540,6 @@
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"password": {
"type": "string"
},
"readOnly": { "readOnly": {
"type": "boolean" "type": "boolean"
}, },
@@ -11772,9 +11757,6 @@
"basicAuth": { "basicAuth": {
"type": "boolean" "type": "boolean"
}, },
"basicAuthPassword": {
"type": "string"
},
"basicAuthUser": { "basicAuthUser": {
"type": "string" "type": "string"
}, },
@@ -11790,9 +11772,6 @@
"name": { "name": {
"type": "string" "type": "string"
}, },
"password": {
"type": "string"
},
"secureJsonData": { "secureJsonData": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {

View File

@@ -13,7 +13,6 @@ export const getMockDataSources = (amount: number) => {
jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' }, jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' },
name: `dataSource-${i}`, name: `dataSource-${i}`,
orgId: 1, orgId: 1,
password: '',
readOnly: false, readOnly: false,
type: 'cloudwatch', type: 'cloudwatch',
typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png', typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png',
@@ -30,7 +29,6 @@ export const getMockDataSource = (): DataSourceSettings => {
access: '', access: '',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
database: '', database: '',
id: 13, id: 13,
@@ -40,7 +38,6 @@ export const getMockDataSource = (): DataSourceSettings => {
name: 'gdev-cloudwatch', name: 'gdev-cloudwatch',
typeName: 'Cloudwatch', typeName: 'Cloudwatch',
orgId: 1, orgId: 1,
password: '',
readOnly: false, readOnly: false,
type: 'cloudwatch', type: 'cloudwatch',
typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png', typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png',

View File

@@ -43,7 +43,6 @@ exports[`Render should render action bar and datasources 1`] = `
}, },
"name": "dataSource-0", "name": "dataSource-0",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"type": "cloudwatch", "type": "cloudwatch",
"typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", "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", "name": "dataSource-1",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"type": "cloudwatch", "type": "cloudwatch",
"typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", "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", "name": "dataSource-2",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"type": "cloudwatch", "type": "cloudwatch",
"typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", "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", "name": "dataSource-3",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"type": "cloudwatch", "type": "cloudwatch",
"typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", "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", "name": "dataSource-4",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"type": "cloudwatch", "type": "cloudwatch",
"typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png", "typeLogoUrl": "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png",

View File

@@ -11,11 +11,9 @@ export function createDatasourceSettings<T>(jsonData: T): DataSourceSettings<T>
typeName: 'Datasource', typeName: 'Datasource',
access: 'server', access: 'server',
url: 'http://localhost', url: 'http://localhost',
password: '',
user: '', user: '',
database: '', database: '',
basicAuth: false, basicAuth: false,
basicAuthPassword: '',
basicAuthUser: '', basicAuthUser: '',
isDefault: false, isDefault: false,
jsonData, jsonData,

View File

@@ -154,7 +154,6 @@ export function getDataSourceLoadingNav(pageName: string): NavModel {
access: '', access: '',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
database: '', database: '',
id: 1, id: 1,
@@ -163,7 +162,6 @@ export function getDataSourceLoadingNav(pageName: string): NavModel {
jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' }, jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' },
name: 'Loading', name: 'Loading',
orgId: 1, orgId: 1,
password: '',
readOnly: false, readOnly: false,
type: loadingDSType, type: loadingDSType,
typeName: loadingDSType, typeName: loadingDSType,

View File

@@ -34,9 +34,7 @@ const setup = (propOverrides?: object) => {
type: 'cloudwatch', type: 'cloudwatch',
typeName: 'Cloudwatch', typeName: 'Cloudwatch',
user: '', user: '',
password: '',
basicAuth: false, basicAuth: false,
basicAuthPassword: '',
basicAuthUser: '', basicAuthUser: '',
isDefault: true, isDefault: true,
readOnly: false, readOnly: false,

View File

@@ -8,7 +8,6 @@ exports[`Render should disable access key id field 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 1, "id": 1,
@@ -24,7 +23,6 @@ exports[`Render should disable access key id field 1`] = `
}, },
"name": "CloudWatch", "name": "CloudWatch",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonData": Object { "secureJsonData": Object {
"accessKey": "", "accessKey": "",
@@ -99,7 +97,6 @@ exports[`Render should render component 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 1, "id": 1,
@@ -115,7 +112,6 @@ exports[`Render should render component 1`] = `
}, },
"name": "CloudWatch", "name": "CloudWatch",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonData": Object { "secureJsonData": Object {
"accessKey": "", "accessKey": "",
@@ -190,7 +186,6 @@ exports[`Render should show access key and secret access key fields 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 1, "id": 1,
@@ -206,7 +201,6 @@ exports[`Render should show access key and secret access key fields 1`] = `
}, },
"name": "CloudWatch", "name": "CloudWatch",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonData": Object { "secureJsonData": Object {
"accessKey": "", "accessKey": "",
@@ -281,7 +275,6 @@ exports[`Render should show arn role field 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 1, "id": 1,
@@ -297,7 +290,6 @@ exports[`Render should show arn role field 1`] = `
}, },
"name": "CloudWatch", "name": "CloudWatch",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonData": Object { "secureJsonData": Object {
"accessKey": "", "accessKey": "",
@@ -372,7 +364,6 @@ exports[`Render should show credentials profile name field 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 1, "id": 1,
@@ -388,7 +379,6 @@ exports[`Render should show credentials profile name field 1`] = `
}, },
"name": "CloudWatch", "name": "CloudWatch",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonData": Object { "secureJsonData": Object {
"accessKey": "", "accessKey": "",

View File

@@ -14,12 +14,10 @@ describe('AppInsights ConfigEditor', () => {
typeName: 'Azure', typeName: 'Azure',
access: 'proxy', access: 'proxy',
url: '', url: '',
password: '',
user: '', user: '',
database: '', database: '',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
isDefault: false, isDefault: false,
jsonData: {}, jsonData: {},

View File

@@ -26,12 +26,10 @@ const setup = (propOverrides?: object) => {
typeLogoUrl: '', typeLogoUrl: '',
access: 'proxy', access: 'proxy',
url: '', url: '',
password: '',
user: '', user: '',
database: '', database: '',
basicAuth: false, basicAuth: false,
basicAuthUser: '', basicAuthUser: '',
basicAuthPassword: '',
withCredentials: false, withCredentials: false,
isDefault: false, isDefault: false,
jsonData: { jsonData: {

View File

@@ -57,7 +57,6 @@ exports[`Render should disable basic auth password input 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 21, "id": 21,
@@ -68,7 +67,6 @@ exports[`Render should disable basic auth password input 1`] = `
}, },
"name": "InfluxDB-3", "name": "InfluxDB-3",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonFields": Object {}, "secureJsonFields": Object {},
"type": "influxdb", "type": "influxdb",
@@ -322,7 +320,6 @@ exports[`Render should hide basic auth fields when switch off 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 21, "id": 21,
@@ -333,7 +330,6 @@ exports[`Render should hide basic auth fields when switch off 1`] = `
}, },
"name": "InfluxDB-3", "name": "InfluxDB-3",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonFields": Object {}, "secureJsonFields": Object {},
"type": "influxdb", "type": "influxdb",
@@ -587,7 +583,6 @@ exports[`Render should hide white listed cookies input when browser access chose
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 21, "id": 21,
@@ -598,7 +593,6 @@ exports[`Render should hide white listed cookies input when browser access chose
}, },
"name": "InfluxDB-3", "name": "InfluxDB-3",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonFields": Object {}, "secureJsonFields": Object {},
"type": "influxdb", "type": "influxdb",
@@ -852,7 +846,6 @@ exports[`Render should render component 1`] = `
Object { Object {
"access": "proxy", "access": "proxy",
"basicAuth": false, "basicAuth": false,
"basicAuthPassword": "",
"basicAuthUser": "", "basicAuthUser": "",
"database": "", "database": "",
"id": 21, "id": 21,
@@ -863,7 +856,6 @@ exports[`Render should render component 1`] = `
}, },
"name": "InfluxDB-3", "name": "InfluxDB-3",
"orgId": 1, "orgId": 1,
"password": "",
"readOnly": false, "readOnly": false,
"secureJsonFields": Object {}, "secureJsonFields": Object {},
"type": "influxdb", "type": "influxdb",