Skip to main content

AutoPrivacyAudit

自动隐私合规检测器
AutoPrivacyAudit 是一个基于 Python 的静态代码分析工具,旨在帮助开发者检测代码中潜在的敏感信息泄露风险。利用 AST(抽象语法树)解析技术,本项目能够自动识别日志记录、打印输出等场景中涉及敏感数据(如 email、password、phone 等)的使用情况,从而提高代码安全性和隐私合规性。

特性

  • 静态代码分析
    自动解析代码并检测敏感关键词,识别潜在的隐私泄露风险。
  • 日志输出检测
    检查 print 和日志函数(如 logging.info、logging.error 等)中是否直接输出了敏感信息。
  • 详细审计报告
    为每个检测到的问题提供所在文件、代码行号和建议的修复方案,方便开发者快速定位和修改问题。
  • CI/CD 集成
    提供命令行接口,便于将检测工具集成到持续集成、代码评审及部署流程中。
  • 可扩展的规则系统
    支持用户自定义敏感数据的检测规则,满足不同项目和业务场景的需求。

安装

你可以通过 pip 直接安装 AutoPrivacyAudit:

pip install auto_privacy_audit

使用示例

下面是一个简单的示例,展示如何使用 AutoPrivacyAudit 检测代码中的敏感信息:

from auto_privacy_audit import PrivacyAuditAnalyzer

code = '''
import logging

def test():
    print("User email is test@example.com")
    logging.info("User password: 123456")
'''

analyzer = PrivacyAuditAnalyzer(code)
issues = analyzer.analyze()
for issue in issues:
    print(f"Line {issue['lineno']}: {issue['message']}")

运行后,你将看到输出中标明了敏感信息所在的代码行及具体提示信息。

Line 5: 检测到敏感信息 'email' (敏感关键词 & 敏感模式) 在文本: User email is test@example.com
Line 6: 检测到敏感信息 'password' (敏感关键词) 在文本: User password: 123456

联系方式

  • Email: [1257330051@qq.com]
  • GitHub: [@Yantha6]

Metadata

Release files for auto-privacy-audit 0.1.2

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

Source distribution (sdist)

Source distribution for auto-privacy-audit 0.1.2
File Size Uploaded Provenance
auto_privacy_audit-0.1.2.tar.gz 5.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-privacy-audit 0.1.2
File Interpreter ABI Platform
auto_privacy_audit-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / auto_privacy_audit-0.1.2.tar.gz

Download URL auto_privacy_audit-0.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2d50350d1aeb44087bd7e3822f34545e68132136214cb3a14d3416fab6161f1c
BLAKE2b-256 checksum
How to use checksums
eb029d95ee5993885c1d87e6c1c3b8d45ced5d05181a86335df2ef66d15869dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / auto_privacy_audit-0.1.2-py3-none-any.whl

Download URL auto_privacy_audit-0.1.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ab1b90d415f4e74797d2efeb85cde7bc580fdc4ad7d1f8fadfa92e4dec16786
BLAKE2b-256 checksum
How to use checksums
db1b2b8ed8cd6d2c139d535fd9d79c8f8f4b9f1266b47777ba10f2c6a2890b19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for auto-privacy-audit 0.1.2

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