Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CLI script for scrubbing email addresses etc from export files #69

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

tellyworth
Copy link
Contributor

We could periodically use this on the server side to generate sample export files.

I used DomDocument rather than regexes to better deal with large files and unexpected whitespace etc.

@tellyworth tellyworth requested review from dd32 and iandunn June 3, 2022 01:50
@tellyworth
Copy link
Contributor Author

@iandunn mentioned the idea of taking an allowlist approach to scrubbing, rather than scrubbing selected elements like I've done here. That's a good idea for future, especially if we were to reuse this for other sites. That was my other reason for using DomDocument - we could traverse every node and scrub everything that's not explicitly allowed.

If you think this is ok as a starting point let's merge it and add some handbook imports.


fwrite( $fp_out, $doc->saveXML() );

fclose( $fp_out );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fclose( $fp_out );
fclose( $fp_out );
readline( "\nMake sure you manually review the diff before committing this to the repository! This script might have missed some PII. \n" );

@iandunn
Copy link
Member

iandunn commented Jun 3, 2022

Here's an example of a safelist approach, for future reference:

https://github.com/iandunn/regolith/blob/824b999c11fae10c4777b8f517df63c6e6fd0a0d/bin/sync-production-content.sh#L91-L164

It works on a SQL dump rather than WRX, but has safelists of various data that might be useful.

@tellyworth
Copy link
Contributor Author

This is probably not needed now but worth keeping for future use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants