Sanitize address fields on drush sql:sanitize

Created on 18 December 2020, over 3 years ago
Updated 4 March 2024, 4 months ago

Problem/Motivation

I'm working on a Commerce site and would like to use drush sql:sanitize to remove PII.

Proposed resolution

I was wondering if people thought it might make sense to sanitize any address fields directly attached to user or profile entities (similar to how sql:sanitize by default randomizes all text fields on a user entity)? I realize this might be considered out of scope for the address module, but by the same token I thought it might be able to catch a whole host of potential PII issues in one fell swoop, so thought I'd throw it out there (:

Remaining tasks

TBD

💬 Support request
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom AndyF

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 9 months ago
    32 pass
  • 🇸🇮Slovenia Primsi

    Updated the version requirement for drush to a more up to date version. Also rebased - I've never done this on a d.o merge request though ... I hope that's ok.

  • Status changed to Fixed 9 months ago
  • 🇷🇸Serbia bojanz

    Merged (and added address_line3 for the 2.0.x commit). Thanks, everyone!

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

  • Status changed to Fixed 7 months ago
  • 🇬🇧United Kingdom the_g_bomb

    Is this supposed to also sanitize addresses that are not related to user details, such as public office addresses?

  • 🇷🇸Serbia bojanz

    Yes, it doesn't (and can't) differentiate.

  • 🇨🇭Switzerland Berdir Switzerland

    You can use the confusingly named allowlist-fields option, which in this case means that the fields are allowed to *not* be sanitized. Note that the setting is shared with other sanitize steps like user fields, so if you have an address field that you don't want to sanitize and a user field of the same name that you *do* want to sanitize you're going to run into a bit of a conflict.

    I think it would be nice if that setting supported something like node.field_address, but that would be a new feature at this point.

  • 🇬🇧United Kingdom the_g_bomb

    I wonder if this could be a setting that could be switched on or off. If you have no user related data, you don't need to sanitise the addresses.

    A stage environment may look strange with all the satellite office snow having redacted addresses on the contact forms.

  • 🇬🇧United Kingdom the_g_bomb

    Also what if US addresses are not valid in the settings, you are replacing all sanitized addresses with a US postcode and country code.

  • Status changed to Needs review 7 months ago
  • 🇷🇸Serbia bojanz

    Let's gather some more feedback.

    This feature has not made it into a release so I would be fine with reverting it if it's controversial.

    • bojanz committed 5abba0c9 on 8.x-1.x
      Revert "Issue #3189074: Handle drush sql:sanitize?"
      
      This reverts commit...
    • bojanz committed 9bc40511 on 2.0.x
      Revert "Issue #3189074: Handle drush sql:sanitize?"
      
      This reverts commit...
  • Status changed to Fixed 7 months ago
  • 🇷🇸Serbia bojanz

    Upon further consideration, I have decided to revert this feature.

    This module has almost 100 000 installs, which calls for some conservatism, so I'd rather err on the side of not having a feature than introducing a feature that goes too far. Especially since the original request called for a smaller scope and could be done in Commerce directly.

    Please create a contrib module with this plugin, and I will happily link to it from the project page.

    Apologies to everyone disappointed by this.

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

  • Status changed to Fixed 4 months ago
  • 🇬🇧United Kingdom c_archer Cumbria

    The latest patch fails against the 2.0.1 version of the module

  • 🇺🇦Ukraine khiminrm

    The fixes were improved to just sanitize address fields in profiles and merged into the new project commerce_sql_sanitize https://www.drupal.org/project/commerce_sql_sanitize/issues/3424078 📌 Merge commands from the Address module patches Fixed

  • 🇺🇸United States hungdo

    Reroll the patch file to make it works with 2.0.1 version.

Production build 0.69.0 2024