Repository navigation
fix(server): keep request telemetry anonymous and exclude sensitive payloads - #128
Conversation
Remove request and response payloads, caller identities, and analytics-only database and Redis lookups. Keep endpoint counts, error rates, and latency available without person profiles. Refs: LVT-334
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🚅 Deployed to the lovat-pr-128 environment in lovat
1 service not affected by this PR
|
Lovat AI reviewStatus: completed · Model: Reviewed commit: Critical: 0 · High: 0 · Medium: 0 · Low: 0 Overall assessmentThe rewrite replaces identity-based telemetry with an anonymous allowlisted schema, removes payload capture, person lookups, aliasing, and Redis/Prisma dependencies, and documents the historical-data remediation that remains for the PostHog administrator. The route allowlist correctly falls back to 'unmatched' for parameterized or unwound mounts, request IDs are server-generated, cache values are validated against an allowlist, and capture failures are contained without leaking details. Tests cover the sensitive paths including dynamic mounts, error unwinding, and SDK failures. No concrete defect is evidenced in the changed code. No high-confidence issues were found in the reviewed changes. Review details
Limitations
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d658c3d87
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const route = | ||
| typeof routePath === "string" && telemetryMounts.has(req.baseUrl) | ||
| ? `${mount}${routePath}` |
There was a problem hiding this comment.
Keep unwound dynamic mounts unmatched
When a handler under a parameterized or otherwise unallowlisted mount throws and the outer error handler finishes the response, Express restores req.baseUrl to "" while retaining req.route.path—the same unwind behavior used by the new failure test. Because "" is in telemetryMounts, this condition then emits the leaf pattern (for example, /reports/:uuid) instead of unmatched, contrary to the documented rule for dynamic mounts and incorrectly combining failures from unrelated routers into one endpoint group. Track whether the matched mount itself was allowlisted rather than treating an unwound empty baseUrl as proof that it was safe.
Useful? React with 👍 / 👎.
📱 Connect your app to this PR deploymentScan a QR code to use this PR's Server API. Worker changes use the same API; Server URL: |
Exercise the OTHER method bucket so request telemetry meets the required branch coverage threshold. Refs: LVT-334
Refs: LVT-334
…erver-redact-request-analytics-and
Refs: LVT-334
What changed
Server request analytics previously sent bodies, full URLs, IPs and caller identities to PostHog. This replaces them with an anonymous allowlist of route patterns, status, latency, cache state and deployment metadata. PostgreSQL/Redis identity lookups and device aliases are removed.
Adds 14 HTTP regression tests for secret exclusion, safe route/method grouping, dependency-free telemetry and capture failures. Documents chart migration and the historical-data/access review still required for LVT-334. That operational review remains open.
Areas affected
Contracts and data
PostHog charts must use
routeinstead ofpath/$pathname; person breakdowns are removed. Counts now include anonymous callers and polling responses.Verification
From
apps/server, using Node 22.20.0:npm run build,npm run typecheck,npm run typecheck:test— passed.DATABASE_URL=postgresql://lovat_test:lovat_test@127.0.0.1:5432/lovat_test npm run test:coverage:unit— 73 files, 1,458 tests passed; 100% statements, branches, functions and lines for every source file. One earlier coverage attempt hit an ECONNRESET in the unchanged Slack challenge test; the full rerun passed.npm run lint— passed with 79 existing warnings../node_modules/.bin/prettier --check src/lib/middleware/posthogMiddleware.ts test/posthogReporter.unit.test.ts README.md docs/request-telemetry.md— passed.From repository root:
./scripts/check-structure.shandgit diff --checkpassed.A clean dependency install ran out of disk space. Verification reused installed dependencies with identical Server/DB lockfiles and regenerated the database client in this worktree. No production or database-backed integration tests were run.
Deployment
No hosting, environment-variable or migration changes. New request events change when deployed; historical PostHog data and live access/retention settings still require the documented administrator review. Railway automatically built the PR preview; no production settings were changed.
Review follow-up
Express can clear a router’s mount while propagating an error. When the mount is unknown, telemetry now uses
unmatched. Added coverage for root routes, unwound static and dynamic mounts, and rejected background tasks. The 40 focused tests and required Monorepo CI run passed atc961770f.The Lovat PostHog project reports a 12-month default without an explicit project or organization override. The connector doesn’t expose project access-control metadata. The historical payload review remains open.