microsoft-security-utilities-secret-masker
A tool for detecting and masking secrets
What it is and what it does
This is a Microsoft-authored library for detecting and redacting sensitive information like API keys, credentials, and tokens from text. It ships with pre-built regex patterns organized by confidence level (precisely classified vs. unclassified), and provides two masking strategies: simple symbol replacement or SHA256 hashing. The library has no external runtime dependencies, making it lightweight to integrate.
The package is in beta (1.0.0b4) and maintenance is aging. It's positioned for internal Microsoft use but is publicly available. If you need to sanitize logs, audit trails, or user input before storage or transmission, this library offers a straightforward regex-based approach with Microsoft's curated detection rules.
Use it for:
- Sanitize application logs before shipping them to external monitoring or storage systems
- Redact credentials and tokens from error messages or debug output shown to users
- Mask sensitive data in database exports or backups before sharing with third parties
- Clean user-generated content in support tickets or feedback forms
- Prepare training datasets by removing secrets before publishing or sharing
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Detects and masks sensitive data in text using regex patterns, with built-in rules for common secret types and options to replace matches with symbols or SHA256 hashes.
Yes, if you need straightforward secret detection and masking with no external dependencies and trust Microsoft's regex patterns. The beta status and aging maintenance mean it's stable enough for production but unlikely to evolve further—suitable for teams already using Microsoft tooling or those with simple, well-defined secret types. Not recommended if you need active maintenance, custom pattern tuning, or support for emerging secret formats.
Install
microsoft-security-utilities-secret-masker on PyPI
pip
pip install microsoft-security-utilities-secret-maskeruv
uv add microsoft-security-utilities-secret-maskerpoetry
poetry add microsoft-security-utilities-secret-maskerInstalling microsoft-security-utilities-secret-masker
Before you install
Low install friction with no runtime dependencies. Package is in beta (1.0.0b4) and aging—last release was 522 days ago, suggesting limited active maintenance.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install microsoft-security-utilities-secret-masker
from microsoft_security_utilities_secret_masker import SecretMasker, load_regex_patterns_from_json_file
patterns = load_regex_patterns_from_json_file('PreciselyClassifiedSecurityKeys.json')
secret_masker = SecretMasker(patterns)
detected = secret_masker.detect_secrets("input text")
masked = secret_masker.mask_secrets("input text")
Verify before relying
- Whether the built-in detection rules are comprehensive for your specific secret types
- Current maintenance status and whether updates are planned beyond the beta release
- Performance characteristics when processing large volumes of text
- Accuracy of regex patterns and false-positive rates in production use
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 522 days since the last release |
| First released | |
| Downloads | 5,454,814/month — #2,095 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
drain3Drain3 extracts recurring patterns (templates)…
permissive · top 15,000 on PyPI
presidio-anonymizerReplaces detected PII text entities with…
permissive · top 5,000 on PyPI
kingfisher-binKingfisher is a command-line secret scanner…
permissive · top 15,000 on PyPI
pwinputDisplays mask characters (like asterisks) as…
permissive · top 15,000 on PyPI
detect-secretsDetects secrets (API keys, tokens, credentials)…
permissive · top 5,000 on PyPI
bc-detect-secretsDetects secrets (API keys, tokens, credentials)…
permissive · top 5,000 on PyPI
robocorp-vaultProvides read and write access to secrets…
permissive · top 15,000 on PyPI
truffleHogScans Git repositories and other sources for…
unclear · top 15,000 on PyPI
regionmaskregionmask creates spatial masks for gridded…
permissive · top 15,000 on PyPI
shamir-mnemonicImplements SLIP-0039 Shamir's Secret Sharing to…
permissive · top 15,000 on PyPI