This module allows the owner of a Drupal site to add Authy authentication to any form on the site, not only to login.
It uses the Libraries module, and the authy-php API, interacting to existing Drupal forms trough the Drupal Form API.
Sandbox page: https://drupal.org/sandbox/xqus/1722568
Git tree: http://drupalcode.org/sandbox/xqus/1722568.git/tree/refs/heads/7.x-1.x
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/xqus/1722568.git authy
cd authyReviews of other projects
Used for review bonus:
https://drupal.org/comment/8296707#comment-8296707
https://drupal.org/comment/8296717#comment-8296717
https://drupal.org/comment/8296741#comment-8296741
https://drupal.org/comment/8297075#comment-8297075
https://drupal.org/comment/8297297#comment-8297297
https://drupal.org/comment/8309303#comment-8309303
Not used:
https://drupal.org/comment/8310853#comment-8310853
https://drupal.org/comment/8306377#comment-8306377
https://drupal.org/comment/8313591#comment-8313591
https://drupal.org/comment/8313623#comment-8313623
https://drupal.org/comment/8313643#comment-8313643
Comments
Comment #1
andystone78 commentedThank you for your contribution,
I have noticed a few issues:
hook_install, hook_uninstall, hook_schema should all be in an authy.install file.
In your authy_uninstall() you should remove any variables created by the module, eg: authy_forms, authy_api_key & authy_host_uri.
Do you really need empty hooks such as hook_init, hook_install? these will be called unnecessarily.
Good luck with your module.
Comment #2
tallosoft commentedGood morning xqus!
I have run PARVIEW, as I noticed you did as well, and it is clean, which is a great start.
In addition to andystone78's review, I would recommend a little more focus on your projects description. Right now, it lists only one sentence, and doesn't provide a lot of information for someone not familiar with authy, or explain why someone might want to use the module.
Regards!
Comment #3
tallosoft commentedComment #4
xqus commentedHi,
Thank you for your feedback, @andystone78 and @tallosoft.
I've removed the empty hooks, moved uninstall and schema to authy.install and updated the uninstall function so it removes any variables set by the module.
I've also updated the module.info file, and the project page with some more information.
Comment #5
xqus commentedComment #6
xqus commentedAdds Git clone command.
Comment #7
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxxqus1722568git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #8
xqus commentedFixed all issues pointed out by the test at pareview.sh.
Comment #9
joachim commented> depackage = Security
Typo?
> * Defines the database schema for the module.
* This is used when installing and uninstalling the module.
You can omit this; it's in the docs for the hook.
> * @copyright Copyright (c) Audun Larsen, 2012, 2013
Check guidelines on including authorship in modules. I don't know if there's anything official, but one opinion that's been discussed a lot is that it dissuades other people from contributing code. It also means that should you ever move on and hand the project to someone else, the first thing they have to do is rip out your name, which feels awkward :/
> return user_edit_access($account) && (user_access('administer own authy id') || user_access('administer authy ids'));
Reuse of API functions is good, but I'm concerned that here it makes the logic quite convoluted. I'm still not sure how the 'administer own authy id' permission works. Given that access control is a key part of security, I would opt for repetition and verbosity over reuse. I'd also split the expression into smaller pieces and comment them -- see the coding standards on splitting up expressions.
??
> function authy_settings($form, &$form_state) {
> function authy_manage($form, &$form_state, $uid) {
> function authy_verify($form, &$form_state) {
This is nitpicky, but it's customary to have a '_form' suffix on form builders. It does make it easier when reading through code to see what a function is for.
Also, this could do to be in an admin.inc file.
... also returns FALSE if nothing found.
hook_form_alter() shouldn't return anything.
authy_verify_submit and authy_verify_validate are the wrong way round.
> function authy_verify_submit($form, $form_state) {
> function authy_verify_validate($form, $form_state) {
$form_state should be &$form_state in both of these.
> drupal_goto('user');
In a form submit, set $form_state['redirect'].
What's this code doing?
Looks like it's loading a user, but I can't tell which user it might load.
If you're replacing the global $user with something that could potentially be another account, you have a security hole. Remember that $a = $b in PHP is a reference assignment if $b is an object.
> * Post login check to see if user has Authy enabled.
I would say here that's a form validate callback.
> $user = user_load_by_name($form_state['values']['name']);
Don't say $user unless you mean the current user. It's safer to say $account, in case the code should ever get rearranged and end up in the same function as a global $user.
> $form['tan'] = array(
tan?
> Secure your Druapl site with two-factor authentication provided by
> * All users with Authy enabled will be promted for a Authy token on
Typos.
Comment #10
xqus commented@joachim Thank you for your good feedback!
I have created the following issues from the feedback:
#2160855: Typo in authy.info (package)
#2160859: Clean up docblocks
#2160861: Remove authy_user_can_login()
#2160865: Clarify authy_administer_access()
#2160867: Add _form to form functions
#2160869: Update documentation for _authy_get_authy_id()
#2160871: hook_form_alter() shouldn't return anything
#2160873: $form_state not passed by reference
#2160875: authy_verify_submit() does not set $form_state['redirect']
#2160877: Rewrite user loading in authy_verify_validate()
#2160879: authy_login_validate() can log in users without password
#2160881: $form['tan'] does really not make any sense
#2160889: Restructure code
#2160891: Reorder functions
Some of the smaller issues (like typos in readme, and some function documentation) was fixed without creating issues for them.
Comment #11
xqus commentedComment #12
xqus commentedComment #13
xqus commentedAdded reviews of other modules.
Comment #14
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #15
xqus commentedThe errors found by PAReview.sh will be fixed.
1. Fixed.
2. Fixed.
3. #2164765: Rewrite login process
4. #2164761: Clean up inline comments
5. #2164767: do not use drupal_add_css()
6. Fixed.
7. #2164773: Do not use db_select() for simple static queries
8. #2164775: _authy_get_api(): doc block is a bit short
9. #2164777: Explain origin of form.authy.css and form.authy.js
10. #2164781: authy_form_manage_submit(): use db_merge()
11. Fixed.
12. #2164765: Rewrite login process will sort this out. It's just something that lingers around, even if the function has been rewritten many times.
13. I don't see what you mean. authy_form_verify is a menu callback to authy/verify. BUT, authy_verify is added as an validator to any form that requires Authy verification. Is that the one you are thinking about?
14.#2164765: Rewrite login process
Comment #16
xqus commented* Fixed PAReview.sh issues.
* Rewrote the way user logins are handled.
* Removed the authy.form.css / JS and images - Instead I'm loading them directly from Authy servers (as suggested by Authy).
Since I have resolved all the blocking issues identified by klausi and created issues for the rest, I'm setting this back to needs review.
Comment #17
xqus commentedComment #18
xqus commentedComment #19
klausimanual review:
But otherwise looks RTBC to me!
Assigning to cweagans as he might have time to take a final look at this.
Comment #20
xqus commentedThank you clausi!
_authy_get_authy_id() and the use of db_select() will be fixed by #2164773: Do not use db_select() for simple static queries.
Comment #21
klausino objections for more than a week, so ...
Thanks for your contribution, xqus!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.