Skip to content

fix(privacy): DO_NOT_TRACK stops every request to a vendor-operated host (#4499) - #4504

Merged
dolho merged 1 commit into
devfrom
fix/4499-vendor-egress-switch
Nov 13, 2026
Merged

dolho merged 1 commit into
devfrom
fix/4499-vendor-egress-switch

Conversation

@dolho

@dolho dolho commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary

DO_NOT_TRACK=1 is documented as the opt-out for air-gapped and privacy-strict installs, but it covered two outbound channels out of five. The help widget's Ask tab and the ask_trinity MCP tool had no switch at all, and the report switch was a frontend build argument: inert on the published images, and never passed by docker-compose.yml. Reproduced on v1.0.5-rc2 (issue comment).

After this PR one run-time setting stops every request to a vendor-operated host, with no rebuild.

Changes

  • src/backend/config.py: BUG_REPORTING_ENABLED and ASK_TRINITY_ENABLED, read at run time, both off under DO_NOT_TRACK (same truthiness as OPERATOR_INTAKE_ENABLED / DO_NOT_TRACK privacy kill switch is inert (not forwarded by compose) #1486).
  • src/backend/main.py: GET /api/version carries them as help: {docs_qa, bug_reporting}.
  • HelpChatWidget.vue: tabs follow help. A channel shows only for a literal true, so the widget fails closed: nothing before the answer, on a failed read, or on a backend that sends no help. With both off it is not rendered. The build-time VITE_BUG_REPORTING_ENABLED can still turn reporting off and can no longer turn it on.
  • src/mcp-server/src/tools/docs.ts: ask_trinity is not registered when switched off, so it is absent from every listing and cannot be called.
  • render-nginx.sh, nginx-server.conf: the served security-headers.conf is written at container start without the host of a channel that is off. Only two fixed strings are removed; no environment value is written into the configuration.
  • Compose (all three files): the switches reach the backend, the MCP server and the nginx frontend.
  • Docs: .env.example, the single-server guide, the security FAQ (which said there were "exactly two outbound paths"), the architecture notes and the helper-mcp README.

Behaviour change to know about

A new frontend against an older backend (no help in /api/version), or a failed /api/version read, hides the help widget. That is the fail-closed direction and is deliberate.

Test plan

  • tests/unit/test_4499_vendor_egress_switch.py: the switch matrix, the help keys, compose wiring per service, the rendered policy (including a hostile switch value), and a census that fails when a vendor-operated host appears in the source without a switch DO_NOT_TRACK also turns off
  • src/mcp-server: ask_trinity_switch.test.ts; full suite 1425 passed; tsc --noEmit clean
  • src/frontend: helpWidgetVendorSwitch4499.mount.spec.js; the two specs that mount the widget; the raw-colour and loading-gate ratchets
  • 63 unit files that read the compose files, .env.example, the nginx configuration or the user docs: 2468 passed
  • The production frontend image built from this branch and run four ways as uid 101: no switch (both hosts in connect-src), DO_NOT_TRACK=1 (neither), each single switch (only its own host gone)
  • Left to CI: the full Python unit island and the e2e run
  • Not run: the whole stack from this branch in a browser

One existing spec is edited: helpWidgetChatTab.mount.spec.js now supplies the flags in its setup. No assertion changed.

Fixes #4499

🤖 Generated with Claude Code

…ost (#4499)

DO_NOT_TRACK was documented as the opt-out for air-gapped and privacy-strict
installs but covered two channels out of five. The help widget's Ask tab and
the ask_trinity MCP tool had no switch, and the report switch was a frontend
build argument: inert on the published images, and never passed by
docker-compose.yml.

- config: BUG_REPORTING_ENABLED and ASK_TRINITY_ENABLED, read at run time and
  both off under DO_NOT_TRACK.
- GET /api/version carries them as `help`. The help widget shows a channel only
  for a literal true, so it fails closed, and is not rendered with both off.
- mcp-server: ask_trinity is not registered when switched off.
- render-nginx.sh writes the served security headers without the host of a
  channel that is off. It removes two fixed strings and writes no environment
  value into the configuration.
- All three compose files pass the switches to the backend, the MCP server and
  the nginx frontend.
- A census test fails when a vendor-operated host appears in the source without
  a switch that DO_NOT_TRACK also turns off.

Fixes #4499

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@dolho dolho added the ui PR touches the frontend UI — triggers Playwright e2e tests label Nov 12, 2026
@dolho
dolho requested a review from obasilakis November 12, 2026 14:38

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/review + /validate-pr — #4504

Verdict: APPROVE. No blocking findings. Lane C (compose files), Tier 1 green, journey-smoke and both e2e runs green on the PR.

Scope / acceptance criteria (#4499)

AC Status
DO_NOT_TRACK=1 disables all five channels at run time, on published images too DONE: config.py (backend), docs.ts::askTrinityEnabled (MCP), render-nginx.sh (CSP), widget via /api/version → help
Widget reads switches at run time; tabs and widget hidden when off DONE: HelpChatWidget.vue visibleTabs / anyChannel, fails closed
ask_trinity has a real off switch, unlisted for every scope DONE: tool dropped from createDocsTools() before addAllTools
CSP connect-src drops both hosts when everything is off DONE: render-nginx.sh, all four includes point at the generated copy
Census test of hardcoded vendor hosts DONE, with a limit (I2)
.env.example + user docs state what is and is not covered DONE: .env.example, single-server.md, faq/security.md

Execution coverage

symbol executed by live consumer verdict
config.BUG_REPORTING_ENABLED / ASK_TRINITY_ENABLED TestTheSwitches (exec of real config.py) main.py::get_version ✅
payload["help"] test_the_handler_sends_both_switches_as_help (AST) HelpChatWidget.vue 🛡 shape guard; widget side executed by the mount spec
askTrinityEnabled / createDocsTools(env) ask_trinity_switch.test.ts server.ts:662 ✅
render-nginx.sh CSP block TestTheServedPolicy runs the real script Dockerfile.prod entrypoint ✅
HelpChatWidget gating helpWidgetVendorSwitch4499.mount.spec.js (jsdom mount) App.vue:37 ✅

Mutation: dropping and not _DO_NOT_TRACK from config.py turns 12 tests red.

Informational (non-blocking)

  • I1: render-nginx.sh tests fail on macOS. sed -i "s|…||g" file is GNU/busybox syntax; BSD sed reads the next argument as the backup suffix, so 4 tests in TestTheServedPolicy fail locally on a Mac (sed: 1: "...": invalid command code v). Production (alpine) and CI (Linux) are fine. Portable fix: sed "s|…||g" "$f" > "$f.2" && mv "$f.2" "$f".
  • I2: the census matches only abilityai.dev and cloudfunctions.net. A new channel on another vendor domain passes it silently. Worth a one-line comment naming that limit, or widening the regex when the next domain shows up.
  • I3: two docs still describe the report switch as build-time. docs/user-docs/getting-started/help.md:87 ("disable the report tabs or repoint the intake URL at build time") and docs/memory/feature-flows/in-app-bug-reporting.md:64 (config knobs listed as build-time). Neither mentions BUG_REPORTING_ENABLED / ASK_TRINITY_ENABLED / DO_NOT_TRACK.
  • I4: DO_NOT_TRACK also turns off a self-hosted mirror. With ASK_TRINITY_ENDPOINT or VITE_BUG_INTAKE_URL pointed at an internal host, DO_NOT_TRACK=1 still removes the tool and the tabs. This matches the PR's stated contract. An operator who mirrors internally has to leave DO_NOT_TRACK unset and use the per-channel switches. Could be one line in .env.example.

Validation

  • Commit: conventional, descriptive. Base dev. 19 files.
  • Fixes #4499 present (P1, type-bug), so status auto-promotes on merge.
  • Security greps (keys, emails, IPs, host paths, file modes): clean. New env vars are wired into all three compose files and .env.example.
  • Architecture: architecture/security.md and architecture/mcp-server.md updated.

@dolho
dolho merged commit 61bc57a into dev Nov 13, 2026
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants