360 Secure SkillHub
360 安全技能中心

PDF Sanitizer

该 Skill 对 PDF 文本层与元数据执行敏感信息检测,支持中英文证件号、电话、银行卡、邮箱、住址等类别,并通过黑条、模糊或占位符方式脱敏,重建 PDF 并输出 JSON 报告。

harrylabsj
harrylabsj
热度 16.02
最近更新 2026-06-13 15:56:18
分类:安全依赖:代码执行 / 读写文件 / 内部调用大模型应用场景:数据处理 / 工作流 / 文件转换 / 报告撰写 ...

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pdf-sanitizer
Metadata
name
pdf-sanitizer
description
Detect and redact sensitive information in PDFs — ID numbers, phone numbers, addresses, bank cards.
metadata
{"category":"Document Processing","priority":"P0","languages":"zh-CN, en"}

PDF Sanitizer

Detect and redact sensitive information in PDF documents while preserving original layout.

Workflow

  1. Ingest PDF — extract text layer and metadata via pdfplumber/PyMuPDF.
  2. Scan for PII — run regex + AI pattern matching against Chinese and international PII:
    • Chinese ID number (18-digit)
    • Chinese phone numbers
    • Bank card numbers
    • Email addresses
    • Residential addresses (Chinese)
    • Person names (context-based)
  3. Highlight — annotate every match with bounding boxes and category labels.
  4. Confirm — present categories to user for selection. Default: all categories enabled.
  5. Redact — apply chosen mode per category:
    • blackout — solid black rectangle over sensitive text
    • blur — pixel-level Gaussian blur on image-rendered area
    • placeholder — replace with [REDACTED] while keeping surrounding text
  6. Rebuild PDF — flatten redactions into final output, preserving original fonts, images, and layout.
  7. Report — output redacted PDF + JSON report listing each redaction:
    • original snippet (truncated), category, page number, bounding box, mode applied.

Sample Prompt

pdf-sanitizer redact --input contract.pdf --categories id_card,phone,address --mode blackout
pdf-sanitizer redact --input 社保材料.pdf --output clean.pdf --categories all --mode placeholder
pdf-sanitizer scan --input report.pdf
pdf-sanitizer review --input contract.pdf --page 3-7