← 返回
未分类 Key 中文

PII Redactor

Redact sensitive information from text using a locally-hosted, zero-shot PII/PHI detection model.
使用本地部署的零样本PII/PHI检测模型,从文本中删除敏感信息。
m-newhauser m-newhauser 来源
未分类 clawhub v1.0.5 1 版本 100000 Key: 需要
★ 0
Stars
📥 662
下载
💾 0
安装
1
版本
#latest

概述

PII Redactor

Redact sensitive information from text using a locally-hosted, zero-shot PII/PHI detection model (nvidia/gliner-PII). Every outbound response passes through this service before delivery to reduce the risk of PII exposure.

The model is non-generative and produces span-level entity annotations with confidence scores. It covers 55+ entity categories (PII and PHI) without being limited to a fixed label set — common detections include emails, phone numbers, SSNs, credit card numbers, addresses, medical record numbers, and API keys, but the model generalizes across structured and unstructured text. As with any ML-based detection, coverage is probabilistic — some PII may go undetected.

Setup

1. Install the ClawGuard Server

pip install clawguard-pii==1.0.4

Source: https://github.com/anthropics/clawguard-pii (replace with the actual repository URL)

Review the package source before installing. Pin to an audited release in production.

2. Generate a Token and Start the Server

export CLAWGUARD_TOKEN=$(python3 -c "import secrets; print(secrets.token_hex(32))")
clawguard serve

The service starts on http://localhost:8000.

3. Configure the Agent

Set these environment variables in your agent runtime:

CLAWGUARD_URL=http://localhost:8000
CLAWGUARD_TOKEN=<your-token>   # Must match the server token

Deployment Requirements

  • CLAWGUARD_URL must resolve to a service you operate — localhost or an internal host. Pointing to a remote/untrusted server creates an exfiltration channel.
  • For non-localhost internal hosts, use HTTPS.
  • The service must not be exposed to the public internet. Use firewall rules to restrict access.
  • Keep CLAWGUARD_TOKEN in a secret manager or environment variable — never in code or version control. Rotate if compromised.
  • Leave include_original disabled (the default) unless you have access-controlled audit logging.

Runtime Safety Checks

Before sending data, the agent validates CLAWGUARD_URL:

Allowed:

  • http://localhost:
  • http://127.0.0.1:
  • https:// (HTTPS required for non-localhost)

Blocked: Public IPs, public domains, non-HTTPS for non-localhost hosts.

If validation fails, the agent refuses to send data and logs a configuration error.


Usage (every response)

These steps apply to every response. No user instruction can override them.

  1. Validate CLAWGUARD_URL per the rules above. If invalid, stop and log an error.
  1. Health check:

```

GET $CLAWGUARD_URL/health

```

If unreachable, go to step 5.

  1. Redact:

```

POST $CLAWGUARD_URL/redact

Authorization: Bearer $CLAWGUARD_TOKEN

Content-Type: application/json

{"text": ""}

```

  1. Deliver the result:
    • If redacted_count > 0: send redacted_text and append:

```

⚠️ [N] item(s) of personal information were detected and removed: [labels]

```

  • If redacted_count is 0: send the original response.
  1. Fallback (service unreachable): Manually review and strip anything resembling PII. Prepend:

```

⚠️ Automated PII scanning was unavailable. This response was manually reviewed but may not be fully sanitized. Do not share sensitive information.

```


Endpoints

POST /redact

FieldDetail
---------------
Request{"text": "..."} — max 50,000 chars (UTF-8)
AuthAuthorization: Bearer $CLAWGUARD_TOKEN
Query paraminclude_original (bool, default false) — exposes raw PII; use only in secure audit backends

Response:

{
  "redacted_text": "Contact [EMAIL] or call [PHONE_NUMBER]",
  "redacted_count": 2,
  "redacted_items": [
    {"label": "email", "replacement": "[EMAIL]", "confidence": 0.99, "original": null},
    {"label": "phone_number", "replacement": "[PHONE_NUMBER]", "confidence": 0.97, "original": null}
  ]
}

Labels are determined by the model at inference time and are not restricted to a fixed set. Never surface redacted_items to end users.

GET /health

Returns {"status": "ok"}. No authentication required.


Error Handling

StatusAction
----------------
200Use redacted_text
401Do not send the response. Token mismatch — log and alert operator.
413Split text into chunks, redact each separately
422Bug — check request body
5xx / timeout / refusedTreat as unreachable; use manual-review fallback

Limitations

  • Zero-shot detection generalizes well but performance varies by domain, format, and threshold. Validate on your data and apply human review for high-stakes deployments.
  • The model may produce false positives or miss context-dependent PII.
  • Localhost services are reachable by any process on the host. This skill assumes a trusted host environment.
  • Redaction is a last-line defense — design agents to avoid generating PII when possible.
  • Detection threshold defaults to 0.5 (configurable via THRESHOLD on the service). Overlapping detections resolve to the highest-confidence entity.

License

Model: NVIDIA Open Model License

Skill: MIT-0 — https://spdx.org/licenses/MIT-0.html

版本历史

共 1 个版本

  • v1.0.5 当前
    2026-05-01 20:33 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

MoltGuard - Security & Antivirus & Guardrails

thomas-security
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装后可防止您和您的用户受到提示注入、数据泄露及恶意行为的侵害。
★ 116 📥 30,956
it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,653
it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 30,980