Metadata Sanitizer is a Drupal 10/11 module that automatically removes embedded metadata (such as EXIF, XMP, author, and device information) from uploaded files, including images and PDF documents. It is designed to help organizations meet privacy, compliance, and GDPR requirements by preventing the accidental disclosure of personal or sensitive information stored within file metadata.

Project link

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

Comments

zarabatana created an issue. See original summary.

vishal.kadam’s picture

avpaderno’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.

  • 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.

vishal.kadam’s picture

Status: Needs review » Needs work

1. FILE: src/Commands/MetadataSanitizerCommands.php

  /**
   * Removes metadata from files using exiftool.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   */
  public function __construct(

The documentation comment for constructors is not mandatory anymore, If it is given, the description must be “Constructs a new [class name] object”, where [class name] includes the class namespace.

2. FILE: README.md

The README file is missing the required section - Configuration.

3. FILE: metadata_sanitizer.module

/**
 * @file
 * Custom module to strip metadata from uploaded files using exiftool.
 */

The usual description for a .module file is “Hook implementations for the [module name] module”, where [module name] is the module name given in the .info.yml file.

zarabatana’s picture

Status: Needs work » Needs review

The requested changes have been committed to the 1.0.x branch.
Please let me know if further updates are needed or if this is ready for the next step in the review process.

bbu23’s picture

Status: Needs review » Needs work

Hi! Thanks for applying.

Here's my feedback:

1. Convert Drush commands from PHP Annotations into PHP Attributes: https://www.drush.org/12.x/commands/.

2. There is no dev release.

3. The recommended way of installing contrib modules is using composer. I would modify the README.md file to recommend to "Install as you would normally install a contributed Drupal module." and for more information to link here. I wouldn't recommend unzipping as a first choice.

4. The composer.json could use some corrections/improvements:
- Add license: "license": "GPL-2.0-or-later"
- The PHP requirement currently set to ">=7.4" is redundant. Drupal 10 requires PHP8+, therefore PHP 7 is impossible.
- You could add a "suggest" section for the exiftool external tool.

5. The functional test doesn't really bring any value, it could be improved.

zarabatana’s picture

Status: Needs work » Needs review

All requested changes have been completed:

  • Drush command now uses PHP 8 attributes, with the description separated using #[CLI\Help].
  • The default branch is 1.0.x and a dev release (1.0.x-dev) is available on the project page.
  • README.md has been updated to follow best practices for installation and configuration.
  • composer.json has been improved with license, updated PHP requirement, and a suggest section for exiftool.

Please let me know if anything else is required, or if this is ready for the next review step.

avpaderno’s picture

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/Form/MetadataSanitizerSettingsForm.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.

metadata_sanitizer.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.

zarabatana’s picture

Status: Needs work » Needs review

Thanks for the detailed review.
I’ve updated the settings form to use #config_target instead of #default_value, which also removes the need for manually saving values in the submit handler.
I also removed the redundant constructor override in the form.
In addition, the hook implementations were moved into a service-based class following the object-oriented hooks pattern with autowiring.
These changes should address the issues raised and bring the module in line with current Drupal 10/11 practices.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Reviewed & tested by the community

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.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

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.

Status: Fixed » Closed (fixed)

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