Repository navigation
fix(cli): Verify only on telemetry that matches the filters - #2430
Conversation
`local run --verify` passed on the first envelope of any kind, so an app that only called Sentry.init() verified from its session envelope, and `-f error` verified without any error. Count an envelope only when it holds an item the active filters show, through the same filter check the tail uses. With no filters, only telemetry counts: errors, transactions, spans, logs and replays, not sessions or client reports. Co-Authored-By: Aditya Mathur <57684218+MathurAditya724@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Treat every item type except session, sessions and client_report as telemetry for --verify, so check-ins, feedback, metrics and profiles verify a setup, and item types that SDKs add later count too. When only uncounted items arrived, the timeout and early-exit errors now say the SDK connected and what it sent, instead of "no events received" and the DSN and port hints, which don't apply then. Co-Authored-By: Aditya Mathur <57684218+MathurAditya724@users.noreply.github.com>
MathurAditya724
left a comment
There was a problem hiding this comment.
Independent real CLI testing found an actionable gap; see the inline reproduction and requested regression. Holding merge until it is addressed.
Envelope item types come from untrusted HTTP input. Run them through the same sanitize helper the Local tail uses before they reach the "SDK connected but sent only …" error, so ANSI/OSC escapes, control characters, BiDi controls and newlines can't reach the terminal.
|
The sanitization update is the right fix. A merge attempt against main after #2434 now conflicts in apps/cli-docs/src/content/docs/exit-codes.md and packages/cli/plugins/sentry-cli/skills/sentry-cli/references/local.md. Please rebase, preserving both the matching-telemetry verify text and the new timeout exit-124/help text. Source files merge cleanly; I am retesting the independent terminal-injection and CLI filter probes. A conflict-free updated head and its hosted checks are still required before merge. |
# Conflicts: # apps/cli-docs/src/content/docs/exit-codes.md # packages/cli/plugins/sentry-cli/skills/sentry-cli/references/local.md
MathurAditya724
left a comment
There was a problem hiding this comment.
Retested ebfe404 integrated with current main. The prior diagnostic injection finding is addressed with the shared sanitizer. Reviewed filter handling, AI child spans, housekeeping-only envelopes, timeout interaction, and rebased documentation.
Validation: full workspace tsc, lint and test passed (CLI 13,682 tests; MCP core 2,469; Cloudflare 476; Local 501). Independent real CLI subprocesses confirmed housekeeping and filtered-out deliveries fail verification, matching errors and AI child spans succeed, and ANSI/newline envelope types cannot forge terminal diagnostics. No remaining actionable findings.
The receiver accepted anything posted to it. An empty body or a body
whose first line isn't a JSON object got a 204 and took a retention
slot. An envelope whose event item wasn't JSON showed up as a fake error
in the tail and in `event list`.
Before:
```
POST /stream (empty body) -> 204, stored
POST /stream "{not json\n…" -> 204, stored
POST /stream '{}\n{"type":"event"}\nnot-json' -> 204, shows "[ERROR] Error: Unknown error"
```
After:
```
POST /stream (empty body) -> 400 {"error":"The envelope is empty."}, nothing stored
POST /stream "{not json\n…" -> 400 {"error":"The envelope header is not a JSON object."}, nothing stored
POST /stream '{}\n{"type":"event"}\nnot-json' -> accepted, shows "[INVALID] Event payload is not JSON"
```
Relay also answers 400 for the first two cases, and it accepts the last
one and drops it later. So the last case is still accepted here, but
it's labelled `invalid` (`"type":"invalid"` in JSON output) instead of
counting as an error. It still shows under `-f error`. A body that fails
to decompress now gets an `{"error": …}` reason too. Unknown item types
and items without `length` are still accepted. The size limits and the
other status codes stay the same.
`--verify` now checks each item. An invalid event never counts, and
neither do sessions or client reports. With `-f`, only items those
filters show count. Before, an invalid event sent next to a session was
enough to pass. This uses the same check as #2430, so whichever lands
second only has a small merge.
Possible follow-up: the hosted viewer labels events its own way, so it
may still show that last case as an error.
<!-- junior-request-attribution:start -->
via @MathurAditya724.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A994a746adac832d3b342d71d10e4428b -->
--
[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A994a746adac832d3b342d71d10e4428b)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A994a746adac832d3b342d71d10e4428b/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Aditya Mathur <57684218+MathurAditya724@users.noreply.github.com>
Co-authored-by: mathuraditya724 <mathuraditya724@gmail.com>
Co-authored-by: Codex (GPT-6) <noreply@openai.com>
sentry local run --verifypassed as soon as any envelope arrived. An app that only callsSentry.init({})can send a session envelope, so it "verified" even with-f errorand no error.Now verify waits for an item that the
-ffilters would show in the tail, using the same filter check. With no filters, any item counts except sessions and client reports, so cron check-ins, feedback, metrics and profiles verify too. If the SDK connected but only sent things that don't count, the error says so instead of "no events received". The timeout, exit code 64 and the hints otherwise stay the same.Before:
After:
via @MathurAditya724.
--
View Session [Sentry]