8000 V0-18: Harden privacy gates and build the macOS artifact by kiran-brahma · Pull Request #38 · kiran-brahma/nodepad-app · GitHub
[go: up one dir, main page]

Skip to content

V0-18: Harden privacy gates and build the macOS artifact - #38

Merged
kiran-brahma merged 2 commits into
mainfrom
claude/github-issue-19-d42374
Jul 24, 2026
Merged

kiran-brahma merged 2 commits into
mainfrom
claude/github-issue-19-d42374

Conversation

@kiran-brahma
Copy link
Copy Markdown
Owner

Closes #19.

Hardens the integrated V0, proves its privacy guarantees with tests rather than prose, and produces a launchable Apple Silicon artifact.

The two things worth reviewing carefully

The release gate did not exist. npm run check never ran cargo fmt or cargo clippy. Both had been failing unobserved for the whole of V0 — one rustfmt diff and 11 clippy errors, including a genuinely dead read_preference. The issue treats "all gates pass without ignored errors" as the ship condition, so the gate is now one command and every failure is fixed.

A real secret leak, found in review. SecurityCliKeychain::write passed the Ollama Cloud bearer key as security add-generic-password … -w <value>, putting the secret in the process's argv where ps exposes it to any local process for the duration of the call. The module's own doc comment had claimed the opposite — "passed through stdin … so it never appears in the process's command line" — since the seam was written. The key now goes to the child's stdin (verified round-tripping against the real macOS keychain), and secrets::process_argument_audit fails the build if it ever returns to the command line.

Audits that can actually fail

The pre-existing no_durable_state_carries_a_sentinel_bearer_key was a name without a body: it looped over a one-element array collecting a Workspace UUID and an RFC3339 timestamp, neither of which could ever carry a bearer key.

The first replacement I wrote had the same defect in subtler form — it read the bytes of every prohibited artifact, but nothing ever planted the sentinel, so every assertion was vacuous. The shipped version puts the sentinel in the keychain the production Cloud path reads, drives a real discover_models call, and proves via a recording client that the key reached the bearer header — then scans the SQLite file and its WAL, a backup, an archive, a Markdown export, the UI snapshot, the discovery outcome, the recorded keychain calls, and an error message. A positive control makes it fail loudly rather than vacuously.

release_audit.rs adds the network audit: an explicit outbound-host allowlist, forbidden markers for analytics/error-reporting/updaters/non-Ollama providers, a webview no-network-call check, a CSP check, a registered-plugin check, a scan of the built dist/ bundle, and an audit pinning the one shipped development URL to loopback. Plus the clean-app-data end-to-end smoke.

Each audit was mutation-tested: a planted rogue host and a planted leak both fail it.

Scope corrections (owner-approved)

The unshipped Next.js prototype carried a Umami analytics script and a public CORS proxy route, both contradicting this issue's own privacy decisions. Both removed. lib/ai-settings.ts (OpenRouter/OpenAI/z.ai) and the YouTube components are retained on purpose for follow-up work, and the release notes state plainly that the prototype is not compiled, bundled, or shipped.

Artifact

Nodepad.app + Nodepad_0.1.0_aarch64.dmg, arm64, icon and DMG target fixed (the bundle previously shipped neither). Verified interactively against empty app data: seeds one Workspace, takes an automatic backup, and after two quit/relaunch cycles keeps the same Workspace id with no re-seed. Live database, backups, and the bundle scan clean for secrets and dev URLs; no keychain entry is created without consent.

Unsigned and un-notarized — ad-hoc linker signature only, because no signing credentials exist. docs/v0/release-notes.md documents the exact commands and required secrets without fabricating them.

Gate

npm run check — TypeScript, eslint, 153 Vitest tests, cargo fmt --check, cargo clippy -D warnings, 190 Rust tests, production build, packaging smoke. Green.

fallow scoped to this slice: every finding is introduced: false (pre-existing prototype dependencies), so zero in-scope findings.

Audit and its post-implementation addendum: docs/audits/issue-19-simplicity-audit.md.

🤖 Generated with Claude Code

kiran-brahma and others added 2 commits July 24, 2026 09:08
Repairs the release gate, adds the two release audits the issue requires,
and produces the Apple Silicon artifact.

The gate did not exist as a runnable command: `npm run check` never ran
`cargo fmt` or `cargo clippy`, and both had been failing unobserved for the
whole of V0 (one rustfmt diff, eleven clippy errors). Both are wired into
`check` and every failure is fixed, including a genuinely dead
`read_preference`.

The existing sentinel test asserted far less than its name claimed: it looped
over a one-element array collecting only a Workspace UUID and an RFC3339
timestamp, neither of which could ever carry a bearer key. It is replaced with
an audit that reads the raw bytes of the SQLite file and its write-ahead log,
a backup, an exported archive, a Markdown export, the UI snapshot, and an
error message. It carries a positive control so it fails loudly rather than
passing vacuously if the scan stops reading those bytes.

`release_audit.rs` adds the network audit: an explicit outbound-host allowlist,
forbidden markers for analytics/error-reporting/updaters/non-Ollama providers,
a check that the webview opens no connection of its own, a CSP check, and a
registered-plugin check. It also carries the clean-app-data end-to-end smoke.

Removes the Umami analytics script and the public CORS proxy route from the
unshipped Next prototype; both contradicted the release's stated privacy
decisions. The prototype's provider config and video components are retained
as source material for follow-up work.

Fixes the bundle config, which shipped no DMG and no icon.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fixes a real secret leak and removes two ways the new audits could pass
without proving anything.

`SecurityCliKeychain::write` passed the Ollama Cloud bearer key as
`security add-generic-password ... -w <value>`, putting the secret in this
process's argv where `ps` exposes it to any local process for the duration of
the call. The module's own doc comment had claimed the opposite since the seam
was written. The value now goes to the child's stdin, and
`secrets::process_argument_audit` fails the build if it returns to the command
line. Verified against the real macOS keychain: the write round-trips.

The replacement sentinel audit repeated, in subtler form, the defect it was
written to fix: it scanned every prohibited artifact for a value that nothing
in the test ever planted, so every assertion was vacuous. It now puts the
sentinel in the keychain the production Cloud path reads, drives a real
discover_models call, and proves through a recording client that the key
reached the bearer header before asserting it reached no durable byte. It moves
to release_audit.rs, so both release audits live in one module as the
simplicity audit promised.

The allowlist scan exempted any line containing `assert!` or `assert_eq!` --
wide enough to hide a provider behind a single assertion. Exemptions are now
declared in TEST_FIXTURE_ORIGINS where they are visible, and only comments are
skipped.

Adds the built-artifact scan the issue asked for: minification and a
dependency's runtime can put a string in dist/ that appears in no source file.
Each exempted origin was checked by hand against the bundle. Adds an audit
pinning the one development URL that ships to a loopback address, disclosed
rather than allowlisted away.

Extracts the three duplicated scan loops into one `scan` helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

V0-18: Harden privacy gates and build the macOS artifact

1 participant

0