An open API service indexing awesome lists of open source software.

https://github.com/funnyhcat-dotcom/json-sample-redactor

Redact secrets and personal data from JSON before sharing examples.
https://github.com/funnyhcat-dotcom/json-sample-redactor

cli developer-tools json nodejs pii privacy redaction secrets security

Last synced: 3 days ago
JSON representation

Redact secrets and personal data from JSON before sharing examples.

Awesome Lists containing this project

README

          

# json-sample-redactor

Redact secrets and personal data from JSON before sharing examples.

Use it before pasting API responses, logs, webhook payloads, bug reports, or docs examples into GitHub issues, Slack, tickets, or public READMEs.

## Quick start

```bash
npx json-sample-redactor response.json
```

```bash
# stdin works too
cat response.json | npx json-sample-redactor --format report

# compact output for scripts
npx json-sample-redactor response.json --format compact > safe-response.json

# add your own sensitive key pattern
npx json-sample-redactor response.json --key tenant --key organization
```

## What gets redacted

- Sensitive keys like `password`, `token`, `secret`, `apiKey`, `authorization`, `cookie`, `session`
- Personal data keys like `email`, `phone`, `address`, `ssn`, `creditCard`
- Sensitive values inside strings: emails, JWTs, GitHub tokens, AWS access keys, bearer tokens, phone-like numbers, card-like numbers

## CLI

```text
json-sample-redactor [file] [options]
json-redact [file] [options]
```

Options:

- `--format pretty|compact|report`
- `--jsonl`
- `--key ` for custom key regexes
- `--keep-shape` for harmless example-looking replacements
- `-o, --output `

## Example

Input:

```json
{
"email": "ada@example.com",
"apiKey": "ghp_abcdefghijklmnopqrstuvwxyz123456",
"message": "Contact ada@example.com"
}
```

Output:

```json
{
"email": "[REDACTED]",
"apiKey": "[REDACTED]",
"message": "Contact [REDACTED_EMAIL]"
}
```

## License

MIT