-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add raw input in docker-compose for secrets and configs #712
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #712 +/- ##
==========================================
+ Coverage 51.81% 51.88% +0.06%
==========================================
Files 218 218
Lines 17924 17934 +10
==========================================
+ Hits 9288 9305 +17
+ Misses 8160 8152 -8
- Partials 476 477 +1 |
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
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.
Thanks, this is looking good.
I think the only thing we're missing is an error when raw is used with file. That can be handled with a constraint in the schema.
Yeah, I'll try to add that |
Should I force user to set
And |
yes, one should be required |
Signed-off-by: WTFKr0 <[email protected]>
After some tests, i think i got it with "oneOf": [
{
"required": ["file"],
"not": {"required": ["raw"]}
},
{
"required": ["raw"],
"not": {"required": ["file"]}
}
], But errors messages are like that :
|
Ahh need to allow no file and no raw for external config/secret... |
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
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.
Design LGTM
cli/compose/schema/schema_test.go
Outdated
} | ||
|
||
err := Validate(config, "3.5") | ||
assert.Error(t, err) |
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.
This should test for the error with EqualError()
, or ErrorContains()
cli/compose/schema/schema_test.go
Outdated
} | ||
|
||
err := Validate(config, "3.5") | ||
assert.Error(t, err) |
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.
same here
Signed-off-by: WTFKr0 <[email protected]>
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.
@thaJeztah do you see any issues with accepting secrets and configs from the Compose file?
cli/compose/schema/schema_test.go
Outdated
} | ||
|
||
err := Validate(config, "3.5") | ||
assert.EqualError(t, err, "configs.bar Must not validate the schema (not)") |
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.
We need to find some way to provide a better error message here.
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.
It looks like these errors are handled in cli/compose/schema/schema.go:getMostSpecificError()
. We probably need a special case for not
that provides more detail.
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.
ok thanx, will check that soon
Signed-off-by: WTFKr0 <[email protected]>
Signed-off-by: WTFKr0 <[email protected]>
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.
LGTM
Thanks!
D'you want me to resolve the conflict by merging last master onto this branch and regenerate bindata ? |
Ah yes, please do |
The bit I'm worried about is that putting secrets in this file effectively nullifies all the security measures that went into the What are the benefits of putting the secrets in this file, instead of a separate file? (If you want to store the secret in a file) |
For configs, we can be a bit more flexible, BUT, in many occasions those may contain secrets as well, so I'd like moby/moby#33702 to be implemented so that secrets in config-files would no longer be needed (i.e. I can have a config-template that refers to a secret to use) |
My use case is a docker-compose file commited with a demo secret or demo config, it's better for users who want to test an app to have a one command deployment ( |
But adding a separate demo-secret to the repository, and reference that from the compose file would bring the same, correct? |
We often just provide a docker-compose file, not an entire git repo with all files |
Signed-off-by: WTFKr0 <[email protected]>
Supporting the |
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.
Design LGTM
cc @thaJeztah
Sorry, I'm still -1 on this; as @WTFKr0's use case describes; this is gonna be used to replace environment variables (separate from the problem that environment variables are really not suitable for storing secrets), and store the literal secrets in a compose file. I would like the security team to review this before we go ahead |
@dnephin do you mean apart from the compose file in which the secret is written to disk and even worse, likely committed in to a VCS in some repo not specifically designed for protecting secrets? If the compose/stack file is committed in to a repo, there is no reason not to simply commit your demo secrets in to files beside the compose file, or as we do in notary, in to a folder called something like Beyond secrets, how much testing has been done for different file formats in raw? Does yaml work? How about toml, or ini? From a security perspective, I strongly dislike this. From a testing/quality perspective, it's completely lacking in tests for various popular config file types that consider whitespace important. |
I don't understand what you're asking. Currently there is only one way to use secrets/config with the Compose file. You must have them in a file on the local disk. By adding a secrets:
foo:
raw: "$FOO_SECRET" Which removes the need to store something on disk.
I don't think this is a fair assumption. Even if it is committed to disk, isn't that choice (and the associated risk) obvious to the user? For most dev and testing use cases that is unlikely to be a problem.
This is not a concern. Yaml supports raw string value, the content is irrelevant, it is always interpreted as a string literal.
|
Hey all Any information on status of this PR pls ? Thanx for reading |
I'm still not convinced we should do this 😅
Secrets were explicitly designed to prevent using env-vars for secrets; that example (albeit not on the container itself) re-introduces the usage of environment variables to store them. I also disagree that "there is only one way to use secrets/config"; secrets/configs can be created up-front (which allows creating them from stdin or whatever means), and can be referenced using |
Container/image "environment variables" are a problem because they are stored in the config and viewable from I believe regular process environment variables are only viewable from |
I need that for configs too Thanx |
Hi all |
Also have a look at moby/moby#33702, which may have some overlap |
I don't think it overlaps. It would be great to get this feature in for configs at least, if there are still concerns about using it for secrets. |
Hey, just reviewing my old staled PR on github 😄 Thanx |
Hi Any update ?? |
Closes #320
- What I did
I add a new raw field for secret and config creation in docker-compose file
- How I did it
I changed the schema v3.5 to add this field
I modify the way config and secret are loaded from file to add option to load from a string
- How to verify it
With this compose file for example :
Once running, we got :
- Description for the changelog
Add raw input in docker-compose for secrets and configs
- A picture of a cute animal (not mandatory but encouraged)
