Skip to content

feat(mask): a CSV masking page for handoff to AI tools (#10) - #12

Merged
imgul merged 1 commit into
mainfrom
arena/19ad0ea6-env-compare
Oct 20, 2026
Merged

imgul merged 1 commit into
mainfrom
arena/19ad0ea6-env-compare

Conversation

@imgul

@imgul imgul commented Oct 20, 2026

Copy link
Copy Markdown
Member

Closes #10.

The compare tool answers "what is missing from my .env". This answers the neighbouring question: how do I let a model read the shape of a configuration without reading the secrets in it? Same promise, second surface — /mask is a real page load like /privacy, sharing the header, the tokens and the privacy guard.

The pipeline

Three pure modules, no new runtime dependencies:

  • src/core/csv reads RFC 4180 plus the lenient parts everyone relies on — BOM, CRLF, quoted commas and newlines, "" escapes — and reports what it cannot parse (ragged rows, an unterminated quote) rather than dropping it. The writer keeps the source's delimiter, line ending and quoting rules, so the file can go back into the tool it came from.
  • src/core/mask applies per-column and per-key modes: hide completely, mask the start, the middle, the end. Same input masks to the same output, so duplicate secrets still line up after masking.
  • src/state/maskReducer holds the originals; the export is always derived. Nothing is destructive, and a reload loses the file — as advertised.

Decisions

  • Formatting, not encryption, and the page says so in as many words. A mask that claims more is a lie someone might rely on.
  • hide also hides the length; the other modes keep a prefix or suffix and are labelled by what stays visible.
  • A value too short to keep anything is hidden whole, rather than "masked" by revealing all of it.
  • Duplicates are reported in the preview, not encoded into the mask — a hash suffix would let anyone who can guess a secret confirm the guess.
  • The preview is the export: one maskCsv → maskedText path, and Show the exact output prints the literal text the copy button writes.

Defaults follow the product's usual asymmetry — detection may only ever add masking. The key column is found by header name; value columns from header names, then value shapes, then the rightmost column of a key,value file, and they arrive masked. Two warnings run against that: an open column whose values look like credentials (or whose name does), and a key column that has itself been masked.

Scope

This was the one place the issue could have diluted the product, so it was held to the constitution rather than bent around it: PRD §4.3 gained a paragraph stating /mask is not an exception to any non-goal, and §8.6 gained US-24 with the acceptance criteria as testable statements.

Verification

  • npm run check — 455 tests / 25 files, tsc clean, build ✓, privacy guard ✓
  • 40 new unit tests: CSV reader/writer round-trips, every mask mode, short-value behaviour, duplicate tracking, warning conditions, purity, and CSV validity of the output
  • 13 component tests walking the acceptance criteria: default masking, per-column and per-key modes, reveal-and-restore, duplicate marker, warnings, copy, exact output, start over
  • e2e/mask.spec.ts asserts what unit tests cannot: filling, masking and copying makes no request and writes nothing to storage
  • Suite grew 402 → 455, so the generated tests badge and README line moved with it

Closes #10.

The compare tool answers "what is missing from my .env". This answers the
neighbouring question: how do I let a model read the shape of a configuration
without reading the secrets in it? Same promise, second surface — /mask is a
real page load like /privacy, sharing the header, the tokens and the guard.

The pipeline is three pure modules:

- src/core/csv reads RFC 4180 plus the lenient parts everyone relies on —
  BOM, CRLF, quoted commas and newlines, "" escapes — and reports what it
  cannot parse (ragged rows, an unterminated quote) instead of dropping it.
  The writer keeps the source's delimiter, line ending and quoting rules.
- src/core/mask applies per-column and per-key modes: hide completely, mask
  the start, the middle or the end. Same input, same output, so duplicate
  secrets still line up after masking.
- src/state/maskReducer holds the originals; the export is always derived,
  so nothing is destructive and reloading loses the file, as advertised.

Five decisions:

- Formatting, not encryption, and the page says so. A mask that claims more
  is a lie someone may rely on.
- hide also hides the length; the other modes keep a prefix or suffix and
  are labelled by what stays visible.
- A value too short to keep anything is hidden whole, rather than "masked"
  by revealing all of it.
- Duplicates are reported in the preview, not encoded into the mask: a hash
  suffix would let anyone who can guess a secret confirm the guess.
- The preview is the export — one maskCsv -> maskedText path, with the exact
  output text available before copying.

Defaults follow the product's asymmetry: detection may only add masking.
The key column is detected by header name, value columns by header name,
value shape, or the rightmost column of a key,value file, and arrive masked.
Warnings cover an open column that looks like credentials and a key column
that has itself been masked.

PRD §4.3 gained a paragraph stating /mask is not an exception to any
non-goal, and §8.6 gained US-24 with the acceptance criteria as testable
statements.

Tests: 455 (25 files), up from 402. 15 CSV, 25 masking, 13 component tests
walking the acceptance criteria, plus e2e/mask.spec.ts asserting that masking
and copying make no request and write nothing to storage.
@imgul
imgul merged commit 28d3e17 into main Oct 20, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CSV masking tool to hide or obfuscate sensitive env values before AI sharing

1 participant