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

Safer way to handle unlock command of cli_wallet #1171 #1382

Merged
merged 1 commit into from
Jun 18, 2019

Conversation

cogutvalera
Copy link
Member

@cogutvalera cogutvalera commented Oct 16, 2018

@cogutvalera
Copy link
Member Author

this PR troglobit/editline#21 was merged already.

Guys check please other 2 PRs when you will have time for it:

  1. current Safer way to handle unlock command of cli_wallet #1171 #1382
  2. Safer way to handle unlock command of cli_wallet #1171 bitshares-fc#82

Thanks !

@cogutvalera cogutvalera force-pushed the issue_1171 branch 3 times, most recently from 1263fc9 to 88029da Compare October 25, 2018 08:14
@cogutvalera
Copy link
Member Author

cogutvalera commented Oct 25, 2018

fixed conflicts with latest develop branch and rebased

@cogutvalera
Copy link
Member Author

will bump FC now after merged PR bitshares/bitshares-fc#82

@cogutvalera
Copy link
Member Author

need to be rebased after merging PR #1405

@cogutvalera
Copy link
Member Author

rebased already

@@ -72,6 +72,9 @@ int main( int argc, char** argv )
{
try {

const char* regex_secret_name = "regex-secret";
const string regex_secret = "^(unlock|set_password)\\s.*";
Copy link
Contributor

Choose a reason for hiding this comment

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

Must allow \s* at the start of the line.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done ! Thanks !

@cogutvalera
Copy link
Member Author

Ok no problems ! Thanks !

@pmconrad
Copy link
Contributor

Seems to work as designed

BUT

this solution is unusable IMO. Once the line matches the regexp there is no visual feedback - no cursor movement, no placeholder for keys pressed etc..

@cogutvalera
Copy link
Member Author

I wanted to add placeholder '*' but made without it for security reasons for example as git works in command line with passwords

@pmconrad
Copy link
Contributor

I'm aware of two ways to enter passwords (well, three if you count cleartext):

  • a separate prompt for only the password, with no visual feedback
  • visual feedback where password characters are replaced with asterisk or bullet points

I've never seen a normal editable command line that suddenly stops all visual feedback while still accepting (and expecting) input. A normal user will think the client is frozen, and will try to kill it, and then complain here.

@cogutvalera
Copy link
Member Author

cogutvalera commented Oct 31, 2018

ok ! I will improve it !

visual feedback where password characters are replaced with asterisk or bullet points

or whitespaces also possible (just cursor feedback) ? Right ?

@cogutvalera
Copy link
Member Author

I've added new PR in editline project troglobit/editline#22 for visual feedback while typing secret information

@pmconrad
Copy link
Contributor

pmconrad commented Nov 1, 2018

or whitespaces also possible (just cursor feedback) ? Right ?

I think something other would be preferrable. Try to imagine how you as an unsuspecting user would react when observing that behaviour for the first time. I bet you'd find it confusing.

@cogutvalera
Copy link
Member Author

@pmconrad I mean cursor movement

Seems to work as designed

BUT

this solution is unusable IMO. Once the line matches the regexp there is no visual feedback - no cursor movement, no placeholder for keys pressed etc..

As you told cursor movement is already done in new PR for editline here troglobit/editline#22

@cogutvalera
Copy link
Member Author

cogutvalera commented Nov 2, 2018

@pmconrad did you have a chance to check locally how works my new PR in editline with visual feedback by cursor as you told earlier to me ? Or didn't you have time to check it ? If yes, then later when having time to check it tell me please if it is good enough or not ?

Thanks !

JFYI @troglobit commented here troglobit/editline#22 (comment) in my new PR with visual feedback by cursor. I'm thinking what should I answer to him cause my answer depends on your review. Thanks for your time and efforts !

@cogutvalera
Copy link
Member Author

rebased due to conflicts

@cogutvalera
Copy link
Member Author

Guys what should we do with this PR ? Look please when you will have time + new PR in FC library

bitshares/bitshares-fc#97

@troglobit
Copy link

@cogutvalera I'm still open to a PR that adds visual feedback when in el_no_echo=1 mode. E.g., an el_no_echo_indicator="*" or similar would be useful.

@pmconrad
Copy link
Contributor

You can remove the change in CMakeLists.txt - the dependency is inherited from fc.

I don't think it makes much sense to have a command line option for the regex. Better remove it.

@cogutvalera
Copy link
Member Author

You can remove the change in CMakeLists.txt - the dependency is inherited from fc.

I don't think it makes much sense to have a command line option for the regex. Better remove it.

About command line option for the regex I did it before you told earlier that it can be more flexible if there will be possibility to configure it for any desired data like brain key for example (look here your comment #1171 (comment)). I see next 3 possible ways for configuring this mechanism:

  1. Configure by command line argument
  2. Configure by config file
  3. Configure by both: command line arg & config file

Which one do you prefer @pmconrad ? Guys what do you think too ? What is the best way ?

@pmconrad
Copy link
Contributor

pmconrad commented Jun 2, 2019

What I meant with "configurable by the calling application" is that fc::rpc::cli shouldn't have this hardcoded, but that the application that uses fc::rpc::cli should define the regex. I didn't mean "configurable by the user".

IMO neither cli option nor config file option make sense. Definition via static const in main.cpp is sufficient.

@pmconrad
Copy link
Contributor

pmconrad commented Jun 5, 2019

Merged bitshares/bitshares-fc#97 . Please rebase on latest develop and bump fc to latest master.

@abitmore abitmore added this to the 3.2.0 - Feature Release milestone Jun 6, 2019
programs/cli_wallet/main.cpp Outdated Show resolved Hide resolved
programs/cli_wallet/main.cpp Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@pmconrad
Copy link
Contributor

Please squash your changes, we don't need 5 commits in the history for a one-liner.

@cogutvalera
Copy link
Member Author

Please squash your changes, we don't need 5 commits in the history for a one-liner.

ok sure, not a problem at all !

@cogutvalera cogutvalera force-pushed the issue_1171 branch 2 times, most recently from 12af65f to 6aad78b Compare June 17, 2019 14:43
Copy link
Member

@abitmore abitmore left a comment

Choose a reason for hiding this comment

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

Thanks.

@abitmore abitmore merged commit 9cf1006 into bitshares:develop Jun 18, 2019
@cogutvalera
Copy link
Member Author

Nice that it is already merged ! Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants