Skip to content

Telemetry backend only accepts writes through its own endpoint, and tests stop sending to it (GST-3234) - #4537

Merged
capy-ai[bot] merged 6 commits into
mainfrom
telemetry-data-fixes-and-lockdown
Nov 19, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
telemetry-data-fixes-and-lockdown

Conversation

@garrytan

@garrytan garrytan commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

The telemetry backend now takes writes only through its validated endpoint, signed-in Supabase users can read or write nothing, and gstack's tests can no longer send telemetry to the live project.
Why: a signed-in prober read two views on 2026-11-19, probes wrote about 2,000 junk rows through the open insert policy, and 41% of all skill-run rows were test-suite traffic.
Nothing changes for users until the migrations and edge functions are deployed; the deploy order is under Deploy.

What changed
  • Lockdown (005, 008): migration 005 mirrors the 2026-11-19 live revoke from authenticated and makes both old views security_invoker. Migration 008 drops the anon insert and update policies and revokes everything from anon, and telemetry-ingest switches to the service role key, so the edge functions become the only write path. Clients older than v0.11.16.0 (March 2026) stop landing: 245 events from 23 installs and 163 update checks in the last 30 days.
  • Tests never reach the live project: test-setup.ts sets GSTACK_TEST_BLOCK_LIVE_TELEMETRY, and supabase/config.sh then yields no endpoint. test/state-root-one-variable.test.ts, which was still leaking (20,054 rows), now uses a fixture endpoint. The new tripwire is test/telemetry-no-live-endpoint.test.ts.
  • Real use separated from test traffic (006): a source column that ingest now stores, a telemetry_live_events view (live source, real version, gstack-shaped session id), crash_clusters rebuilt on it, and community_pulse_summary(). community-pulse now counts every live row of the week in SQL instead of the first 1,000, and its weekly_active is distinct community-tier installs rather than update-check rows.
  • Ingest: keeps source and accepts attack_attempt with validated prompt-injection fields (migration 004, now idempotent, was never applied live). The funnel events were already allowed in the repo; the live function predates that.
  • 007: drops seven unused installations columns that no migration defined (email, user_id, snapshots, backups). It refuses if any row holds a value; on 2026-11-19 all 37,566 rows were empty.
  • verify-rls.sh: checks that the public key and a signed-in user (a JWT given, or minted from SUPABASE_JWT_SECRET) are denied every read, insert, update and the pulse function. It writes nothing.
Deploy (out of scope here)
  1. Apply 004, 005, 006 and 007. 006 builds an index on about 1.8M rows, which takes seconds.
  2. Deploy telemetry-ingest and community-pulse.
  3. Before 008, confirm that one ingest event lands in telemetry_events and updates its install, that an update-check ping lands in update_checks, and that community-pulse returns weekly_update_checks.
  4. Apply 008. Running it before step 2 refuses every new event. To undo it, re-grant anon's table privileges and recreate the policies it drops (created in 001 and 003).
  5. Run bash supabase/verify-rls.sh with SUPABASE_JWT_SECRET set.

Undo 008 (incident only)

BEGIN;
GRANT INSERT ON telemetry_events, installations, update_checks TO anon;
GRANT UPDATE (last_seen, gstack_version, os) ON installations TO anon;  -- 003's column-only grant
CREATE POLICY "anon_insert_only" ON telemetry_events FOR INSERT WITH CHECK (true);  -- from 001
CREATE POLICY "anon_insert_only" ON installations FOR INSERT WITH CHECK (true);     -- from 001
CREATE POLICY "anon_insert_only" ON update_checks FOR INSERT WITH CHECK (true);     -- from 001
CREATE POLICY "anon_update_tracking" ON installations FOR UPDATE USING (true) WITH CHECK (true);  -- from 003
COMMIT;

Before 008, legacy clients' installations updates and upserts already matched no rows, because 002 removed anon's SELECT policy. Only the inserts hold data.

Agent notes

Thread GSTA-661, issue GST-3234. Findings: drive reports/GSTA-661-telemetry-findings.md. Migrations 001-008 were applied to a local postgres:15 container with Supabase-like roles: anon and authenticated end with no table privilege, only service_role can execute the function, the views are security_invoker, 007 refuses when a column holds a value, and 004 and 006 re-run cleanly.

Approvals

Approved: yes (record r-815539a71632). The full approval record stays private.
Plan: exempt: bug fix (kind fix, R65); failing-first test test/telemetry-no-live-endpoint.test.ts fails on main
Plan check: exempt bug fix

Pre-Landing Review: 9 issues across two rounds and one granted fix-check. Auto-fixed: 2 (pass 1: 008 deploy order and the 245-events-from-23-installs count). Fixed in the fix-check: 1 (008's undo instruction, p2/outside-voice#3). Skipped below the floor: 2 (006 index without CONCURRENTLY; no unit test for normalizeSource and securityFields). Ruled notes: 4 second-model findings in careful/bin/check-careful.sh (base-merge code from ab6a38b, #4534). Noted: the fix-check's wording note on 008's undo line, and 6 notes on base-merge careful code.
REVIEW_LOOP: passes=2 blocking_found=5 deferred=0 noted=7 fixed=3 scope=frozen open=5 ledgers_read=4 fix_checks=1 dispatches=12
Gate edits: none detected (3 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Second-model review: openai/gpt-6.2-sol (reasoning high), completed.

Ruled notes

Ruled note: careful/bin/check-careful.sh:823:adversarial at 953c628 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-19) at 2026-11-19T20:18:36.160Z: base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner (approval a-36c21faafff2)
Ruled note: careful/bin/check-careful.sh:833:adversarial at 953c628 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-19) at 2026-11-19T20:18:36.300Z: base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner (approval a-333e4ad8cfce)
Ruled note: careful/bin/check-careful.sh:809:adversarial at 953c628 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-19) at 2026-11-19T20:18:36.433Z: base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner (approval a-fba1903690b2)
Ruled note: careful/bin/check-careful.sh:465:adversarial at 953c628 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-19) at 2026-11-19T20:18:36.613Z: base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner (approval a-ecc76219a198)
Ruled note: supabase/migrations/008_close_anon_writes.sql:16:adversarial at 953c628 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-19) at 2026-11-19T20:25:07.182Z: fixed in d95650c; the granted fix-check read the fix; its review-log row omitted the finding (approval a-2b40714d216b)

Documentation

Status: current. I audited the telemetry lockdown branch's docs and found no factual corrections to make.

Scope: base ab6a38b to head d95650c, 15 files: Supabase migrations 004-008, the telemetry-ingest and community-pulse edge functions, verify-rls.sh, config.sh, test-setup.ts, two new tests, docs/privacy.md and a changelog.d fragment. The working tree was clean. I searched every tracked doc and template for telemetry, Supabase and RLS references.

Documentation health:

  • docs/privacy.md: current. It matches the new write path, the live-or-test flag and the prompt-injection fields.
  • ARCHITECTURE.md: current. The community-pulse security aggregation is still accurate.
  • changelog.d/telemetry-data-fixes-and-lockdown.md: current. I read it and did not edit it.

Coverage debt:

  • Common gap: the deploy order for migrations 004-008 and the edge functions is documented only in the header of 008_close_anon_writes.sql. No operator doc covers it.
  • Common gap: verify-rls.sh's pass-only-on-permission-denial behaviour is described only in the script.
  • Common gap: the GSTACK_TEST_BLOCK_LIVE_TELEMETRY test switch is documented only in code comments (test-setup.ts, supabase/config.sh).

Diagram drift: none.

Open in Capy

{
  "schema_version": 1,
  "pr": 4537,
  "head": "d95650c89ff3931681b3a0c48f6c4c3e115e8a34",
  "version": "1.102.0.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1714,
      "fail": 0,
      "skip": 0
    },
    "targeted": {
      "pass": 19,
      "fail": 0,
      "skip": 0
    },
    "typecheck": {
      "pass": 1,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 44604813619,
      "attempt": 1,
      "tree": "1ec010ad434ba15937810127ca50001cb9824773"
    }
  ],
  "calls": 29,
  "session_kind": "unattended",
  "run": "ship-4537",
  "head_tree": "1ec010ad434ba15937810127ca50001cb9824773",
  "product_patch_id": "017e8f231c31b02356131454f1485ab65197f272",
  "gstack_version": "1.102.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 743,
    "rules": "1afa38a4be3b5eef",
    "base": "ab6a38b76753a3aebf948781ca065745ab1213da",
    "registry": "ab6a38b76753a3aebf948781ca065745ab1213da",
    "gate_scan": {
      "tagged": 0,
      "head": "d95650c89ff3931681b3a0c48f6c4c3e115e8a34"
    },
    "reasons": [
      "gate-class",
      "risk:auth",
      "risk:secret",
      "risk:data",
      "runtime=743"
    ],
    "risk": [
      "auth",
      "secret",
      "data"
    ],
    "mode": "panel"
  },
  "pregate": "pass @1ec010ad434b (8 checks, current for d95650c89ff3)",
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md (privacy.md and ARCHITECTURE.md read against the diff)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 5,
    "deferred": 0,
    "noted": 7,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "ledgers_read": 4,
    "dispatches": {
      "specialist": 10,
      "red-team": 2
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "953c628d1069ceb975d0de1c2f9c0b4c440286ce",
      "pr": 4537,
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "008 rollback comment and deploy step 4 name the wrong migration and omit the grants; comment and PR-body fix only, SQL unchanged",
      "at": "2026-11-19T20:03:01.709Z",
      "approval": "a-21f70e3bc74e",
      "stop_run": "ship-4537",
      "findings": [
        "p2/outside-voice#3"
      ]
    }
  ],
  "ruled_notes": [
    {
      "finding": "careful/bin/check-careful.sh:823:adversarial",
      "head": "953c628d1069ceb975d0de1c2f9c0b4c440286ce",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner",
      "at": "2026-11-19T20:18:36.160Z",
      "approval": "a-36c21faafff2",
      "relayed": "GSTA-36:2026-11-19"
    },
    {
      "finding": "careful/bin/check-careful.sh:833:adversarial",
      "head": "953c628d1069ceb975d0de1c2f9c0b4c440286ce",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner",
      "at": "2026-11-19T20:18:36.300Z",
      "approval": "a-333e4ad8cfce",
      "relayed": "GSTA-36:2026-11-19"
    },
    {
      "finding": "careful/bin/check-careful.sh:809:adversarial",
      "head": "953c628d1069ceb975d0de1c2f9c0b4c440286ce",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner",
      "at": "2026-11-19T20:18:36.433Z",
      "approval": "a-fba1903690b2",
      "relayed": "GSTA-36:2026-11-19"
    },
    {
      "finding": "careful/bin/check-careful.sh:465:adversarial",
      "head": "953c628d1069ceb975d0de1c2f9c0b4c440286ce",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "base-merge code from ab6a38b (#4534), byte-identical to main; deferred to careful's owner",
      "at": "2026-11-19T20:18:36.613Z",
      "approval": "a-ecc76219a198",
      "relayed": "GSTA-36:2026-11-19"
    },
    {
      "finding": "supabase/migrations/008_close_anon_writes.sql:16:adversarial",
      "head": "953c628d1069ceb975d0de1c2f9c0b4c440286ce",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "fixed in d95650c; the granted fix-check read the fix; its review-log row omitted the finding",
      "at": "2026-11-19T20:25:07.182Z",
      "approval": "a-2b40714d216b",
      "relayed": "GSTA-36:2026-11-19"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "auth",
      "secret"
    ],
    "rules": "23eb808423669ba0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "017e8f231c31b02356131454f1485ab65197f272",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}
{"head":"953c628d1069ceb975d0de1c2f9c0b4c440286ce","run":"ship-4537","mark":"stop","tree":"2cc6b9f1d4ce4a9b44702eb5ed76a72a265b1959"}

…ests stop sending to it (GST-3234)

Lock the telemetry tables to the edge functions, keep signed-in users out, separate live use from test traffic, and stop the test suite from posting to the live project.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 5 commits November 19, 2026 19:18
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ops, community-pulse ignores old cache

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: supabase/migrations/008_close_anon_writes.sql:9:published-number reader=core
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p2/outside-voice#3 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 12cc218 into main Nov 19, 2026
54 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 20, 2026
- Two /ship approval records stop needing workarounds. (#4549)
- For contributors: the paid auto-decide check counts a start step that ran while the skill loaded. (#4543)
- The destructive-command check closes three ways past its disk-wipe and force-push blocks. (#4534)
- A green CI run still counts when the repository's artifact storage is full. (#4536)
- `/cso` now audits repositories that track symlinks. (#4567)
- A doc-sync eval stops failing when the audit child drops one field from its result line. (#4555)
- The browse daemon no longer picks port 10080, which Chromium refuses to open. (#4554)
- Opted-in telemetry now says why a skill run ended, which coding agent and model family ran it, and whether an upgrade worked. (#4542)
- A preregistration with only its write-up and plain data now gets the write-up review: one reviewer, one round. (#4544)
- When owner rulings don't clear a stopped review, `gstack-review-read` now says which findings are left. (#4553)
- The prompt-routing hook now names your installed bug-fix skill on bug reports, alone, and never puts /verify ahead of it. (#4539)
- Owner rulings now close a stopped review whose findings were logged in a findings file. (#4568)
- /ship can finish after the owner accepts a stopped review's findings as open notes. (#4552)
- /ship no longer starts the full test suite on your machine when CI's earlier run can't be reused (GST-3277). (#4565)
- The prompt-routing hook no longer acts on words inside backticks. (#4566)
- In Claude Code, a gstack skill's start step now runs when the skill loads, so the model can't skip it. (#4509)
- gstack's telemetry backend only accepts writes through its own validated endpoint, and the community dashboard now counts real use. (#4537)
- gstack now says what it's adding before it adds a background job or a browser extension. (#4538)
- For contributors: every flaky pass in Free Tests is now recorded. (#4572)
- For contributors: Free Tests on pull requests starts its test shards one round of small jobs sooner. (#4570)
- Secret values written as `name=value` at the end of a path are now hidden. (#4571)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@AlpianPPLG AlpianPPLG left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

capy-ai Bot added a commit that referenced this pull request Nov 22, 2026
… findings it fixed (GST-3260) (#4664)

/ship now closes a review finding when its fix round was granted and a
follow-up check read the fix clean, or when the fix commit names the
finding and a later full review reads it clean. Before, someone had to
write a ruling by hand.

Why: since this was missing, PRs whose findings were already fixed and
checked stalled at the round limit (#4537, harness-evals#508, #4597,
harness-evals#504, #4612).

Nothing to do.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
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.

2 participants