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.1.tar.gz (5.0 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.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: auto_privacy_audit-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 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.1.tar.gz
Algorithm Hash digest
SHA256 61d7748f6d670d8af54190cf2f27cf0ebeacf394259dd58aa106ca40a0e6fc26
MD5 40f5a5e822a70cf5b917191007327157
BLAKE2b-256 e688644522c64169a8dbe59b0be3fde9f8de0a4ff9a1cba5dae2906f32121b16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for auto_privacy_audit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df5473f5c7916a30384b105c6df0172872a564a90885fd1803309a5197325d18
MD5 b728e5d90a944f9a144a12e68770ffcf
BLAKE2b-256 2cfe97705184f6a6611cc4f64f4b5a5934fef81fddbfb1aec5d317a0b8f0effd

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