Skip to content

docs(web): fix stale '/api/add does not invoke privacy.scan' comments#786

Merged
memtomem merged 1 commit intomainfrom
fix/web-add-privacy-scan-stale-comment
May 5, 2026
Merged

docs(web): fix stale '/api/add does not invoke privacy.scan' comments#786
memtomem merged 1 commit intomainfrom
fix/web-add-privacy-scan-stale-comment

Conversation

@memtomem
Copy link
Copy Markdown
Owner

@memtomem memtomem commented May 5, 2026

Summary

Fix two stale comment blocks around the Add Memory submit handler in web/static/app.js that claimed POST /api/add did not invoke privacy.scan. That has not been true since the trust-boundary write guard was wired to the web add path — web/routes/system.py:1203 calls privacy.enforce_write_guard(), which scans server-side and rejects on hit.

Updated both blocks to describe the current invariant:

  • Server /api/add is the trust boundary via enforce_write_guard.
  • Client-side regex is defense-in-depth — a UX-time warning before submit so a flagged paste doesn't have to round-trip.
  • The scan-window asymmetry note is reframed factually: client scans the full textarea, server caps at _SCAN_WINDOW (10K), so the client is the more permissive side (warns on more positions); the server stays the source of truth.

Context

Discovered while spot-checking docs/reports/security-hardening-plan-2026-05-05.md against the source — the plan's claim that /api/add was missing the redaction guard was already-fixed code, but the JS comment had drifted in the same direction and gave a false read of the trust model. Comment-only change; no behavior, no API, no test surface impact.

Per feedback_deictic_pr_references.md — exactly the kind of "today moot" / "if X ever lands" prose that rots after the gate actually lands.

Test plan

  • Diff is comments-only inside // ... blocks
  • Static-asset cache-bust ?v=N in index.html unchanged (no JS body changes that downstream cache would need to bust)
  • No i18n string keys touched
  • CI green

🤖 Generated with Claude Code

… in app.js

The two comment blocks around the Add Memory submit handler claimed that
``/api/add`` did not invoke ``privacy.scan`` — describing the client-side
regex check as the only gate. That has not been true since the trust-
boundary write guard was wired to the web add path: ``POST /api/add``
calls ``privacy.enforce_write_guard()`` at ``web/routes/system.py:1203``
(which scans server-side via ``privacy.scan()`` and rejects on hit).

Update both comment blocks to reflect the current invariant:

- The server route is the trust boundary, via ``enforce_write_guard``.
- The client-side regex is defense-in-depth: a UX-time warning before
  submit so a flagged paste does not have to round-trip.
- The scan-window asymmetry note is reframed: the client scans the
  entire textarea while the server caps at ``_SCAN_WINDOW`` (10K), so
  the client is the more permissive side (warns on more positions);
  the server remains the source of truth.

Comment-only change. No behavior change, no lint impact (ruff does not
cover JS), and the file's i18n / static-asset cache-bust keys are
untouched.

Co-Authored-By: Claude <[email protected]>
@memtomem memtomem merged commit 56853e1 into main May 5, 2026
11 checks passed
@memtomem memtomem deleted the fix/web-add-privacy-scan-stale-comment branch May 5, 2026 00:22
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants