Skip to main content

A tool for detecting and masking secrets

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file microsoft_security_utilities_secret_masker-1.0.0b4.tar.gz.

File metadata

File hashes

Hashes for microsoft_security_utilities_secret_masker-1.0.0b4.tar.gz
Algorithm Hash digest
SHA256 a30bd361ac18c8b52f6844076bc26465335949ea9c7a004d95f5196ec6fdef3e
MD5 d57e5a0b6a15885e7f996715fc50e418
BLAKE2b-256 e81a6fa5c0ba55ed62e17df010af8a3a71ffea701c3d414b4688834c527d5aeb

See more details on using hashes here.

File details

Details for the file microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_security_utilities_secret_masker-1.0.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 0429fcaad10fc8ae3f940ab84fd2926e4f50ede134162144123b35937be831a8
MD5 5a5a78d015dac09446f81de50f3f383b
BLAKE2b-256 6b4b69befea52f4623da5356e46cb3fc020525d35ceb766a428abb4919628cdc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page