Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Reading the credentials from a config file doesn't work if SAFE_AUTH_* env vars are unset #39

Closed
bochaco opened this issue Apr 29, 2019 · 1 comment · Fixed by #40
Closed
Labels
bug Something isn't working

Comments

@bochaco
Copy link
Contributor

bochaco commented Apr 29, 2019

The following works with no issues:

$ export SAFE_AUTH_PASSWORD="aaaaaa"
$ export SAFE_AUTH_SECRET="bbbbb"
$ echo "{ \"secret\":\"$SAFE_AUTH_SECRET\", \"password\":\"$SAFE_AUTH_PASSWORD\" }" > myconfig.json
$ cat myconfig.json 
{ "secret":"bbbbb", "password":"aaaaaa" }
$ cargo run --features mock-network -- -c myconfig.json -i nnnnnnn -y
    Finished dev [unoptimized + debuginfo] target(s) in 0.45s
     Running `target/debug/safe_auth -c myconfig.json -i nnnnnnn -y`
Account was created successfully!
$ cargo run --features mock-network -- -c myconfig.json -y
    Finished dev [unoptimized + debuginfo] target(s) in 0.42s
     Running `target/debug/safe_auth -c myconfig.json -y`
Logged in the SAFE Network successfully!

But if the secret and password env vars are unset then the safe_auth throws an error stating that the account couldn't be found:

Warning! Storing your secret/password in plaintext in a config file is not secure.
[2019-04-29T22:41:54Z DEBUG safe_auth] Attempting to log in...
[2019-04-29T22:41:54Z WARN  safe_authenticator::client] Could not fetch account from the Network: CoreError(No such account - CoreError::RoutingClientError -> NoSuchAccount)
[2019-04-29T22:41:54Z ERROR safe_auth] safe_auth error: Failed to log in: CoreError(No such account - CoreError::RoutingClientError -> NoSuchAccount)
@bochaco bochaco added the bug Something isn't working label Apr 29, 2019
@bochaco
Copy link
Contributor Author

bochaco commented Apr 29, 2019

The root cause is that we are not removing the enclosing " from the values read from the json file

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
1 participant