Skip to main content

自动隐私合规检测器:基于 AST 的静态代码分析工具,帮助检测代码中的敏感信息泄露风险

Project description

AutoPrivacyAudit

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

特性

  • 静态代码分析
    自动解析代码并检测敏感关键词,识别潜在的隐私泄露风险。
  • 日志输出检测
    检查 print 和日志函数(如 logging.infologging.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']}")

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

联系方式

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

auto_privacy_audit-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

auto_privacy_audit-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file auto_privacy_audit-0.1.0.tar.gz.

File metadata

  • Download URL: auto_privacy_audit-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for auto_privacy_audit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 75c0da690e770e14e9ce994fa1bf542a79cd4a4ed27001078717308d7e26400d
MD5 70e7f2b483147ed2d7c3483db4cb3ddc
BLAKE2b-256 21d3ad7ec36cd7f781a8f63edf911cbe1e7d5db49928eff2b061d9cb2d7a4ef9

See more details on using hashes here.

File details

Details for the file auto_privacy_audit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_privacy_audit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7350720bbdea2071b1e66421c816d99599bf78002e93ec880363f62c56ac9406
MD5 7e95b7fd1a30206e1e0043ab1d00dd12
BLAKE2b-256 ea4271ece0ceb68022a71e7911741ef6dae2725ffc6822034e452ec29415b8fd

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