Skip to content

Deprecate unencrypted storage#561

Merged
thaJeztah merged 1 commit intodocker:masterfrom
tych0:deprecate-unencrypted-storage
Mar 27, 2018
Merged

Deprecate unencrypted storage#561
thaJeztah merged 1 commit intodocker:masterfrom
tych0:deprecate-unencrypted-storage

Conversation

@tych0
Copy link
Contributor

@tych0 tych0 commented Sep 26, 2017

This is an implementation of #559.

cc @n4ss @thaJeztah @vdemeester @dnephin @vieux @tiborvass @cpuguy83

Copy link
Contributor

@mdlinville mdlinville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing it, but you should also mark it as deprecated in Cobra. @thaJeztah can you give guidance on where and how to do this?

// FileStore implements a credentials store using
// the docker configuration file to keep the credentials in plain text.
type fileStore struct {
type FileStore struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of exporting this (something we want to deprecate) how about adding a new IsNotSecure() method to fileStore, and creating the interface in cli/command/registry/login.go to check it?

type notSecure interface {
    IsNotSecure() bool
}

if _, isNotSecure := creds.(notSecure); isNotSecure {
 ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this, but as it stands there are two backends: fileStore and nativeStore, which is what implements the docker credential helpers interface. You could imagine a credential helper that just wrote plain text to a file, which would not be secure, but writing "!isNotSecure" seems to imply that the backend is secure, when it's not: nativeStore can't vouch for what's on the other end.

Copy link
Contributor

@dnephin dnephin Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then how about IsDeprecated() and type deprecated interface{...} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this too, but in the event that we don't deprecate this based on discussion, I think we should still merge this patch, but tagging it as deprecated would be incorrect. We could cast by GetFilename, since that is unique to the FileStore, but it doesn't really describe what we're trying to detect. So I dunno :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to pick some other interface, my concern is just that it doesn't make sense to export this entire struct if all we need is some way detect that it is of this type.

Another option is to export an IsFileStore(). That way we're only exporting one function and not the entire struct.

// logins and we don't want to break them. Maybe they'll see
// the warning in their logs and fix things. If it is
// interactive, let's ask them if they really want to do this.
if dockerCli.In().IsTerminal() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract the entire confirmation block into a new function so the comment can be a godoc string instead of inline comment.

for {

fmt.Fprintf(dockerCli.Err(), "Do you want to continue? (yes/no): ")
choice, _, err := bufio.NewReader(dockerCli.In()).ReadLine()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnephin
Copy link
Contributor

dnephin commented Sep 26, 2017

@mstanleyjones I don't think this is related to a specific flag, so I don't know if there is anywhere in cobra to deprecate it.

Copy link
Contributor

@mdlinville mdlinville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs LGTM

@tiborvass
Copy link
Collaborator

tiborvass commented Sep 26, 2017

FYI This is in design review phase.

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design LGTM

const unencryptedWarning = `WARNING! Your password will be stored unencrypted in %s.
Please configure a credential helper (see
https://docs.docker.com/engine/reference/commandline/login/#credentials-store)
to avoid this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Better without the "please"


Docker before v17.10 stored user credentials in `~/.docker/config.json`
unencrypted by default. As of v17.10 it prints a warning with a link to the
credentials helper page and asks users if they want to continue. Eventually, we
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd skip the niceties and just, e.g.: "Support for unencrypted password storage will be removed in Docker 18.10."


**Deprecated In Release: v17.10.0**

**Target For Removal In Release: v18.10**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this will be well received. As @cpuguy83 mentioned it, what about CI ? Same for any other situation where there is no secure alternative (pass, ...) and that it is run as a script (no tty)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Warning about it being insecure is good, but I don't think we should actually set a target for removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable questions. I'm not sure what the threat model is here, I guess it must be people concerned about folks outside their organization reading their images off the docker (or other publicly accessible) hub? It seems that anyone who can commit code to the thing in CI can read out these passwords if they're stored in plaintext, so it can't be about internal threats.

If that's the model, perhaps we can do something a-la Google's app-specific passwords (which we could implement before deprecating this)? If it's not, then this is broken and we should in fact remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so after some discussions with @n4ss, it seems that this is exactly what people are doing. So without some reasonable replacement for this, we can't deprecate this bit. So, I'll just drop the second patch from this PR, and leave it with the big warning patch.

@tych0 tych0 force-pushed the deprecate-unencrypted-storage branch from 1d400f7 to 341de19 Compare September 27, 2017 16:59
@codecov-io
Copy link

codecov-io commented Sep 27, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@db11cff). Click here to learn what that means.
The diff coverage is 0%.

@@            Coverage Diff            @@
##             master     #561   +/-   ##
=========================================
  Coverage          ?   49.47%           
=========================================
  Files             ?      208           
  Lines             ?    17159           
  Branches          ?        0           
=========================================
  Hits              ?     8490           
  Misses            ?     8237           
  Partials          ?      432

@tych0 tych0 force-pushed the deprecate-unencrypted-storage branch 2 times, most recently from d71c206 to bbcc7cf Compare September 27, 2017 18:44
Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯
I'll rebase/fix conflict 👼

Signed-off-by: Tycho Andersen <tycho@docker.com>
@vdemeester vdemeester force-pushed the deprecate-unencrypted-storage branch from da265c3 to 4290df3 Compare March 26, 2018 14:18
@thaJeztah
Copy link
Member

@gbarr01 wondering if we should have special URLs that we can use when referring to the docs from the command-line. I know some URLs may move, and can become outdated; should we have (e.g.) docs URLs that redirect to where we want them? like https://docs.docker.com/help/credentials-helpers (and have it redirect to https://docs.docker.com/engine/reference/commandline/login/#credentials-store)?

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gbarr01
Copy link

gbarr01 commented Mar 26, 2018

@thaJeztah, sure thing. To confirm, the benefit here that the developer can always use the same base URL (https://docs.docker.com/help/) even if we are pointing credentials-helper to credentials-store.

@thaJeztah
Copy link
Member

@gbarr01 almost, yes; we could use /help/<some topic> (in this case “credential-helpers”) and have those redirect

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can have a look at better URLs later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.