skillfed

microsoft-security-utilities-secret-masker

A tool for detecting and masking secrets

microsoft-security-utilities-secret-masker v1.0.0b4 5.5M downloads/30d#2,095 on PyPI
Permissive license MIT AGING released

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-masker

uv

uv add microsoft-security-utilities-secret-masker

poetry

poetry add microsoft-security-utilities-secret-masker

Installing 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

detect secrets in textmask sensitive dataregex-based secret detectionredact credentialshide api keys and tokensdata masking librarysecret redaction
secret-detectiondata-maskinglog-sanitization

More Security packages