-
Notifications
You must be signed in to change notification settings - Fork 168
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
Allow reading from and writing to plain text using secretsmanager backend #361
Comments
I haven't been involved in this project previously, but would like to respond. (I'm a Segment employee.) It does look like chamber requires secret values in AWS Secrets Manager to be a specific JSON structure, containing keys and values and other expected metadata. So, a secret value that's plain text - say, something like "foo" or even "foo=bar" - just isn't supported. I don't see a way to support plain text in the secret value and retain parity between Secrets Manager and other backends. If the problem is writing a plain text value into a secret that can be read by chamber, then the
If I'm missing the point of the problem, please respond with more details. Thanks! |
Thanks for commenting. I suppose writing plain text works (I haven't tried and I will) but reading plain text doesn't work and reading isn't possible for this backend and have it work with other backends. Thanks for confirming. If we can leave this open for now it would be nice if there are other ideas. There must be a way to do it |
Sure, let's leave this open until we work it out! Digging deeper: In your original example, there are two service arguments used: I think the problem may be down to how chamber expects to unmarshal the secret string value as JSON. (In secretsmanagerstore.go, it's the
When I change the raw string to
So, at the moment, by design, chamber requires a JSON structure. It can deal with a flat map structure that wasn't originally written by chamber, in order to consume values written by the AWS console. Even with that extended support, though, there's no chamber metadata available, so stuff like history isn't available. With some code changes, I guess chamber could be able to read an arbitrary string in as just a single, unnamed secret. However, one problem with that is that chamber wouldn't be able to tell if it's reading an arbitrary string or malformed JSON. Maybe a command line option could give it a hint? Regardless, it seems safer to update whatever writes the secret either use Thoughts? |
Thanks for diving in again. The issue only comes up when reading plain-text secrets that weren't originally saved by chamber. It's true, it's possible to overwrite the secret with a json value, however that would also require updating service code or infrastructure to ensure it understands the secret and its new structure. If you have 1000s of plain-text secrets, now you're talking about a very long migration plan and for no business value so in the end, the awscli would then be more preferable to use. 😭 |
My AWS Secrets Manager secret contains only plain text information so no key-value
key-value works
but plain text does not
Here's the creation using the awscli of both of the types above
https://stackoverflow.com/a/58943565
Workaround for the list (or list-services) is to go back to awscli
Here is the list function
chamber/store/secretsmanagerstore.go
Lines 365 to 378 in 0fda232
which calls
readLatest
chamber/store/secretsmanagerstore.go
Lines 334 to 354 in 0fda232
which calls
jsonToSecretValueObject
chamber/store/secretsmanagerstore.go
Lines 556 to 562 in 0fda232
which tries to do a
json.Unmarshal
and failsHere is the read function
chamber/store/secretsmanagerstore.go
Lines 229 to 239 in 0fda232
The text was updated successfully, but these errors were encountered: