Skip to content
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

Ignore keys with invalid names in keystore #4681

Closed
matrushka opened this issue Feb 11, 2018 · 2 comments
Closed

Ignore keys with invalid names in keystore #4681

matrushka opened this issue Feb 11, 2018 · 2 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@matrushka
Copy link
Contributor

Version information:

go-ipfs version: 0.4.13-cc01b7f
Repo version: 6
System version: amd64/darwin
Golang version: go1.9.2

Type:

Enhancement

Description:

Right now dotfiles under the keystore directory causes an error while running ipfs key list. Although having a dotfile (or any file with an invalid name) shouldn't cause the whole thing to fail. It should print out a warning about the problem. When it comes to why I need this feature is:

Motivations:
  • I want to deploy an IPFS node with a specific key inside it by using Kubernetes
  • I want to use secret feature of Kubernetes to deploy the key to nodes I want to spin up (http://kubernetes.io/docs/concepts/configuration/secret/)
  • I can deploy the key succesfully but kubernetes uses some dotfiles to deploy secret files which breaks all the key related functions.
  • So this issue can be solved via either patching Kubernetes or go-ipfs but I thought the go-ipfs behaviour should be more forgiving and informative, since it's preventing access to valid keys and not informing the user about exactly why.
How the feature should work:
  • While renaming or generating a key the proper error message is displayed so it's all good ✅
  • If you have a key with an invalid name inside the keystore directory and list is being called it should return all the valid keys and log or display warnings about the invalid ones.
@matrushka matrushka changed the title dotfiles in keystore Ignore keys with invalid names in keystore Feb 11, 2018
@Stebalien
Copy link
Member

Ignoring hidden files sounds reasonable.

Want to take a crack at this? It should be fairly straight forward. You'll have to edit keystore/keystore.go and make two changes:

  1. Has should call the validateName function before checking if we have the file (so Has(".specialFile") doesn't indicate that we have a key named .specialFile.
  2. List should filter the returned list of file names by validateName (and log bad files).

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Feb 14, 2018
@matrushka
Copy link
Contributor Author

@Stebalien sure I'll try to have a look.

matrushka added a commit to matrushka/go-ipfs that referenced this issue Feb 14, 2018
…ectory to address ipfs#4681

* Has calls the validateName function before checking if we have the file
* List filters the returned list of file names by validateName.

License: MIT
Signed-off-by: Baris Gumustas <[email protected]>
matrushka added a commit to matrushka/go-ipfs that referenced this issue Feb 14, 2018
…ectory to address ipfs#4681

* Has calls the validateName function before checking if we have the file
* List filters the returned list of file names by validateName.

License: MIT
Signed-off-by: matrushka <[email protected]>
@magik6k magik6k closed this as completed May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants