README 未给出具体安装命令,需查阅官方安装文档;自动检测无法保证找出所有敏感信息,需配合其他防护系统;项目已迁移到新仓库,注意版本与迁移说明
presidio
data-privacy-stackMIT活跃维护微软开源的 PII 检测与脱敏框架,能从文本、图像和结构化数据中识别并匿名化姓名、电话等敏感信息,支持 NLP 与正则规则组合的自定义流水线。
An open-source framework for detecting, redacting, masking, and anonymizing sensitive data (PII) across text, images, and structured data. Supports NLP, pattern matching, and customizable pipelines.
pip install presidio-analyzer presidio-anonymizerREADME 未说明
开源 PII 检测与脱敏 SDK,帮你从文本和图像中识别并匿名化敏感信息
微软开源的 PII 检测与脱敏框架,能从文本、图像和结构化数据中识别并匿名化姓名、电话等敏感信息,支持 NLP 与正则规则组合的自定义流水线。
核心能力
- 用 NER、正则、规则和校验和识别 PII
- 支持自定义识别器并接入外部 PII 检测模型
- 提供文本匿名化与图像 PII 打码模块
- 可从 Python、PySpark、Docker 到 Kubernetes 部署
- 支持多语言上下文感知的 PII 识别
容易踩的坑
- 2.2.366Release 2.2.366最新正式版2026-10-27 · 2026-10-27 09:26 UTC
This is a security release. It raises the Pillow requirement of
presidio-image-redactorto 13.0.0, refreshes every lock file to clear 100 known advisories, locks Transformers 5.16.1 in the analyzer, and ships slimmed container images plus new distroless variants. It also drops Python 3.10.Packages:
presidio-analyzer2.2.366,presidio-anonymizer2.2.366,presidio2.2.366,presidio-image-redactor0.0.62,presidio-structured0.0.10.Upgrade notes
- Python 3.10 is no longer supported. Python 3.10 reached end of life on 2026-10-01. All packages now require Python
>=3.11,<3.15. Installs on Python 3.10 resolve to the previous releases. presidio-image-redactorrequires Pillow 13. The requirement is nowpillow>=13.0.0,<14.0.0. Pillow 13 fixes the 41 security advisories (5 critical, 23 high) open against Pillow 12.3.0 (#2393).- The spaCy factory
hf_token_pipeis gone. The analyzer no longer depends onspacy-huggingface-pipelines.TransformersNlpEnginenow registers its ownpresidio_hf_token_pipefactory. A spaCy pipeline saved withnlp.to_disk()that referenceshf_token_pipeno longer loads; Presidio never saves such a pipeline itself. Detection results and scores are unchanged. - New minimums for the analyzer extras. The
transformersextra requirestransformers>=4.28.0,<6.0.0. Theglinerextra requiresgliner>=0.2.29,transformers>=4.51.3,<5.17.0and a singleonnxruntime>=1.19. Installing Transformers 5.10 or later is recommended to pick up the security fixes. - Container images no longer ship
curl. The imageHEALTHCHECKnow probes/healthwith the Python standard library and ignoresHTTP_PROXY. Thedocker-compose.ymlhealthcheck overrides were removed so the image healthchecks apply. Existing image tags keep their names.
Security
- Slimmed and hardened the default analyzer and anonymizer images: the
python:3.12-slimandpython:3.14-slimbases are re-pinned with OS security updates applied, uv is bind-mounted at build time instead of installed, and setuptools and wheel (plus pip in the anonymizer) are removed from the final image. Trivy critical, high and medium findings drop from 321 to 103 (anonymizer) and from 345 to 113 (analyzer). (#2407) - Refreshed every
uv.lockfile to fix the 100 known advisories in the locked development and CI dependencies, includingpillow13.0.0,virtualenv21.14.13,pyjwt2.15.1,aiohttp3.14.5,urllib32.8.0,cryptography50.0.2,filelock4.2.4,oauthlib4.0.0 andcertifi2026.10.23. Apart from the Pillow and onnxruntime requirements above, published dependency ranges are unchanged. (#2409) - Locked
transformersto 5.16.1 in the analyzer, which fixes GHSA-xrqw-3rrv-vx5w and GHSA-x9r9-c232-4q39. (#2201) - Raised the
presidio-image-redactorPillow requirement to 13 and replaced theImage.getdata()call in the DICOM redactor withget_flattened_data(), sincegetdata()is deprecated in Pillow 13 and removed in Pillow 14. (#2393, #2409)
Added
-
Distroless container images. The analyzer and anonymizer are also published as distroless images built on Azure Linux, tagged
<version>-distrolessandlatest-distrolessin the same GHCR repositories. The unsuffixed tags, includinglatest, remain the default images. The distroless images contain no shell, package manager, pip or uv, run Python 3.12 as UID 65532, listen on port 3000, and take gunicorn settings throughGUNICORN_CMD_ARGSinstead ofPORTandWORKERS. Trivy findings are 1 (anonymizer) and 6 (analyzer). Adocker-compose.distroless.ymloverride runs them locally. (#2407)docker pull ghcr.io/data-privacy-stack/presidio-analyzer:2.2.366-distroless docker pull ghcr.io/data-privacy-stack/presidio-anonymizer:2.2.366-distroless -
Context-aware enhancer configuration in YAML. A new optional
context_aware_enhancersection in the analyzer configuration sets the `LemmaContextA
- Python 3.10 is no longer supported. Python 3.10 reached end of life on 2026-10-01. All packages now require Python
- 2.2.365Release 2.2.3652026-10-25 · 2026-10-25 19:31 UTC
查看更新说明
What's Changed
- ci: restrict release workflow to main by @RonShakutai in https://github.com/data-privacy-stack/presidio/pull/2187
- Raise Pillow minimum to 12.3.0 by @SharonHart in https://github.com/data-privacy-stack/presidio/pull/2188
- fix(structured): anonymize columns whose name is not an identifier by @uwezkhan in https://github.com/data-privacy-stack/presidio/pull/2142
- feat(analyzer): add nine South African predefined recognizers by @thatomokoena in https://github.com/data-privacy-stack/presidio/pull/2069
- Canonicalize Pillow requirement syntax by @SharonHart in https://github.com/data-privacy-stack/presidio/pull/2193
- Feature/ph passport recognizer by @jacobArquiza in https://github.com/data-privacy-stack/presidio/pull/2030
- feat: Add tokenizer-based text chunking for NER recognizers by @yuriihavrylko in https://github.com/data-privacy-stack/presidio/pull/2041
- Document release-time changelog generation policy by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/2200
- feat: Add UuidRecognizer for detecting UUIDs (v1-v8) by @watsos in https://github.com/data-privacy-stack/presidio/pull/2175
- feat: Add CaPostalCodeRecognizer for Canadian postal codes (CA_POSTAL… by @watsos in https://github.com/data-privacy-stack/presidio/pull/2204
- feat(anonymizer): expose confidence score in OperatorResult by @kshvg in https://github.com/data-privacy-stack/presidio/pull/2059
- fix(analyzer): make every recognizer listed in default_recognizers.yaml loadable by @developer0hye in https://github.com/data-privacy-stack/presidio/pull/2170
- fix(analyzer): let AzureAILanguageRecognizer load from a registry config, and un-mute the test that guards it by @developer0hye in https://github.com/data-privacy-stack/presidio/pull/2224
- docs: update development setup from Poetry to uv by @juno-junho in https://github.com/data-privacy-stack/presidio/pull/2220
- Fix UK_NINO regex matching a leading space by @inesaranab in https://github.com/data-privacy-stack/presidio/pull/2209
- fix(analyzer): register three predefined recognizers missing from default_recognizers.yaml by @juno-junho in https://github.com/data-privacy-stack/presidio/pull/2218
- fix: snap chunk start to a word boundary in CharacterBasedTextChunker by @inesaranab in https://github.com/data-privacy-stack/presidio/pull/2226
- feat(analyzer): Add Healthcare identifiers recognizer by @bhargavikalicheti in https://github.com/data-privacy-stack/presidio/pull/2159
- Formal Copilot review instructions + cross-agent guidelines (recognizers, YAML config, general practices) by @omri374 in https://github.com/data-privacy-stack/presidio/pull/2211
- fix(anonymizer): bump cryptography to >=50.0.0 for GHSA-g6cj-pr64-35w5 by @Aryan-Pardeshi in https://github.com/data-privacy-stack/presidio/pull/2231
- ci: auto-label pull requests by component and area by @omri374 in https://github.com/data-privacy-stack/presidio/pull/2240
- fix(analyzer): omitted deny_list_score in YAML registry now defaults to 1.0 by @ppradyoth in https://github.com/data-privacy-stack/presidio/pull/2254
- fix(analyzer): remove a non-language code and a duplicate entry from default_recognizers.yaml by @heeoneie in https://github.com/data-privacy-stack/presidio/pull/2236
- docs(api): document global_regex_flags and deny_list_score on PatternRecognizer by @MohammedAlkindi in https://github.com/data-privacy-stack/presidio/pull/2255
- docs: add a Presidio sample for AISIX AI Gateway by @Yilialinn in https://github.com/data-privacy-stack/presidio/pull/2257
- fix(cli): fix --no-warnings, exit code, github output and threshold config by @v0ropaev in https://github.com/data-privacy-stack/presidio/pull/2266
- Warn about unsupported requested entities while preserving partial results by @nikolas-sapa in https://github.com/data-privacy-stack/presidio/pull/2259
- fix(analyzer): avoid quadratic duplicate result checks by @mbukowicz in https://github.com/data-privacy-stack/presidi
- 2.2.364Release 2.2.3642026-07-22 · 2026-07-22 08:30 UTC
查看更新说明
What's Changed
- Fix CI and release container publishing by @SharonHart in https://github.com/data-privacy-stack/presidio/pull/2127
- docs: show compact mascot on mobile homepage by @SharonHart in https://github.com/data-privacy-stack/presidio/pull/2130
- Run documentation release on ubuntu-latest by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/2131
- Resolving docs build issues on main by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/2132
- chore: replace [email protected] with [email protected] in PyPI metadata by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/2128
- Fix UK_NINO regex matching a numeric suffix character by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2112
- Update license copyright to Presidio Contributors by @cobypeled in https://github.com/data-privacy-stack/presidio/pull/2134
- docs: fix typo in IP_ADDRESS detection method description by @Coshea46 in https://github.com/data-privacy-stack/presidio/pull/2133
- feat(cli): add threshold flag override by @rodboev in https://github.com/data-privacy-stack/presidio/pull/2114
- Fix IN vehicle registration under-scoring zero-padded district codes by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2110
- Fix FI HETU regex accepting illegal century separators by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2108
- Fix TH TNIN regex rejecting valid province codes 22, 52 and 58 by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2107
- Fix NG NIN rejecting valid numbers with a leading zero by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2106
- Fix AU ABN accepting some invalid leading-zero numbers by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2109
- fix(es): upper-case NIF/NIE before mod-23 checksum so valid lowercase IDs are detected by @AUTHENSOR in https://github.com/data-privacy-stack/presidio/pull/2076
- Fix NLP engine initialization in GLiNER sample by @matteobachini-vianova in https://github.com/data-privacy-stack/presidio/pull/2135
- Fix DE_FUEHRERSCHEIN docstring example that contradicts the pattern by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2138
- Fix ISO 8601 date pattern accepting impossible month/day values by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2113
- fix(anonymizer): bump cryptography to >=48.0.1,<49.0.0 to resolve GHSA-537c-gmf6-5ccf by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/2144
- Fix EsNieRecognizer.validate_result raising instead of returning False by @MohamedAklamaash in https://github.com/data-privacy-stack/presidio/pull/2146
- build: migrate CI and service images from Poetry to uv by @RonShakutai in https://github.com/data-privacy-stack/presidio/pull/2152
- fix(analyzer): honour language_model_params in BasicLangExtractRecogn… by @RonShakutai in https://github.com/data-privacy-stack/presidio/pull/2150
- [Chore] Add healthcheck and restart policy to docker-compose.yml by @hiro-nikaitou in https://github.com/data-privacy-stack/presidio/pull/2149
- feat: add Python 3.14 compatibility to all remaining Presidio packages by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/2147
- Fix FI HETU accepting 29 Feb of a non-leap century by @jichaowang02-lang in https://github.com/data-privacy-stack/presidio/pull/2111
- fix(analyzer): normalize case before fi hetu and sg uen checksums by @uwezkhan in https://github.com/data-privacy-stack/presidio/pull/2141
- fix(analyzer): stop UsSsnRecognizer from over-blocking 987-65-432X SSNs by @AUTHENSOR in https://github.com/data-privacy-stack/presidio/pull/2074
- fix(analyzer): honour config_path for LangExtract recognizers in YAML registry by @RonShakutai in http
- 2.2.363Release 2.2.3632026-06-28 · 2026-06-28 16:21 UTC
查看更新说明
What's Changed
- feat(analyzer): add German PII recognizers (DE_*) by @MvdB in https://github.com/data-privacy-stack/presidio/pull/1909
- build(deps): bump azure/login from 2.3.0 to 3.0.0 by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1915
- build(deps): bump github/codeql-action from 4.32.6 to 4.34.1 by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1914
- build(deps): bump actions/cache from 5.0.3 to 5.0.4 by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1913
- Fix: config path resolution for PyPI installs (langextract recognizer) by @RonShakutai in https://github.com/data-privacy-stack/presidio/pull/1917
- build(deps): bump github/codeql-action from 4.34.1 to 4.35.1 by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1920
- fix(ci): skip coverage PR comment step when not in a PR context by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/1921
- Swedish personal ID code pattern recognizer by @goveebee in https://github.com/data-privacy-stack/presidio/pull/1912
- Publish sdist alongside wheels to PyPI by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/1924
- build(deps): bump python from 3.13-windowsservercore to 3.15.0a7-windowsservercore in /presidio-anonymizer by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1927
- Swedish Recognizer for Organisationsnummer by @goveebee in https://github.com/data-privacy-stack/presidio/pull/1918
- Fix conf files handling in Docker + Stanza model accessibility issues by @TheSabari07 in https://github.com/data-privacy-stack/presidio/pull/1930
- fix: revert presidio-analyzer Dockerfiles to Python 3.12 and configure dependabot to allow only patch and digest updates by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1928
- build(deps): bump pypa/gh-action-pypi-publish from 1.13.0 to 1.14.0 by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1935
- build(deps): bump python from
f50f56ftof1927c7in /presidio-image-redactor by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1936 - Add Canadian SIN recognizer by @kennionblack in https://github.com/data-privacy-stack/presidio/pull/1934
- build(deps): bump python from
fb83750to5e59aaein /presidio-anonymizer by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1937 - build(deps): bump python from
f3fa41dto5072b08in /presidio-analyzer by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1938 - Update IP recognizer regexes by @kennionblack in https://github.com/data-privacy-stack/presidio/pull/1941
- Slim NLP Engine by @SharonHart in https://github.com/data-privacy-stack/presidio/pull/1916
- chore: harden supply-chain security — dependabot.yml controls and pyproject.toml defensive version ranges by @SharonHart with @Copilot in https://github.com/data-privacy-stack/presidio/pull/1965
- build(deps): bump python from
5072b08to804ddf3in /presidio-analyzer by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1968 - build(deps): bump python from 3.13-slim to 3.13.13-slim in /presidio-image-redactor by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1967
- build(deps): bump python from
5e59aaetobc389f7in /presidio-anonymizer by @dependabot[bot] in https://github.com/data-privacy-stack/presidio/pull/1966 - Updated copilot instructions by @omri374 in https://github.com/data-privacy-stack/presidio/pull/1866
- feat: Add UK driving licence number recognizer by @tee-jagz in https://github.com/data-privacy-stack/presidio/pull/1857
- feat: add merge_entities_with_whitespace param to anonymize() by @harishkernel in https://github.com/data-privacy-stack/presidio/pull/1932
- build(deps-dev): update azure-identity requirement from <2.0.0,>=1.23.0 to >=1.25.3,<
- 2.2.362Release 2.2.3622026-03-18 · 2026-03-18 05:32 UTC
查看更新说明
What's Changed
- Feature - GPU Device Control via Environment Variable by @RonShakutai in https://github.com/microsoft/presidio/pull/1844
- feat: Add HuggingFaceNerRecognizer for direct NER model inference by @ultramancode in https://github.com/microsoft/presidio/pull/1834
- Fix Broken Links by @andyjessen in https://github.com/microsoft/presidio/pull/1856
- Pin dependencies to mitigate supply chain attacks by @Copilot in https://github.com/microsoft/presidio/pull/1861
- Fixing CVE-2024-47874 and CVE-2025-54121 by @SharonHart in https://github.com/microsoft/presidio/pull/1860
- Fixing CVE-2025-2953 and CVE-2025-3730 by @SharonHart in https://github.com/microsoft/presidio/pull/1859
- fix: Fixed context enhancement substring matching bug by @ravi-jindal in https://github.com/microsoft/presidio/pull/1827
- Fix _process_names unconditionally treating all metadata as PHI by @Mr-Neutr0n in https://github.com/microsoft/presidio/pull/1855
- feat: Add UK Postcode (UK_POSTCODE) recognizer by @tee-jagz in https://github.com/microsoft/presidio/pull/1858
- Pin ruff and build pip installs by hash for OSSF scorecard compliance by @Copilot in https://github.com/microsoft/presidio/pull/1864
- Add US NPI (National Provider Identifier) recognizer by @stevenelliottjr in https://github.com/microsoft/presidio/pull/1847
- Add transformer-based MedicalNERRecognizer for clinical entity detection by @stevenelliottjr in https://github.com/microsoft/presidio/pull/1853
- feat: Add Nigeria recognizers (National Identity Number and Vehicle Registration) by @tee-jagz in https://github.com/microsoft/presidio/pull/1863
- fix validation_result type in api docs and type hint by @akios-ai in https://github.com/microsoft/presidio/pull/1869
- Bump actions/setup-python from 6.0.0 to 6.2.0 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1879
- Bump github/codeql-action from 3.32.3 to 4.32.4 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1878
- Bump actions/dependency-review-action from 3.1.5 to 4.8.3 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1877
- Bump microsoft/security-devops-action from 1.11.0 to 1.12.0 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1876
- Bump actions/github-script from 7.0.1 to 8.0.0 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1875
- Bump azure/login from 2.1.1 to 2.3.0 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1874
- Bump docker/setup-buildx-action from 3.7.1 to 3.12.0 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1873
- Bump actions/cache from 4.2.0 to 5.0.3 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1872
- Bump actions/checkout from 4.2.2 to 6.0.2 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1871
- Bump actions/setup-dotnet from 4.0.1 to 5.1.0 by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1870
- Bump python from
9e01bf1tof3fa41din /presidio-analyzer by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1887 - Bump python from
3de9a8dtof50f56fin /presidio-anonymizer by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1886 - feat: Add UK passport and vehicle registration recognizers by @tee-jagz in https://github.com/microsoft/presidio/pull/1862
- Add presidio meta-package: bundles analyzer + anonymizer by @Copilot in https://github.com/microsoft/presidio/pull/1889
- Bump python from
3de9a8dtof50f56fin /presidio-image-redactor by @dependabot[bot] in https://github.com/microsoft/presidio/pull/1885 - Add ONNX Runtime backend support to GLiNERRecognizer with extensible parameter passing by @Copilot in https://github.com/microsoft/presidio/pull/1884
- fix: replace 1 bare except clauses with except Exception by @haosenwang1018 in https://github.com/microsoft/presidio/pull/1881
- fix(analyzer): remove erroneous anchor in Italian driver license regex by @Br1an67
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Presidio - Data Protection and De-identification SDK
:mega: Presidio has moved to a new home! Read more here :mega:
Context aware, pluggable and customizable PII de-identification service for text and images.
| Component | Downloads | Coverage |
|---|---|---|
| Presidio Analyzer | ||
| Presidio Anonymizer | ||
| Presidio Image-Redactor | ||
| Presidio Structured |
What is Presidio
Presidio (Origin from Latin praesidium ‘protection, garrison’) helps to ensure sensitive data is properly managed and governed. It provides fast identification and anonymization modules for private entities in text such as credit card numbers, names, locations, social security numbers, bitcoin wallets, US phone numbers, financial data and more.

:blue_book: Full documentation
:mega: Project transition update
:question: Frequently Asked Questions
:thought_balloon: Demo
:flight_departure: Examples
Goals
- Allow organizations to preserve privacy in a simpler way by democratizing de-identification technologies and introducing transparency in decisions.
- Embrace extensibility and customizability to a specific business need.
- Facilitate both fully automated and semi-automated PII de-identification flows on multiple platforms.
Main features
- Predefined or custom PII recognizers leveraging Named Entity Recognition, regular expressions, rule based logic and checksum with relevant context in multiple languages.
- Options for connecting to external PII detection models.
- Multiple usage options, from Python or PySpark workloads through Docker to Kubernetes.
- Customizability in PII identification and de-identification.
- Module for redacting PII text in images (standard image types and DICOM medical images).
:warning: Presidio can help identify sensitive/PII data in un/structured text. However, because it is using automated detection mechanisms, there is no guarantee that Presidio will find all sensitive information. Consequently, additional systems and protections should be employed.
Installing Presidio
Running Presidio
- Getting started
- Setting up a development environment
- PII de-identification in text
- PII de-identification in images
- Usage samples and example deployments
Support
- Before you submit an issue, please go over the documentation.
- For general discussions, please use the GitHub repo's discussion board.
- If you have a usage question, found a bug or have a suggestion for improvement, please file a GitHub issue.
- For other matters, please email [email protected].
Contributing
For details on contributing to this repository, see the contributing guide.
This project has adopted the Contributor Covenant Code of Conduct.