{"id":18635127,"url":"https://github.com/oxsecurity/maskerlogger","last_synced_at":"2025-04-04T16:16:09.614Z","repository":{"id":247245764,"uuid":"825326843","full_name":"oxsecurity/MaskerLogger","owner":"oxsecurity","description":"The Logger that will prevent your data leak","archived":false,"fork":false,"pushed_at":"2025-02-19T10:46:58.000Z","size":46,"stargazers_count":96,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T15:06:04.274Z","etag":null,"topics":["gitleaks","logging","mask-sensitive-details"],"latest_commit_sha":null,"homepage":"","language":"Python","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/oxsecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2024-07-07T13:24:12.000Z","updated_at":"2025-03-26T01:00:22.000Z","dependencies_parsed_at":"2024-07-07T16:28:44.214Z","dependency_job_id":"27bf974d-e3a0-40e1-a391-50c2f1a8b2f6","html_url":"https://github.com/oxsecurity/MaskerLogger","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"5f78fc23884895824f0297bb624e895af41617d9"},"previous_names":["oxsecurity/maskerlogger"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxsecurity%2FMaskerLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxsecurity%2FMaskerLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxsecurity%2FMaskerLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxsecurity%2FMaskerLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxsecurity","download_url":"https://codeload.github.com/oxsecurity/MaskerLogger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208181,"owners_count":20901570,"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":["gitleaks","logging","mask-sensitive-details"],"created_at":"2024-11-07T05:23:34.540Z","updated_at":"2025-04-04T16:16:09.595Z","avatar_url":"https://github.com/oxsecurity.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Flake Status](https://github.com/oxsecurity/maskerlogger/actions/workflows/flake.yml/badge.svg)\n[![PyPI version](https://badge.fury.io/py/maskerlogger.svg)](https://badge.fury.io/py/maskerlogger)\n[![GitHub release](https://img.shields.io/github/v/release/oxsecurity/maskerlogger?sort=semver)](https://github.com/oxsecurity/maskerlogger/releases)\n[![License](https://img.shields.io/github/license/oxsecurity/maskerlogger)](https://github.com/oxsecurity/maskerlogger/blob/main/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/oxsecurity/maskerlogger?cacheSeconds=3600)](https://github.com/oxsecurity/maskerlogger/stargazers/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n\n![MaskerLoggerTitle](https://github.com/oxsecurity/MaskerLogger/assets/140309297/ae8ec8a7-9ec8-42f6-9640-6f9cd91e986e)\n\n# Masker Logger\n\nKeep Your logs safe!  \nThis formatter ensures the security of your logs and prevents sensitive data leaks.\nFor example -   \nUsing this Formatter will print this line:   \n`logger.info(f'Dont Give Your {secrets} away')`  \nlike this:    \n`Dont Give Your ****** away`\n\n## Getting started\nThis formatter utilizes the standard `logging.Formatter` module.  \nBefore printing each record to any destination (file, stdout, etc.), it ensures sensitive data is masked with asterisks to prevent leaks.\n\n### Install the library\n\n```\npip install maskerlogger\n```\n\n### Basic Usage\n\n Like any formatter - just init your logger handler with the MaskerLogger formatter.  \n ```\n from maskerlogger import MaskerFormatter\n logger = logging.getLogger('logger')\n logger.setLevel(logging.DEBUG)\n handler = logging.StreamHandler()\n handler.setFormatter(\n     MaskerFormatter(\"%(asctime)s %(name)s %(levelname)s %(message)s\"))\n logger.addHandler(handler)\n ```\n#### skip masking\nIf, for some reason, you want to disable masking on a specific log line, use the `SKIP_MASK` mechanism.\n```\nfrom masker_formatter import MaskerFormatter, SKIP_MASK\n...\n...\nlogger.info('Line you want to skip', extra=SKIP_MASK)\n```\n\n#### redact\nHere’s a rewritten version suitable for inclusion in a README.md file:\n\n---\n\n### Partial Masking of Secrets\nIf you prefer to mask only a portion of a secret (rather than its entire length), you can set the `redact` parameter in the formatter. The `redact` parameter specifies the percentage of the secret to be masked.\n\nHere’s an example of how to use it:\n\n```\nhandler.setFormatter(\n    MaskerFormatter(\"%(asctime)s %(name)s %(levelname)s %(message)s\",\n                    redact=30))\n```\n\nIn this example, 30% of the secret will be masked. Adjust the `redact` value as needed to suit your requirements.\n\n## The Config File\n\nHere's where the magic happens!  \nOur tool is built upon the powerful Gitleaks tool,  \nleveraging its default configuration to scan for sensitive data leaks in repositories.  \nYou can find the default configuration [here](https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml)\n\n#### Use custom config file\n\nTo create and use your own config file, set the path when initializing the formatter: \n```\nhandler.setFormatter(\n    MaskerFormatter(\"%(asctime)s %(name)s %(levelname)s %(message)s\",\n                    regex_config_path=\"your/config/gitleaks.toml\"))\n```\n\nGood luck!\n\n\n##### Brought to you by [OX Security](https://www.ox.security/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxsecurity%2Fmaskerlogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxsecurity%2Fmaskerlogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxsecurity%2Fmaskerlogger/lists"}