Simple AVS is a light weight cookie/ session based Age Verification System. It's meant to allow sites to maintain age restrictions on content. This does not replace systems requirements for legal strict age verification for content. It is a "bare minimum" approach to age verification. It allows for two types of verification- a simple yes/no or the user enters their date of birth. The modal is themeable in the UI and also has a number of presets available. Redirects are configurable for both pass and failure, as well as the age threshold, what pages and how often the modal shows up.

Project link

https://www.drupal.org/project/simpleavs

Comments

platypus media created an issue. See original summary.

platypus media’s picture

Issue summary: View changes
vishal.kadam’s picture

Issue summary: View changes
platypus media’s picture

My apologies if this is an inappropriate question to ask, but how long does this process normally take? Days? Weeks? Longer? This is my first contrib module, so I'm a little overzealous.

rushikesh raval’s picture

Thank you for applying!

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • New releases are not necessary for these applications, which could require changes that are not backward-compatible. Not creating new releases avoids any possible issue.
  • Please do not change the branch to review once reviews started, except in the case the used branch needs to be deleted.
  • If you have not done it yet, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
  • For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application.
  • Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

avpaderno’s picture

Assigned: Unassigned » avpaderno
avpaderno’s picture

Assigned: avpaderno » Unassigned
Status: Needs review » Needs work
  • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
  • A specific point may just be an example and may apply in other places
  • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
  • The single review points are not ordered, not even by importance

src/Controller/AgeGateController.php

Since that class does not use methods from the parent class, it does not need to use ControllerBase as parent class. Controllers do not need to have a parent class; as long as they implement \Drupal\Core\DependencyInjection\ContainerInjectionInterface, they are fine.

src/Form/AgeGateSettingsForm.php

ConfigFormBase::__construct() needs to be called. Since its parameters changed in Drupal 10.2, the project cannot be compatible with all the Drupal 10 releases and Drupal 11; it needs to require at least Drupal 10.2.

With Drupal 10 and Drupal 11, there is no longer need to use #default_value for each form element, when the parent class is ConfigFormBase: It is sufficient to use #config_target, as in the following code.

    $form['image_toolkit'] = [
      '#type' => 'radios',
      '#title' => $this->t('Select an image processing toolkit'),
      '#config_target' => 'system.image:toolkit',
      '#options' => [],
    ];

Using that code, it is no longer needed to save the configuration values in the form submission handler: The parent class will take care of that.

vendor

The vendor directory is never committed in contributed projects.

simpleavs.module

For a new module that aims to be compatible with Drupal 10 and Drupal 11, I would rather implement hooks as class methods as described in Support for object oriented hook implementations using autowired services.
It would require increasing the minimum Drupal 10 version supported, but Drupal 10.1 is no longer supported.

/**
 * @file
 * Bootstrap + page attachments for SimpleAVS.
 */

The @file tag has been added twice. Only one is necessary, and it must be right after <?php.
Furthermore, the usual description is Hook implementations for the [module name] module. where [module name] is the module name reported in the .info.yml file.

/**
 * Lightweight path matcher mirroring your existing scoping rules.
 */

The documentation comments for functions that are not hook implementations include the description of the parameters and the return value.

Some lines are not following the Drupal coding standards. For example, in the following code, the => characters do not need to be vertically aligned.

    $attachments['#attached']['drupalSettings']['simpleavs'] = [
      'enabled'   => TRUE,
      'method'    => $method,
      'min_age'   => $min_age,
      'frequency' => $frequency,
      'paths'     => ['mode' => $path_mode, 'patterns' => $path_patterns],
      'redirects' => ['success' => $redirect_success, 'failure' => $redirect_failure],
      'strings'   => $strings,
      'appearance'=> $appearance,
      'endpoints' => [
        'token'  => Url::fromRoute('simpleavs.token')->setAbsolute()->toString(),
        'verify' => Url::fromRoute('simpleavs.verify')->setAbsolute()->toString(),
      ],

Similarly, in the following lines, the assignment operator does not need to be vertically aligned.

  $enabled   = (bool) ($cfg->get('enabled') ?? FALSE);
  $method    = (string) ($cfg->get('method') ?? 'question');
  $min_age   = (int)   ($cfg->get('min_age') ?? 18);
  $frequency = (string) ($cfg->get('frequency') ?? 'never');
platypus media’s picture

I made the updates requested and pushed the new copy

platypus media’s picture

Status: Needs work » Needs review
vishal.kadam’s picture

Status: Needs review » Needs work

1. dev and deve are wrong names for a branch and should be removed. Release branch names always end with the literal .x as described in Release branches.

2. Fix phpcs issues.

Note: I would suggest enabling GitLab CI for the project, follow the Drupal Association .gitlab-ci.yml template and fix the PHP_CodeSniffer errors/warnings it reports.

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml simpleavs/

FILE: simpleavs/SECURITY.md
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
 2 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
 5 | ERROR   | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: simpleavs/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
 3 | WARNING | Line exceeds 80 characters; contains 87 characters
 4 | WARNING | Line exceeds 80 characters; contains 111 characters
----------------------------------------------------------------------

FILE: simpleavs/src/Form/AgeGateSettingsForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 260 | ERROR | The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
 371 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: simpleavs/src/Controller/AgeGateController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 39 | ERROR | [x] Missing function doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: simpleavs/simpleavs.module
-----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------

FILE: simpleavs/.github/workflows/phpcs.yml
---------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------
 81 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------

FILE: simpleavs/simpleavs.install
--------------------------------------------------------------------------------
FOUND 19 ERRORS AFFECTING 14 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
 17 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 17 | ERROR | [x] Comments may not appear after statements
 18 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 18 | ERROR | [x] Comments may not appear after statements
 19 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 19 | ERROR | [x] Comments may not appear after statements
 24 | ERROR | [x] The first index in a multi-value array must be on a new line
 26 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
 27 | ERROR | [x] The first index in a multi-value array must be on a new line
 28 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
 29 | ERROR | [x] The first index in a multi-value array must be on a new line
 30 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
 31 | ERROR | [x] The first index in a multi-value array must be on a new line
 32 | ERROR | [x] Closing parenthesis of array declaration must be on a new line
 39 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 39 | ERROR | [x] Comments may not appear after statements
 43 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 43 | ERROR | [x] Comments may not appear after statements
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
platypus media’s picture

Status: Needs work » Needs review

Extraneous branches removed and phpcs issues resolved.

vishal.kadam’s picture

Status: Needs review » Needs work

A few points are still pending: one from comment #7 and another from comment #10.

The vendor directory is still present in the codebase, and not all PHPCS errors have been resolved.

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml simpleavs/

FILE: simpleavs/SECURITY.md
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
 2 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
 5 | ERROR   | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: simpleavs/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
 3 | WARNING | Line exceeds 80 characters; contains 87 characters
 4 | WARNING | Line exceeds 80 characters; contains 111 characters
----------------------------------------------------------------------

FILE: simpleavs/src/Form/AgeGateSettingsForm.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 260 | ERROR | The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
 371 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: simpleavs/src/Controller/AgeGateController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 39 | ERROR | [x] Missing function doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: simpleavs/.github/workflows/phpcs.yml
---------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------
 81 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------
platypus media’s picture

Status: Needs work » Needs review

Removed stray vendor/ directory, normalized EOF newlines in SECURITY.md and phpcs.yml. PHPCS runs clean locally with Drupal + DrupalPractice standards.

vishal.kadam’s picture

Rest looks good to me.

Please wait for a Project Moderator to take a look and if everything goes fine, you will get the role.

platypus media’s picture

Awesome. Thank you so much for all the help you've been. Just for clarification, should it be set to "reviewed and tested" status at this point so the moderators know that it's ready for their final review?

vishal.kadam’s picture

Status: Needs review » Reviewed & tested by the community
avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for your contribution and for your patience with the review process!

I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

These are some recommended readings to help you with maintainership:

You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
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.

I thank also all the reviewers for helping with these applications.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

avpaderno’s picture

Assigned: Unassigned » avpaderno

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.