Component evidence
Identifies file types by sniffing magic bytes in a buffer to validate content against declared MIME types and extensions.
// Source: https://github.com/Prismer-AI/PrismerCloud | License: MIT | Copyright 2025-2026 Prismer AI // Provided via justclaw.it.com; keep this notice with the code. // Magic-bytes content sniffer. // // Why: agent_output_policy validates extension + declared mime, but a malicious // or careless agent can name a markdown file `report.pdf` and call it done. // The cloud then dutifully stores it as application/pdf and the user downloads // a "PDF" that won't open. We add a cheap byte-level sniff so the outbox // watcher catches the mismatch BEFORE upload and the cloud rejects it as a // second line of defense (2026-05-22, evidence/v20-acceptance/10). // // Detection is intentionally narrow — only the high-value binary formats users // are likely to be misled about (PDF, PNG, JPEG, GIF, ZIP- ... (truncated -- full source via MCP)