Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Microsoft Security Utilities - Secret Masker

microsoft-security-utilities-secret-masker is part of the Microsoft Security Utilities used internally. You can find the related .NET SDK package here. This Secret Masker Python library focuses on:

  • providing some built-in detection rules in json format

  • detecting sensitive data for given input

  • masking sensitive data with simple symbols or sha256 hash for given input

Installation

You can install the package via pip:

pip install microsoft-security-utilities-secret-masker

Usage

You can use the SecretMasker class to detect and mask sensitive data in your input. Here is an example:

from microsoft_security_utilities_secret_masker import SecretMasker, load_regex_patterns_from_json_file

# Load built-in detection rules
precisely_classified_regex_patterns = load_regex_patterns_from_json_file('PreciselyClassifiedSecurityKeys.json')
unclassified_regex_patterns = load_regex_patterns_from_json_file('UnclassifiedPotentialSecurityKeys.json')
# construct secret masker with chosen patterns
regex_patterns = precisely_classified_regex_patterns.union(unclassified_regex_patterns)
secret_masker = SecretMasker(regex_patterns)

input = "This is a sample input with no secrets"
detected_secrets = secret_masker.detect_secrets(input)
processed_input = secret_masker.mask_secrets(input)

License

Microsoft Security Utilities - Secret Masker (secret-masker)

Copyright (c) Microsoft Corporation
All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.::

Release History

1.0.0b4

  • Update regex patterns

1.0.0b3

  • Minor fix

1.0.0b2

  • Adopt confidence level patterns

1.0.0b1

  • Initial release

Metadata

Release files for microsoft-security-utilities-secret-masker 1.0.0b4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microsoft-security-utilities-secret-masker 1.0.0b4
File Size Uploaded Provenance Actions
microsoft_security_utilities_secret_masker-1.0.0b4.tar.gz 10.9 kB Without provenance Details for microsoft_security_utilities_secret_masker-1.0.0b4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microsoft-security-utilities-secret-masker 1.0.0b4
File Interpreter ABI Platform Actions
microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl Python 3 none any Details for microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl

Total release size: 27.6 kB

Release files / microsoft_security_utilities_secret_masker-1.0.0b4.tar.gz

Download URL microsoft_security_utilities_secret_masker-1.0.0b4.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a30bd361ac18c8b52f6844076bc26465335949ea9c7a004d95f5196ec6fdef3e
BLAKE2b-256 checksum
How to use checksums
e81a6fa5c0ba55ed62e17df010af8a3a71ffea701c3d414b4688834c527d5aeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl

Download URL microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0429fcaad10fc8ae3f940ab84fd2926e4f50ede134162144123b35937be831a8
BLAKE2b-256 checksum
How to use checksums
6b4b69befea52f4623da5356e46cb3fc020525d35ceb766a428abb4919628cdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for microsoft-security-utilities-secret-masker 1.0.0b4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page