{"id":29099899,"url":"https://github.com/bcc-code/db_masker","last_synced_at":"2025-06-28T17:37:49.113Z","repository":{"id":65717321,"uuid":"598040041","full_name":"bcc-code/db_masker","owner":"bcc-code","description":"A database data anonymiser.","archived":false,"fork":false,"pushed_at":"2024-06-06T08:58:15.000Z","size":209,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-24T07:07:24.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcc-code.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}},"created_at":"2023-02-06T09:13:08.000Z","updated_at":"2024-06-06T08:58:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc14e3da-af89-42c4-88bc-92ed5a2a8a39","html_url":"https://github.com/bcc-code/db_masker","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"c8f7b3ece2b5e7ab453ab53484e18028fff4b6ef"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bcc-code/db_masker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fdb_masker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fdb_masker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fdb_masker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fdb_masker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcc-code","download_url":"https://codeload.github.com/bcc-code/db_masker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fdb_masker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262018384,"owners_count":23245606,"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","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":[],"created_at":"2025-06-28T17:37:47.408Z","updated_at":"2025-06-28T17:37:49.086Z","avatar_url":"https://github.com/bcc-code.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Db Masker\n\nDb Masker is a library for masking database data by performing updates on the data and optionally removing it. The updates and removals are specified in yaml configuration files.\n\n### Supports\n\n- Postgres\n- MySQL / MySQL2\n- SQLite\n\nInstall the correspond client library to use the database.\n\n## Configuring Db Masker\nTo configure Db Masker, you'll need to set up the following:\n\nThe database connection information in the db-masker-config.yaml file.\n```yaml\ntasksDir: \"./tasks\" # relative to the config file\nclient: \"pg\"\nconnection:\n  host: \"127.0.0.1\"\n  user: \"user\"\n  password: \"password\"\n  database: \"database\"\n```\n\nAlternatively, a js file can be used to configure the database connection. The js file should export a function that returns the configuration object. The function will be passed the environment variable `NODE_ENV` as an argument. This allows you to configure the database connection based on the environment.\n\n```js\nmodule.exports = (env) =\u003e {\n  return {\n    tasksDir: \"./tasks\",\n    client: \"pg\", // or mysql or sqlite3\n    connection: () =\u003e {\n      // return connection settings\n    },\n  }\n}\n```\n\nThe data updates and removals in one or more yaml files in the `tasks` directory. Each file corresponds to a namespace, and the data updates and removals are specified by table.\n\nHere's an example of a yaml file:\n\n```yaml\n[namespace]: # A single namespace per config file\n  [table]: # The exact table name on which to take actions (Can have multiple tables per namespace)\n    id: \"column_name\" #(optional default: id) The column name that is the primary key for the table\n    delete: true #(optional) remove all data from the table ( can also be a raw where clause eg. \"column_name2 \u003e 100\" )\n    updates:\n      - column: \"column_name\"\n        fn: \"name.firstName\" # use the faker function name.firstName to update the column\n      - column: \"column_name2\"\n        fn: \"mersenne.rand\" # use the faker function mersenne.rand to update the column\n        args: [100, 1] # pass in two arguments to the function, the maximum and minimum numbers\n      - column: \"column_name3\"\n        fn: \"raw\" # use the raw sql to update the column\n        query: \"CONCAT(column_name, ' ', column_name2)\"\n```\n\n[https://fakerjs.dev/api/](https://fakerjs.dev/api/) has a list of all the faker functions that can be used. REMEMBER THE NAMESPACE IS REQUIRED, eg. `internet.email`\n\n## Usage\n\nTo run Db Masker, run the following command in your terminal:\n\n```bash\nnpx db_masker db-masker-config.yaml\n```\n\nThis will mask the data in your database according to the specifications in the yaml configuration files. The output will be logged to the console, and the process will exit with a status code of 0 on success or 1 on failure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcc-code%2Fdb_masker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcc-code%2Fdb_masker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcc-code%2Fdb_masker/lists"}