-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] storage/remote: use YAML data instead of JSON for MD5 hash #6456
[WIP] storage/remote: use YAML data instead of JSON for MD5 hash #6456
Conversation
Huh? I don't see how that could be an issue. That we're not considering secrets is an issue. |
3896e4a
to
b99d365
Compare
True. I've added a unit test to catch this. |
storage/remote/write_test.go
Outdated
testutil.Equals(t, 3, len(s.queues)) | ||
|
||
testutil.Assert(t, q0 == s.queues[0], "Pointer of unchanged queue should have remained the same") | ||
testutil.Assert(t, q1 != s.queues[1], "If the index changed, the queue should be stopped and recreated.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the message here be around changing the bearer token should restart the queue?
I don't see what that has to do with field tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have opinions on the yaml vs. json
storage/remote/write_test.go
Outdated
testutil.Equals(t, 3, len(s.queues)) | ||
|
||
testutil.Assert(t, q == s.queues[1], "Pointer of unchanged queue should have remained the same") | ||
testutil.Assert(t, q0 != s.queues[0], "If the index changed, the queue should be stopped and recreated.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message here isn't helpful in my opinion. What index are you referring to? The index of the queue's config in the overall RemoteWriteConfigs
array? Rearranging those should no longer result in queue restarts. So I think this (and similar lines) should mention which part of the config was changed, and that when changing that field we expect to see a queue restart.
the master branch has updated which use hash instead of index. #6043 |
As @johncming pointed out, I need to rebase the change but from a quick look, the issues should still exist. |
My bad, I pointed out that the test failure messages should be updated but that PR had only been merged a few hours earlier. It had been open long enough that I just had it in my head that the index to hash change was already merged. |
I've run into this bug in two ways, both with regards to write_relabel_configs:
I'd really like to see this PR merged. We can create hacky workarounds, but would prefer not to. |
@simonpasquier Do you think you will have an opportunity to rebase this soon? |
b99d365
to
d67dbce
Compare
I've rebased my change but it only includes the test that demonstrates the issue. I don't have an immediate solution though. |
I thought just changing the hashes to use YAML instead of JSON fixed it? Did those changes disappear? |
It does fix the issue in a way but it breaks in another. More precisely secret fields (bearer tokens for instance) are marshaled as |
Would it make sense to update the yaml marshaller to include a hash of the secret? That should fix the toHash function for regexes and secrets without exposing the secret. Not sure if it will break anything. |
I did think about it but I don't like it... That would make the hash user
visible
Le sam. 1 févr. 2020 à 00:25, Jake Utley <notifications@github.com> a
écrit :
… Would it make sense to update the yaml marshaller to include a hash of the
secret? That should fix the toHash function for regexes and secrets without
exposing the secret. Not sure if it will break anything.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6456?email_source=notifications&email_token=AACHHJSG7HTYZEWOTJ5HU73RASXNVA5CNFSM4JZ6TWZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKQKR2Q#issuecomment-580954346>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHHJV7YWVTHCR6JNNXT33RASXNVANCNFSM4JZ6TWZQ>
.
|
@roidelapluie To be clear, what would be the concern with a user-visible hash? I suppose it would allow a user to identify secret re-use. Are there any other concerns? |
Hash should not be used to hide secrets. They are not meant for security. |
It depends on the hash, but even with a proper cryptographic hash you could e.g. notice that two secrets were the same. |
So, it seems like there are 2 requirements here:
In order for these to not conflict, I think we must either 1) salt and hash the secrets when marshaling, or 2) not implement hashing using YAML marshaling. I already implemented the second option with my original solution in #6546, which uses the JSON marshaler and provides an implementation for Regexp. However, this really feels like an abuse of the fact that there are multiple marshalers available, especially given that the JSON marshalers are never intentionally implemented in this project. |
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
But it doesn't work either because of secret fields. Signed-off-by: Simon Pasquier <spasquie@redhat.com>
d67dbce
to
b446c4e
Compare
Would it be reasonable to keep the yaml marshaling for the hash, thus having redacted secrets, and specifically update a queue whenever one of the secrets changes? Or else have a way to update the http client on a |
What prevents us to use reflects.Deepequal? |
Closing as I took this over in #7073 |
The configuration structs don't have JSON field tags so there's no guarantee that different configurations produce different JSON data. This isn't the case for YAML.
This is similar to #6455.