DEV Community

CoreNova
CoreNova

Posted on Originally published at corenovacloud.com

Redacting Hidden Excel Sheets and PDF Metadata Before Amazon Bedrock RAG Chunking

Most RAG pipelines sanitize text right after calling pypdf or pandas.read_excel(). That leaves three blind spots that regularly fail SOC2 and HIPAA reviews before an Amazon Bedrock Knowledge Base reaches production:

  1. Excel hidden and veryHidden worksheets. Finance and HR workbooks routinely ship with a visible summary tab plus a veryHidden sheet holding raw employee SSNs, bank accounts, or customer emails. Standard extractors either drop it silently or dump every sheet straight into OpenSearch vector chunks.
  2. PDF and Office document metadata. Author, Creator, Subject, and Comments often contain internal email addresses, contractor names, or internal server paths.
  3. DOCX headers/footers and PPTX speaker notes. Deal-desk slides and contract templates store phone numbers and customer identifiers outside the main slide or paragraph body.

If your compliance boundary requires that raw files never leave your AWS VPC, calling an external SaaS DLP API before ingestion is a non-starter.

How Doc & PII Redaction MCP v1.1.0 Handles Hidden Surfaces In-VPC

CoreNova Private Document & PII Redaction MCP Server (v1.1.0) runs as a dual-arch (amd64 / arm64, 0 CVE) container inside your own Amazon EKS cluster, ECS Fargate task, or Bedrock AgentCore VPC with zero outbound network calls.

Two policy switches introduced in v1.1.0 control hidden surfaces deterministically:

  • include_hidden_sheets (bool, default true): Choose whether hidden and veryHidden Excel worksheets are scrubbed and included, or excluded completely from RAG output. The audit payload reports hidden_sheets_detected and hidden_sheets_skipped.
  • redact_metadata (bool, default true): Scrubs PII from PDF Info Dictionaries and Office core_properties, logging findings under audit.metadata_findings.
{
  "tool": "redact_document",
  "arguments": {
    "filename": "q4_vendor_review.xlsx",
    "content_base64": "<base64-xlsx>",
    "include_hidden_sheets": false,
    "redact_metadata": true
  }
}
✨ อัปเดตล่าสุด: corenovalabs/redacting hidden excel sheets and pdf metadata before amazon bedrock rag chunking - Kapook Update 2025 ✨ อัปเดตล่าสุด: corenovalabs/redacting hidden excel sheets and pdf metadata before amazon bedrock rag chunking - Kapook Update 2025

You get clean, chunk-ready Markdown/text back plus an auditable count of every skipped sheet and redacted token (AWS keys, SSNs, Luhn-validated payment cards, IBANs, emails, and phones) before anything hits your embedding model.

Keeping Multi-Turn Agent Prompts Safe Without Breaking Bedrock Prompt Caching

Once documents are clean, runtime tool outputs (CRM, Postgres, Stripe MCP servers) can still leak customer PII back into the model context. Random UUID placeholders like <EMAIL_8f2a> break Amazon Bedrock and Anthropic prefix prompt caching (costing you up to 90% in input token discounts).

Pair your In-VPC ingestion pipeline with CoreNova AI Guard:

  • Deterministic per-payload placeholders ([EMAIL_1], [CREDIT_CARD_1]) keep prompt prefixes byte-identical so prompt caching stays intact.
  • POST /v1/inspect-tools checks third-party tools/list descriptions and schemas for hidden XML instructions and SHA-256 rug-pull drift.
  • McpToolResponseGuard in ai-guard-mcp-starter restricts local restore_for_tool() to explicitly allowlisted tools and fields.

Try in 3 Seconds or Deploy Inside Your VPC

Top comments (0)