npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

playwright-redactor

v1.0.6

Published

Remove sensitive data from your Playwright trace files

Downloads

6

Readme

playwright-redactor

Coverage Status vitests CodeQL

This is a tool that can be used to redact sensitive information from your Playwright trace files.

Main Logo

🧪 Oddly specific use case

  • You work for an organization that has a strict policy on storing sensitive information at rest and your trace files have been flagged by the security team for containing sensitive information e.g. production credentials
  • You want to share the trace files generated by your tests with strangers on the internet for debugging purposes but you need to redact the sensitive information first
  • You would like to store your traces files using a provider e.g. s3. But you have trust issues and you don't want to store sensitive information in the cloud
  • Scrub PII information

📦 Usage

Ideally, you would invoke this app as part of your CI/CD pipeline as soon as Playwright has finished generating the trace files using the following command.

npx playwright-redactor -c ./config.json -t ./traces -r ./regexes.txt

The command above will redact the sensitive information from the trace files in the ./traces folder using the configuration in the ./config.json file. The regexes used for redaction are defined in the ./regexes.txt file.

Usage

⚙️ Command line options

| Options | | | -------- | -------- | | -r, --regexes <path> | Path to the text file containing the regular expression used for replacement. Each regex separated by a new line | |-c, --config <path> | Path to config file | |-t, --trace-files <path> | Folder path containing the trace files that require scrubbing |

🛠️ Config file

The config file is a JSON file that contains the following properties:

{
  "full_redaction": true,
  "log_level": "debug",
  "environment_variables": [
    "SUPER_SECRET_PASSWORD",
    "SUPER_SECRET_API_KEY",
    "MY_APP_SECRET",
    "SALESFORCE_API_KEY"
  ]
}

The config file above will perform a full redaction whenever a regex is matched using the regexes defined in the array. It will also redact the environment variables listed in the environment_variables array.

| Options | | | -------- | -------- | | full_redaction | REQUIRED: When set to true, a matched regex will be replaced with . When set to false, the app will obscure large parts of the secret. For example: password1234 will be redaced as pa******32 | |environment_variables | OPTIONAL: The value of these environment variables will be redacted from the trace files | |log_level | REQUIRED: Defaults to debug |

🗎 Regex file

This is a text required by the tool via the -r or --regexes command line option.

The regex file will contain a list of regexes that will be used to replace the text in the trace files separated by a newline. The following example will search for super_password followed by 3 digits and replace it with . It will also search for all GUIDs and replace it with . Lastly, it will search for all JWTs and replace it with .

super_[AB]_password\d{3}
^(?:\{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$
^(?:[\w-]*\.[\w-]*\.[\w-]*)$

⚠️ WARNING 🐊 - ACHTUNG !!

In all cases, the redaction of passwords and other sensitive information may not enough to protect your data. You should always be careful when sharing trace files with strangers on the internet. As an extra precaution, try and scrub session information e.g jwt token, cookies etc from your trace files.