{"id":14483661,"url":"https://github.com/rap2hpoutre/pg-anonymizer","last_synced_at":"2025-10-08T13:54:58.208Z","repository":{"id":37534271,"uuid":"334286333","full_name":"rap2hpoutre/pg-anonymizer","owner":"rap2hpoutre","description":"Dump anonymized PostgreSQL database with a NodeJS CLI","archived":false,"fork":false,"pushed_at":"2024-08-30T13:25:23.000Z","size":1299,"stargazers_count":233,"open_issues_count":13,"forks_count":32,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-09-13T04:39:57.110Z","etag":null,"topics":["anonymization","database","javascript","nodejs","postgresql"],"latest_commit_sha":null,"homepage":"https://raph.site","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rap2hpoutre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-29T23:27:23.000Z","updated_at":"2025-08-04T18:21:22.000Z","dependencies_parsed_at":"2024-06-06T08:03:37.620Z","dependency_job_id":"db183e6f-e9ca-4de6-b4fc-7701b2627266","html_url":"https://github.com/rap2hpoutre/pg-anonymizer","commit_stats":{"total_commits":39,"total_committers":10,"mean_commits":3.9,"dds":0.6923076923076923,"last_synced_commit":"d9f8193272f1f745e18fd46b236f4724c3807644"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/rap2hpoutre/pg-anonymizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rap2hpoutre%2Fpg-anonymizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rap2hpoutre%2Fpg-anonymizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rap2hpoutre%2Fpg-anonymizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rap2hpoutre%2Fpg-anonymizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rap2hpoutre","download_url":"https://codeload.github.com/rap2hpoutre/pg-anonymizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rap2hpoutre%2Fpg-anonymizer/sbom","scorecard":{"id":761810,"data":{"date":"2025-08-11","repo":{"name":"github.com/rap2hpoutre/pg-anonymizer","commit":"276219ec9ef57a41738a15bd504a0ccdd9a90b7c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":3,"reason":"Found 5/16 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29","Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/rap2hpoutre/pg-anonymizer/test.yml/main?enable=pin","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"16 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T23:40:03.190Z","repository_id":37534271,"created_at":"2025-08-22T23:40:03.190Z","updated_at":"2025-08-22T23:40:03.190Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278956331,"owners_count":26075221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anonymization","database","javascript","nodejs","postgresql"],"created_at":"2024-09-03T00:01:57.694Z","updated_at":"2025-10-08T13:54:58.180Z","avatar_url":"https://github.com/rap2hpoutre.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"pg-anonymizer\n=============\n\nExport your PostgreSQL database anonymized. Replace all sensitive data thanks to `faker`. Output to a file that you can easily import with `psql`.\n\n[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)\n[![Version](https://img.shields.io/npm/v/pg-anonymizer.svg)](https://npmjs.org/package/pg-anonymizer)\n[![Downloads](https://img.shields.io/npm/dt/pg-anonymizer.svg)](https://npmjs.org/package/pg-anonymizer)\n[![License](https://img.shields.io/npm/l/pg-anonymizer.svg)](https://github.com/rap2hpoutre/pg-anonymizer/blob/master/package.json)\n## Usage\n\nRun this command by giving a connexion string and an output file name (no need to install first thanks to `npx`):\n\n```bash\nnpx pg-anonymizer postgres://user:secret@localhost:1234/mydb -o dump.sql\n```\n\n☝️ This command requires `pg_dump`. It may already be installed as soon as PostgreSQL is installed.\n\nOutput can also be stdout ('-') so you can pipe the output to zip, gz, or to psql:\n\n```bash\nnpx pg-anonymizer postgres://user:secret@localhost:1234/mydb -o - | psql DATABASE_URL\n```\n\n## API\n\n### `--columns | -c`\n\n#### Specify list of columns to anonymize\n\nUse `--columns` option with a comma separated list of column name:\n\n```bash\nnpx pg-anonymizer postgres://localhost/mydb \\\n  --columns=email,firstName,lastName,phone\n```\n\nSpecifying another list via `--columns` replace the default automatically anonymized values:\n\n```csv\nemail,name,description,address,city,country,phone,comment,birthdate\n```\n\nYou can also specify the table for a column using the dot notation:\n\n```csv\npublic.user.email,public.product.description,email,name\n```\n\n#### Customize replacements \n\nYou can also choose which faker function you want to use to replace data (default is `faker.random.word`):\n\n```bash\nnpx pg-anonymizer postgres://localhost/mydb \\\n  --columns=firstName:faker.name.firstName,lastName:faker.name.lastName\n```\n\n:point_right: You don't need to specify faker function since the command will try to find correct function via column name.\n\nYou can use plain text too for static replacements:\n```bash\nnpx pg-anonymizer postgres://localhost/mydb \\\n  --columns=textcol:hello,jsoncol:{},intcol:12\n```\n\n### `--extension`\n\n#### Use an extension file to create your own custom replacements\n\nCreate an extension file, written in javascript\n```javascript\n// myExtension.js\nmodule.exports = {\n  maskEmail: (email) =\u003e {\n   const [name, domain] = email.split('@');\n   const { length: len } = name;\n   const maskedName = name[0] + '...' + name[len - 1];\n   const maskedEmail = maskedName + '@' + domain;\n   return maskedEmail;\n  }\n};\n```\n\nPass the path to `--extension` and use the module exports in `--columns`\n```bash\nnpx pg-anonymizer postgres://localhost/mydb \\\n  --extension ./myExtension.js \\\n  --columns=email:extension.maskEmail\n```\n\n### `--config | -f`\n\n#### Use a configuration file\n\nYou can use the `--config` option to specify a file with a list of column names and optional replacements, one per line:\n\nCreate a configuration file:\n```csv\nname\nemail\npassword:faker.random.word\n```\n\nPass the path to the file into `--config`\n```bash\nnpx pg-anonymizer postgres://localhost/mydb \\\n  --config /path/to/file\n```\n\n### `--skip`\n\n#### Skip tables\n\nUse `--skip` to skip anonymizing entire tables\n\n```bash\nnpx pg-anonymizer postgres://localhost/mydb --skip public.posts\n```\n\n### `--preserve-null | -n`\n\n#### Preserve `NULL` values\n\nUse `--preserve-null` to skip anonymization on fields with `NULL` values.\n\n```bash\nnpx pg-anonymizer postgres://localhost/mydb --preserve-null\n```\n\n### `--faker-locale`\n\n#### Set fakers locale (i18n)\n\nUse `--faker-locale` to change the locale used by faker (default: `en`)\n\n\n## Import the anonymized file\n\nThe anonymized output file is plain SQL text, you can import it with `psql`.\n\n```bash\npsql -d mylocaldb \u003c output.sql\n```\n\n## Why\n\nThere are a bunch of competitors, still I failed to use them:\n\n - [`postgresql_anonymizer`](https://postgresql-anonymizer.readthedocs.io/en/stable/) may be [hard to setup](https://postgresql-anonymizer.readthedocs.io/en/stable/INSTALL/#install-on-macos) and may be cumbersome for simple usage. Still, I guess it's the best solution.\n - [`pganonymize`](https://pypi.org/project/pganonymize/) fails when it does not use `public` schema or columns have uppercase characters\n - [`pganonymizer`](https://github.com/asgeirrr/pgantomizer) also fails with simple cases. Errors are not explicit and silent.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frap2hpoutre%2Fpg-anonymizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frap2hpoutre%2Fpg-anonymizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frap2hpoutre%2Fpg-anonymizer/lists"}