CVS edit link for jchin1968

I have create a one-time password (OTP) module that I would like to contribute to the Drupal community. OTP provides an additional layer of security to the user login process by requiring users to enter a randomly generated one-time password in addition to their regular password. The use of OTP will make it more difficult for malicious users to gain access to a system with stolen user ids and passwords.

My motivation for creating OTP arose because of an application I developed (using Drupal as the framework) for a client. The admin users of this application had access to sensitive data (ie. credit card numbers, client personal information) but they would also have very weak passwords. I needed a way to make sure the accounts of these admin users were as secure as possible. Implementing the password_strength module is one way to make sure users chose good passwords. However, that by itself is not enough since users will often write-down their password on a piece of paper and stick it on their monitor. Hence, OTP was developed.

Comments

jchin1968’s picture

StatusFileSize
new10.24 KB
jchin1968’s picture

Status: Postponed (maintainer needs more info) » Needs review
avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.

What are the differences between the proposed module, and http://drupal.org/project/yubikey?

jchin1968’s picture

Hello. The Yubikey is a separate hardware device that must be purchased and carried around. With my module, the one-time password is emailed or SMS'ed to a users mobile phone which is something many, if not most, people already have and carry around wherever they go.

Additionally, it is possible to implement and use one-time passwords, using my OTP module, at almost no cost by using SMTP (ie. email) to send the OTP. The only cost that would be incurred is on the user's mobile phone data plan when retrieving the OTP email.

avpaderno’s picture

Status: Needs work » Needs review

Thank you for your reply.

jchin1968’s picture

StatusFileSize
new10.23 KB

Hello. I'm attaching a new archive file as I just realized the old file contained a commented line that should have been uncommented. This error prevented the OTP from being emailed to the user. It's fixed now. Sorry for any confusion this may have caused.

itangalo’s picture

I have a small debt to repay for getting a CVS account quickly (http://drupal.org/node/904138), so I'm trying to help real coders in reviewing applications more efficiently.
The following comments are *not* ground for approving or declining an application.

The Coder module gives some warnings concerning formatting and coding standards, mostly concerning tabs and spaces but also a few true/false that should be TRUE/FALSE. It also says "@file block missing" for otp_settings.inc and otp.install.

I do not dare code review something that has to do with passwords and login, but I'd recommend that you install Coder and get rid of the code standard warnings. Cheers!

jchin1968’s picture

Hi Itangalo,

Thanks for the advice. I'll go through each warning/error and send an updated file shortly.

Cheers.

avpaderno’s picture

Status: Needs review » Needs work

I am changing the status as per Itangalo's comment.

jchin1968’s picture

Status: Needs work » Needs review
StatusFileSize
new10.18 KB

Here's a new archive file with errors/warnings from Coder corrected. Please review. Thanks.

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order of importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. version = "6.x-1.0"
    core = "6.x"
    project = "otp"
    

    Those lines need to be removed.

  2.   variable_set('otp_length', 8);
      variable_set('otp_expiry', 10);
      variable_set('otp_port', 465);
    
    

    Drupal variables are not initialized in hook_install().

  3. Menu descriptions and titles, as well as schema descriptions, should not be passed to t().
  4.   // Remove all otp variables
      $results =  db_query("SELECT name FROM {variable} WHERE name LIKE 'otp_%'");
      while ($row = db_fetch_object($results)) {
        variable_del($row->name);
      }
    
    

    Deleting Drupal variables using a query that matches any Drupal variable with a name that starts with the module name would remove also the Drupal variables of other modules (there could be a otp_menu.module module, for example).

  5. /**
     * Implementation of hook_perm().
     * Create permission for administering OTP settings.
     */  
    function otp_perm() {
      $perms = array(
        'otp settings',
      );
      return $perms;   
    }
    
    

    The permissions follow the schema <verb> <object> where the verb is written in lowercase.

    Hook implementation comments should be like the following one:

    /**
     * Implements hook_menu().
     */
    

    As reported in Documenting hook implementations:

    If the implementation of a hook is rather standard and does not require more explanation than the hook reference provides, a shorthand documentation form may be used in place of the full function documentation block described above:

    /**
     * Implements hook_help().
     */
    function blog_help($section) {
      // ...
    }
    

    This generates a link to the hook reference, reminds the developer that this is a hook implementation, and avoids having to document parameters and return values that are the same for every implementation of the hook. Optionally, you can add more information in a separate paragraph to describe the particular quirks of your hook implementation.

    In the case of hooks that have variables in the names, such as hook_form_FORM_ID_alter(), a slightly expanded syntax should be used:

    /**
     * Implements hook_form_FORM_ID_alter() for node_type_form().
     */
    function mymodule_form_node_type_form_alter(&$form, &$form_state) {
      // ...
    }
    

    This generates a link to the hook reference, as well as to the particular form that is being altered. Again, optionally you can add more information in a separate paragraph to describe the particular quirks of your hook implementation.

  6.   if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
        $valid_email = TRUE;
      }
    
    

    That function is considered deprecated, from PHP 5.3. Is there any reason the code is not using the PCRE functions?

  7. The JavaScript code should use Drupal behaviors.
jchin1968’s picture

Status: Needs work » Needs review
StatusFileSize
new10.19 KB

Hi kiamlaluno. Thanks for the feedback. Sorry, it took me a while to get back to you. I had some other commitments and then ran into all kinds of trouble with getting AHAH working on the user profile edit form. I never did resolve my issue, which was to change a textfield title and description based on the "OTP Send Method" radio buttons. The application still works albeit not as elegantly as I would have liked. I'll try to have it fixed in another release. A couple of people have inquired the status of this module so I thought I'd get it out as quickly as possible.

drupalshrek’s picture

As far as I can see it's looking good. Very good README.txt too!

jchin1968’s picture

Hi drupalshrek. Thanks for the positive comment.

kiamlaluno - I realize you must be very busy but do you have an estimate for when you will be able to complete the review and approve the module? Thanks.

zumph’s picture

I like this module very much. What I am looking for now is to add a field to the create account form that asks for a phone number. Then i want the $user->otpSendAddress variable to use that number to send the password to the user by default. Can anyone give pointers on how to do this?

randomuser’s picture

Component: new project application » Miscellaneous

Glad to see someone working on this module, looking good so far.

jchin1968’s picture

Hi kiamlaluno. Can this module be approved yet? What fixes if any do I need to make? Thanks.

jcisio’s picture

Component: Miscellaneous » miscellaneous
Status: Needs review » Needs work

Just a few small issues:
- Drupal has its own valid_email_address() function
- You use PHPmailer library without having mention that anywhere. Include a minimal version (if it is GPLed) or instruct user to put it in a libraries folder
- Don't use a global variable just so save a path
- Use hook_init() to include a .css file (or I think you only need it on hook_form_alter())
- Avoid $_SERVER['DOCUMENT_ROOT']

About the module logic, it looks good after a quick verification.

avpaderno’s picture

Component: miscellaneous » new project application

Libraries available from third-party sites should not be committed in Drupal.org, even if they are licensed under GPL License.

jchin1968’s picture

Status: Needs work » Needs review
StatusFileSize
new10.17 KB

Thanks for the comments jcisio.

I decided to use phpmailer rather than the default Drupal mail function to make it easier for users to implement. OTPs are sent using SSL encryption but not all web host providers offers an SSL enabled SMTP server. By including phpmailer in the otp module, a user can configure the mail settings within the Drupal website and use any SSL mail server they want.

PHPmailer is mentioned in the pre-requisite and installation sections of the README.txt file. And as kiamlaluno wrote in post #19, external libraries are not supposed to be included with the module.

I got rid of the global variable $_otp_path

You're right. otp.css is only referenced once in otp_login_form() so that's where I moved the drupal_add_css statement to. Now, otp.css is only loaded when the login form appears.

The cURL option "CURLOPT_CAINFO" requires a full pathname which is why I used $_SERVER['DOCUMENT_ROOT']. Should I use getcwd instead?

@randomuser (post #16) - I'm looking into using the SMS Framework module which will make it easier to add new gateways. Thanks for the suggestion.

avpaderno’s picture

Component: Miscellaneous » new project application
Status: Needs review » Postponed

Please read all the following and the links provided as this is very important information about your CVS Application.

Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:Migrating from CVS Applications to (Git) Full Project Applications.

  • If your application has been "needs work" (or "postponed (maintainer needs more info)"), your application will be marked as "closed (won't fix)". You can still reopen it, by reading the instructions above.
  • if the status of this application is a different one, it will be changed to "postponed"; you will be able to reopen it by following the instructions in the above link.
prakashsingh’s picture

Issue summary: View changes

@jchin1968.. has this module been finalized.. or can you give a new link to GIT

avpaderno’s picture

Status: Postponed » Closed (won't fix)

As per my previous comment, I am setting this issue as Won't fix.
Since new users can now create full projects, applications have a different purpose and they are handled on a different issue queue. See Apply for permission to opt into security advisory coverage for more information.