Added warnings when configuring connection info in sql backends

This commit is contained in:
vishalnayak
2016-06-21 09:58:57 -04:00
parent 799bb9c286
commit ff90768684
6 changed files with 14 additions and 12 deletions

View File

@@ -38,9 +38,6 @@ func TestBackend_config_connection(t *testing.T) {
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
if resp != nil {
t.Fatalf("expected a nil response")
}
configReq.Operation = logical.ReadOperation
resp, err = b.HandleRequest(configReq)

View File

@@ -98,7 +98,11 @@ func (b *backend) pathConnectionWrite(req *logical.Request, data *framework.Fiel
// Reset the DB connection
b.ResetDB()
return nil, nil
resp := &logical.Response{}
resp.AddWarning("Read access to this endpoint should be controlled via ACLs as it will return the connection string as it is, including passwords, if any.")
return resp, nil
}
type connectionConfig struct {

View File

@@ -39,9 +39,6 @@ func TestBackend_config_connection(t *testing.T) {
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
if resp != nil {
t.Fatalf("expected a nil response")
}
configReq.Operation = logical.ReadOperation
resp, err = b.HandleRequest(configReq)

View File

@@ -112,7 +112,11 @@ func (b *backend) pathConnectionWrite(
// Reset the DB connection
b.ResetDB()
return nil, nil
resp := &logical.Response{}
resp.AddWarning("Read access to this endpoint should be controlled via ACLs as it will return the connection URL as it is, including passwords, if any.")
return resp, nil
}
type connectionConfig struct {

View File

@@ -42,9 +42,6 @@ func TestBackend_config_connection(t *testing.T) {
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
if resp != nil {
t.Fatalf("expected a nil response")
}
configReq.Operation = logical.ReadOperation
resp, err = b.HandleRequest(configReq)

View File

@@ -134,7 +134,10 @@ func (b *backend) pathConnectionWrite(
// Reset the DB connection
b.ResetDB()
return nil, nil
resp := &logical.Response{}
resp.AddWarning("Read access to this endpoint should be controlled via ACLs as it will return the connection string or URL as it is, including passwords, if any.")
return resp, nil
}
type connectionConfig struct {