Skip to content

Commit

Permalink
Ruler: Fix remote write basic auth credentials (#5144)
Browse files Browse the repository at this point in the history
* Retrieving original password to avoid marshaling issues

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>

* Fixing test

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>

* Adding CHANGELOG entry

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
  • Loading branch information
Danny Kopping authored Jan 14, 2022
1 parent e5c5143 commit 0368a09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Main

* [5107](https://github.com/grafana/loki/pull5107) **chaudum** Fix bug in fluentd plugin that caused log lines containing non UTF-8 characters to be dropped.
* [5144](https://github.com/grafana/loki/pull/5144) **dannykopping** Ruler: fix remote write basic auth credentials.
* [5107](https://github.com/grafana/loki/pull/5107) **chaudum** Fix bug in fluentd plugin that caused log lines containing non UTF-8 characters to be dropped.
* [5091](https://github.com/grafana/loki/pull/5091) **owen-d**: Changes `ingester.concurrent-flushes` default to 32
* [4879](https://github.com/grafana/loki/pull/4879) **cyriltovena**: LogQL: add __line__ function to | line_format template.
* [5081](https://github.com/grafana/loki/pull/5081) **SasSwart**: Add the option to configure memory ballast for Loki
Expand Down
4 changes: 4 additions & 0 deletions pkg/ruler/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func (c *RemoteWriteConfig) Clone() (*RemoteWriteConfig, error) {
return nil, err
}

// BasicAuth.Password has a type of Secret (github.com/prometheus/common/config/config.go),
// so when its value is marshaled it is obfuscated as "<secret>".
// Here we copy the original password into the cloned config.
n.Client.HTTPClientConfig.BasicAuth.Password = c.Client.HTTPClientConfig.BasicAuth.Password
return n, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ruler/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func TestTenantRemoteWriteHTTPConfigMaintained(t *testing.T) {

// HTTP client config is not currently overrideable, all tenants' configs should inherit base
assert.Equal(t, tenantCfg.RemoteWrite[0].HTTPClientConfig.BasicAuth.Username, "foo")
assert.Equal(t, tenantCfg.RemoteWrite[0].HTTPClientConfig.BasicAuth.Password, promConfig.Secret("<secret>"))
assert.Equal(t, tenantCfg.RemoteWrite[0].HTTPClientConfig.BasicAuth.Password, promConfig.Secret("bar"))
}

func TestTenantRemoteWriteHeaderOverride(t *testing.T) {
Expand Down

0 comments on commit 0368a09

Please sign in to comment.