fix(runner): a download is redaction incomplete unless the runner rewrote it

Merged
OK
2mo ago
+299-17
  • REDACTION_BY_KIND stamped every download artifact redaction: 'complete' without the runner reading a byte of it. Repro: fill a field through a Secret, have the app serve an export holding the same value, and the file lands in the attempt's artifacts as complete; a configured artifacts.store receives the plaintext with metadata that says it is clean. A store that exports only complete artifacts exports the secret. Screenshots on the same session were already withheld by the pixel taint.
  • A download now defaults to incomplete, the label a video already carries: bytes the app served, not rewritten by the runner (packages/e2e/src/run/artifacts.ts).
  • After a secret fill on the session (taint.value), a text-like download (.txt, .csv, .json, .html) is rewritten through the session's SecretLedger before it is hashed or handed to the store, and labelled complete, the same way trace text entries are. A binary or a file that is not UTF-8 stays as served and stays incomplete.
  • StoredArtifact gains redaction, the report's label, so a store can hold back what the runner does not vouch for. e2e mcp standalone attempts get the same wiring.
  • No schema change: incomplete already exists in report-1 and both fixtures.
flowchart LR
  A[engine attaches download] --> B{secret filled on session?}
  B -- no --> E[keep bytes, incomplete]
  B -- yes --> C{text/* or JSON?}
  C -- no --> E
  C -- yes --> D[ledger.redact, rewrite file, complete]
  D --> F[hash + store.put with redaction]
  E --> F
export interface StoredArtifact {
  readonly kind: 'screenshot' | 'trace' | 'video' | 'download' | 'log';
  readonly path: string;
  /** How much of the file the runner masked, as the report records it. */
  readonly redaction: 'complete' | 'not-required' | 'incomplete';
  // ...
}

Docs: docs/security.mdx (limits list and the artifacts table), docs/debugging.mdx, docs/reference/config.mdx, docs/reference/engine.mdx. Changeset: patch on e2e.

One call to check: a text download the ledger scanned but did not change is labelled complete, not incomplete, matching what a trace text entry claims after the same scan. If the label should say "unchanged" instead, redactDownload in artifacts.ts is the one place to flip.


Devin Review