-
-
Notifications
You must be signed in to change notification settings - Fork 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
core/commands/config: do not show private key on local network #2957
Conversation
@@ -58,6 +58,14 @@ Set the value of the 'datastore.path' key: | |||
args := req.Arguments() | |||
key := args[0] | |||
|
|||
// This is a temporary fix until we move the private key out of the config file | |||
switch key { | |||
case "Identity", "Identity.PrivKey": |
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.
- may be lowercased.
- can just deny all of identity
if strings.HasPrefix(strings.ToLower(key), "identity") {
- addressed
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.
@jbenet you cant look it up by the lowercase key, but we can add that to the permissions check.
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.
ipfs config Identity.PeerID
is a valid usecase.
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
and replacing config. License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
@lgierth if you could review and give a LGTM here that would be great |
err := r.SetConfigKey(key, value) | ||
keyF, err := getConfig(r, "Identity.PrivKey") | ||
if err != nil { | ||
return nil, fmt.Errorf("Failed to get PrivKey") |
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.
Lower case failed
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT Signed-off-by: Jeromy <[email protected]>
License: MIT Signed-off-by: Jeromy <[email protected]>
return | ||
} | ||
|
||
delete(idmap, "PrivKey") |
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 wont work if the map has
privkey
. this should be case insensitive. - i know this comes from our own structs, so it should be capitalized.
- but all someone has to do is change the capitalization to
Privkey
there. - come to think of it, this should be either:
- a constant there, in that file where the struct is
- or derived from the struct using reflection, to be very damn sure that doesn't get changed around these checks.
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 can also loop the map, compare keys to privkey
case insensitive and remove that. SGTY?
cc @lgierth @whyrusleeping @jbenet