Closed
Bug 1042112
Opened 11 years ago
Closed 11 years ago
[b2ghaystack] add ability to read arguments from file
Categories
(Testing :: General, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: huseby, Assigned: sagarinocean, Mentored)
Details
(Whiteboard: [lang=py][good first bug])
Attachments
(1 file, 2 obsolete files)
currently, b2ghaystack requires you to type your password as a command line parameter. this is bad because your password goes into command history files. a more secure option is to put your password in a file that only you have read access to and then tell b2ghaystack to use the password in the file.
Comment 1•11 years ago
|
||
Julien: Is this something you might be interested in working on?
Mentor: dave.hunt
Flags: needinfo?(j.parkouss)
Whiteboard: [lang=py][good first bug]
| Reporter | ||
Comment 2•11 years ago
|
||
I thought about this more. I'd prefer if we added support for a config file. The b2ghaystack script should first search the user's home directory, then the /etc directory for a config file that contains the username and passphrase. The command line switches for username and passphrase should override the config values. And, I want a command line switch for specifying a passphrase file.
0. Use command line username and passphrase switches.
1. If #0 doesn't exist, search for: $HOME/.b2ghaystack
2. If #1 doesn't exist, then search for: /etc/b2ghaystack.conf
3. Output error that username and passphrase must be specified.
Comment 3•11 years ago
|
||
Assigning sagar as requested ... sagar: you can post questions to the bug mentor in here now
Assignee: nobody → sagarinocean
| Assignee | ||
Comment 4•11 years ago
|
||
Thank You Mark.Dave: How do you suggest I should get started with this ?
Comment 5•11 years ago
|
||
b2ghaystack uses argparse. It looks like this has a feature that can read arguments from a file, but is disabled by default. We could enable this and even add the file to the list of arguments if it exists.
To work on this you would need to fork and clone the github repository at https://github.com/mozilla/b2ghaystack and the changes would likely go at the very start of the `cli` function: https://github.com/mozilla/b2ghaystack/blob/38eeb3b4200f660a9bbffd9cb5c5075e38627120/b2ghaystack/b2ghaystack.py#L131
Here's the argparse feature that allows reading arguments from file:
https://docs.python.org/2/library/argparse.html#fromfile-prefix-chars
Here's an example of automatically using a file if it exists: http://stackoverflow.com/a/7789081/154975
Dave: Would this meet your needs?
Flags: needinfo?(j.parkouss) → needinfo?(dhuseby)
Summary: [b2ghaystack] add ability to take a password file → [b2ghaystack] add ability to read arguments from file
Comment 6•11 years ago
|
||
Hi Dave,
Sorry for the delay, I was in holidays this week. :)
Apparently this bug is now assigned. Thank you for the proposal, I will take another one next time!
Flags: needinfo?(dhuseby)
| Assignee | ||
Comment 7•11 years ago
|
||
Dave : Okay. I will get on it right away.
| Assignee | ||
Comment 8•11 years ago
|
||
Dave : I have pushed the new edited code in my forked repo . What next ?
Comment 9•11 years ago
|
||
Hi sagar,
I think you can create a pull request and add an attachment to this bug as described here: http://globau.wordpress.com/2013/10/21/github-pull-requests-and-bugzilla/.
Don't forget to add Dave on the review field, with the "?" selected.
Dave will then review your patches then merge the code.
Hope this helps!
| Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8462956 -
Flags: review?(dave.hunt)
| Assignee | ||
Comment 11•11 years ago
|
||
Thanks a lot Julien . It was of great help .
Comment 12•11 years ago
|
||
Comment on attachment 8462956 [details] [review]
Enable b2ghaystack to take password argument from file
A good start, however the file can support more than just the password, so we should make that clear in the code. I included a couple of comments about code style, where we usually adhere to PEP 8. You might want to run your code through a pep8 checker before submitting your next patch.
Unfortunately b2ghaystack currently requires access to our private builds, so it's difficult for you to test your changes. You should at least be able to run it until the authentication error though, which will allow you to test influencing the arguments by using a configuration file.
Attachment #8462956 -
Flags: review?(dave.hunt) → review-
| Assignee | ||
Comment 13•11 years ago
|
||
Thanks a lot Dave . I am on it.
| Assignee | ||
Comment 14•11 years ago
|
||
Attachment #8462956 -
Attachment is obsolete: true
Attachment #8463344 -
Flags: review?(dave.hunt)
Comment 15•11 years ago
|
||
Comment on attachment 8463344 [details] [review]
Applied review suggestions .
Check pull request for comments. Also, could you add a note to the README about the b2ghaystack.conf file?
Attachment #8463344 -
Flags: review?(dave.hunt) → review-
| Assignee | ||
Comment 16•11 years ago
|
||
Yes, Sure . I am on it .
| Assignee | ||
Comment 17•11 years ago
|
||
Hopefully it will work just fine .
Attachment #8464854 -
Flags: review?(dave.hunt)
Comment 18•11 years ago
|
||
Comment on attachment 8463344 [details] [review]
Applied review suggestions .
Don't forget to mark previous patches as obsolete, however if you're using the same github pull there's no need to attach a new patch. You can just flip the review flag from - to ?
Attachment #8463344 -
Attachment is obsolete: true
Updated•11 years ago
|
Attachment #8464854 -
Flags: review?(dave.hunt) → review-
| Assignee | ||
Comment 19•11 years ago
|
||
Right Dave . I will definitely keep this in mind in future instances .
| Assignee | ||
Updated•11 years ago
|
Attachment #8464854 -
Flags: review- → review?(dave.hunt)
Updated•11 years ago
|
Attachment #8464854 -
Flags: review?(dave.hunt) → review-
| Assignee | ||
Updated•11 years ago
|
Attachment #8464854 -
Flags: review- → review?(dave.hunt)
Comment 20•11 years ago
|
||
Comment on attachment 8464854 [details] [review]
Applied Second Review
This looks okay to me. Dave: could you confirm this works for you?
Attachment #8464854 -
Flags: review?(dave.hunt) → review+
Flags: needinfo?(dhuseby)
| Assignee | ||
Comment 21•11 years ago
|
||
Any instructions for me Dave ?
Comment 22•11 years ago
|
||
(In reply to Sagar Pandey from comment #21)
> Any instructions for me Dave ?
I'm just waiting on the reporter of this bug to confirm this addresses their request. Once this is confirmed I will go ahead and merge your patch. For now there's nothing for you to do. Thanks.
| Assignee | ||
Comment 23•11 years ago
|
||
Alright , Thanks :)
| Reporter | ||
Comment 24•11 years ago
|
||
I'm neck deep in some high priority privacy stuff and unable to test this out.
Flags: needinfo?(huseby)
Comment 25•11 years ago
|
||
Closing this as incomplete. The patch is fine, but I don't believe this tool is being used anymore.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
| Assignee | ||
Comment 26•11 years ago
|
||
So , Is it now confirmed ? Working fine right ?
Comment 27•11 years ago
|
||
(In reply to Sagar Pandey from comment #26)
> So , Is it now confirmed ? Working fine right ?
The patch was fine Sagar, however the feature is no longer needed as the application is not being used. Thank you for your contribution, and I hope that you can find another bug to work on.
You need to log in
before you can comment on or make changes to this bug.
Description
•