[2.0.0] Masked Output

Created on 20 February 2025, about 2 months ago

Module offers a Field Manage Display option to customize the masking output.

Module gives options for users to set different types of masking
1. Show characters
2. Mask characters

This module deals with masking of such fields when shown in Entity View Mode

Example:
Credit card number : **********2016
SSN : *****1468
Phone : 765345####
Email : ****@gmail.com

Module works with Field type
1) Text(Plain)
2) Email

Masked Output โ†’

๐Ÿ“Œ Task
Status

Needs review

Component

module

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia GGH

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @GGH
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    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, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • 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 and no other user will be able to opt projects into security advisory policy.
    • 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.
    • 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 โ†’ .

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    1. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml masked_output/
    
    FILE: masked_output/masked_output.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
    --------------------------------------------------------------------------------
    
    FILE: masked_output/src/Plugin/Field/FieldFormatter/MaskOutputFormatter.php
    --------------------------------------------------------------------------------
    FOUND 5 ERRORS AND 1 WARNING AFFECTING 4 LINES
    --------------------------------------------------------------------------------
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
      31 | ERROR   | [ ] Class property $field_definition should use lowerCamel naming without underscores
     170 | WARNING | [ ] There must be no blank line following an inline comment
     170 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     170 | ERROR   | [x] Comments may not appear after statements
     183 | ERROR   | [x] Expected newline after closing brace
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    FILE: masked_output/src/Plugin/Field/FieldFormatter/MaskEmailOutputFormatter.php
    --------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
     24 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
     25 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
     26 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
     27 | ERROR | [x] Expected 3 space(s) before asterisk; 1 found
     28 | ERROR | [ ] Class property $field_definition should use lowerCamel naming without underscores
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------

    2. FILE: masked_output.module

    /**
     * @file
     * Contains masked_output.module.
     */

    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.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia GGH

    Fixed all issues reported above and pushed a new release 2.0.2

    Masked Output โ†’

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    These applications do not require that new releases are created after reviews.

    Rest looks fine to me.

    Letโ€™s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain alvarodemendoza

    The following points are just a start and don't necessarily encompass all 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 issues, or does not correctly use the Drupal API; the single points are not ordered, not even by importance

    src/Plugin/Field/FieldFormatter/MaskOutputFormatter.php

     /**
       * The field definition.
       *
       * @var \Drupal\Core\Field\FieldDefinitionInterface
       */
      protected FieldDefinitionInterface $fieldDefinition;

    should be

     /**
       * The field definition.
       *
       * @var \Drupal\Core\Field\FieldDefinitionInterface
       */
      protected $fieldDefinition;

    As this module only affects how field data is displayed I don't see any security implications. Settings are configured per-field in the entity view display settings which is already protected by Drupal core's administer display modes and administer node display permissions.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Starting with PHP 7.4, a property declaration can include a type declaration.
    That property is already defined from the parent class, though. There is no need to redefine it in a child class.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    I will review the project today.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    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 the dedicated reviewers as well.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
Production build 0.71.5 2024