Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
redact-phi
Advanced tools
Assists in the redaction of PHI in structured or semi-structured data, supporting excel (XSLX), CSV or JSON.
A command-line utility to redact and fabricate PHI, PII or protected data (CSV, JSON, XLSX).
Install globally using npm i -g redact-phi
% redact --help
Usage: redact [options] <infile> [outfile]
Arguments:
infile File to redact
outfile Output file, defaults to {input_filename_redacted.csv}
Options:
-V, --version output the version number
--delimiter <delimiter> sets delimiter type (default: ",")
--override <override> Provide the location of your redaction specification
-h, --help display help for command
redact-PHI includes an example (./example/
) :
example.csv
- CSV source file (data to be redacted)example.json
- JSON redaction strategy (defines how columns will be redacted with: faker
, a custom redactor
or a constant
)example.js
- JavaScript custom redactors (this file is optional)The .csv
, .json
and .js
files must all be named the same (e.g. data.csv
, data.json
, data.js
)
example/example.csv
:
id,email,ssn,first name,last name,full address,order date,order amount
783,Nicola42@yahoo.com,706-25-4558,Caroline,Goodwin,82703 Yasmeen Corner Apt. 379,"10/9/2020, 4:48:52 AM",252.94
784,Ned_Bernier13@yahoo.com,282-57-6226,Izabella,Bosco,2930 Alisa Heights Apt. 572,"3/27/2021, 11:51:26 PM",689.40
784,Ned_Bernier13@yahoo.com,282-57-6226,Izabella,Bosco,2930 Alisa Heights Apt. 572,"6/17/2021, 9:44:54 PM",446.29
786,Nathen_Kovacek64@hotmail.com,677-86-2303,Celine,Dicki,68305 Labadie Shoal Suite 608,"4/23/2021, 6:49:34 PM",889.37
...
example/example.json
:
{
"columns": [
{
"redactWith": "random.number",
"columnNum": "",
"columnKey": "order id",
"tracked": false
},
{
"redactWith": "customGenerateId",
"columnNum": 0,
"columnKey": "",
"tracked": true
},
...
The columns
array contains objects with properties that describe how each column should be redacted:
columnNum
- (integer) Identifies the column to be redacted with an integer index (zero-based). (columnNum
or columnKey
must be set)
columnKey
- (string) Identifies the column to be redacted using the file's header. (columnNum
or columnKey
must be set)
redactWith
- (string) The strategy used to redact a value, there are four options:
name.firstName
or internet.email
{{address.streetAddress(true)}}
or {{address.city}}, {{address.state}} {{address.zip}}
.js
file (see example.js
)John Doe
tracked
- Tracking preserves the relationships within your data while de-identifying. With tracking enabled, the redaction engine tracks a column's original value and reuses the redacted value if the original is re-encountered. To see this in-action, run redact /example/example.csv
and note how columns with tracking enabled (id
,ssn
,email
) are redacted with the same value in example_redacted.csv
.
example/example.js
:
module.exports = {
customGenerateId: () => {
return ++currentId;
},
...
Custom redactors provide more control over your data. A custom redactor is referenced from your .json
file using the redactWith
property. For example: redactWith: "customGenerateId"
FAQs
Assists in the redaction of PHI in structured or semi-structured data, supporting excel (XSLX), CSV or JSON.
The npm package redact-phi receives a total of 0 weekly downloads. As such, redact-phi popularity was classified as not popular.
We found that redact-phi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.