유대선
프로젝트로
·기술 회고·3

v0.2 Layer 1 — SecretMasker: 10-pattern regex redact before LLM + audit log

First layer of v0.2's 5-layer security architecture: a 286-LOC SecretMasker that redacts API keys, credit cards, and Korean RRNs at the AnalyzeCoordinator boundary — before the instruction reaches the external LLM or hits the audit log on disk.

Backfilled entry — original commit shipped with [no-log] and no log file was written at the time.

What was done

Added SecretMasker.swift (91 LOC) plus 168 LOC of tests and wired it into AnalyzeCoordinator.run() so that every AnalyzeRequest.instruction flowing through the system is regex-redacted before two specific things happen:

  1. The instruction is handed to the dispatcher (which calls the external Vision LLM).
  2. The instruction is persisted into SessionAuditEntry on disk.

Ten patterns are applied, in this specific order (specific prefixes before generic ones to avoid false positives):

Email is deliberately not masked — the product use case "where do I type my email?" requires the instruction to keep the email visible.

Two entry points are exposed:

Why it was needed

From the commit message: this is the first concrete commit against the product-vision-global-multi-platform memory's 5-layer security plan. The product sends the user's screen and instruction to an external Vision LLM, and the instruction is also persisted to disk as an audit entry. Both surfaces are data boundaries where a leaked API key or card number would survive past the live session — the LLM provider's logs on one side, the local disk on the other.

The masker collapses both boundaries into a single chokepoint at the top of AnalyzeCoordinator.run() so there is exactly one place to reason about "did this secret leave the process boundary?"

Files / functions changed

Result / verification

Open / what didn't get done

Commit — 2ffc163