Drop CI/local-run noise from production Sentry (DISCOVERY-TOOL-SCRIPT-17/-13/-12/-D)#216
Conversation
The discovery CI suite runs the real script against a loopback mock
gateway on clean GitHub-hosted runners, so every scan finds zero tools
and the previously log-only Sentry paths self-report to the production
project: no_tools_found / send-failure / timeout / signal events with
zero customer impact (DISCOVERY-TOOL-SCRIPT-17 / -13 / -12 / -D; 346
events observed in 24h).
Add a before_send-style guard at the top of report_to_sentry() that
drops an event carrying a CI fingerprint, using three signals, each
~0-false-positive on customer machines:
- a CI environment marker (GITHUB_ACTIONS / CI) -- ground truth, and
the only one that also covers the bare-context extract/detect emits;
- the report target (domain) is a loopback host (127.0.0.0/8 dotted
quad / localhost / ::1 / 0.0.0.0) -- a real install always points at
the customer gateway URL, never loopback;
- the OS account (system_user) is a GitHub-hosted-runner account
(runner / runneradmin).
The guard never raises and defaults to keeping the event, so a malformed
context can never suppress a genuine customer error.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🛡️ Automated Security Review (consensus)0 findings — 0 high-confidence, 0 to triage. Reviewers: Cursor, Claude, Semgrep, Gitleaks, Greptile. No exploitable vulnerabilities, secret exposure, or unsafe parsing/injection paths in this diff. The change is an observability filter at the Sentry choke point that fails open on errors and only suppresses events matching CI/local fingerprints from trusted context fields ( Previously acknowledged (not re-flagged)
🤖 consensus review · reviewers: Cursor,Claude,Semgrep,Gitleaks · head |
5df9fc2 to
acfacee
Compare
vigneshsubbiah16
left a comment
There was a problem hiding this comment.
🛡️ Automated Security Review (consensus)
0 findings — 0 high-confidence, 0 to triage. Reviewers: Cursor, Claude, Semgrep, Gitleaks.
✅ Security consensus: no issues found. (reviewers: Cursor, Claude, Semgrep, Gitleaks)
🤖 consensus review · reviewers: Cursor,Claude,Semgrep,Gitleaks · head acfaceeb · 2026-06-26T05:51Z
acfacee to
e93bf06
Compare
|
Thanks @greptile-apps — addressed both findings: 1. "Generic CI Env Suppresses Telemetry" (P1, on 2. "Loopback aliases bypass" (P1, on |
|
Both fixes look correct. Here's a quick trace through the key paths: Fix 1 (CI env removed): Fix 2 (loopback aliases): The
The The This LGTM. Both P1 findings are fully addressed. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e93bf06. Configure here.
e93bf06 to
2da1687
Compare
🛡️ Automated Security Review (consensus)0 findings — 0 high-confidence, 0 to triage. Reviewers: Cursor, Claude, Semgrep, Gitleaks, Greptile. No exploitable vulnerabilities, secret exposure, injection surface, or auth/crypto weaknesses. The change only suppresses outbound Sentry telemetry using trusted run context ( Previously acknowledged (not re-flagged)
🤖 consensus review · reviewers: Cursor,Claude,Semgrep,Gitleaks · head |
2da1687 to
4077ede
Compare
🛡️ Automated Security Review (consensus)0 findings — 0 high-confidence, 0 to triage. Reviewers: Cursor, Claude, Semgrep, Gitleaks, Greptile. ✅ Security consensus: no issues found. (reviewers: Cursor, Claude, Semgrep, Gitleaks, Greptile) Previously acknowledged (not re-flagged)
🤖 consensus review · reviewers: Cursor,Claude,Semgrep,Gitleaks · head |
4077ede to
43c870d
Compare
|
Thanks @greptile-apps — tightened exactly as recommended in This resolves both points together:
It also costs zero coverage: all 346 observed noise events already carry a loopback |
|
That's the right call. Removing the Both original concerns are resolved. LGTM. |
The discovery CI suite runs the real script against a loopback mock gateway on clean GitHub-hosted runners, so every scan finds zero tools and the previously log-only Sentry paths self-report to the production project: no_tools_found / send-failure / timeout / signal events with zero customer impact (DISCOVERY-TOOL-SCRIPT-17 / -13 / -12 / -D; 346 events in 24h, all with a loopback report domain). Add a guard at the top of report_to_sentry() that drops an event whose report target (domain) is a loopback host. The host is normalized via the stdlib socket parsers, so every spelling is caught (IPv4 dotted quad + shorthand, ::1 and its expanded form, IPv4-mapped ::ffff:127.0.0.1), plus localhost, *.localhost, and 0.0.0.0. A real install always points at the customer gateway URL, never loopback, so a genuine customer event is never suppressed. Keyed on the event domain, not a CI env var or the OS account name: an env var would also drop report_to_sentry()'s own dedup/cap/breaker tests (which run under CI), and the runner/runneradmin account name would false-positive on a real customer using that service account. The guard never raises and defaults to keeping the event. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Cleaned up the comments (diff is now comment-free apart from three one-line docstrings) and addressed the open review threads in
Verified: loopback spellings (incl. |
43c870d to
2030019
Compare
🛡️ Automated Security Review (consensus)0 findings — 0 high-confidence, 0 to triage. Reviewers: Cursor, Claude, Semgrep, Gitleaks. ✅ Security consensus: no issues found. (reviewers: Cursor, Claude, Semgrep, Gitleaks) Previously acknowledged (not re-flagged)
🤖 consensus review · reviewers: Cursor,Claude,Semgrep,Gitleaks · head |
🛡️ Automated Security Review (consensus)0 findings — 0 high-confidence, 0 to triage. Reviewers: Cursor, Claude, Semgrep, Gitleaks. ✅ Security consensus: no issues found. (reviewers: Cursor, Claude, Semgrep, Gitleaks) Previously acknowledged (not re-flagged)
🤖 consensus review · reviewers: Cursor,Claude,Semgrep,Gitleaks · head |

Summary
The discovery tool's CI suite runs the real script against a loopback mock gateway (
--domain http://127.0.0.1:<ephemeral port>) on clean GitHub-hosted runners. With no AI tools installed, every scan finds zero tools and the previously log-onlyreport_to_sentry()paths self-report to the production Sentry project —no_tools_found/ send-failure / timeout / signal events with zero customer impact.Verified in Sentry (last 24h): 346 such events across 4 issues —
DISCOVERY-TOOL-SCRIPT-D(222),-17(71),-13(49),-12(4). Every one carries a loopbackdomaintag;users_impacted: 0.This adds a
before_send-style guard at the single Sentry choke point (report_to_sentry()— there is no Sentry SDK in this zero-dependency tool) that drops an event whose report target is a loopback host.Changes
scripts/coding_discovery_tools/utils.py: new_event_domain_is_loopback()/_ip_is_loopback()/_is_ci_or_local_event()helpers + an early-return guard at the top ofreport_to_sentry()(before the dedup set / per-run counters / circuit breaker, so dropped events have zero side effects).Drop signal: loopback
domain(false-positive-free)The host is normalized through the stdlib IP parsers (
socket.inet_aton/inet_pton), so every spelling is caught: IPv4 dotted quad + shorthand (127.0.0.1,127.1),::1and its expanded form, IPv4-mapped::ffff:127.0.0.1, pluslocalhost/0.0.0.0. A real install always points at the customer gateway URL, never loopback; an FQDN like127.example.comis not a valid IP literal so it is never matched.Why only this signal: an earlier draft also keyed on a CI env var and on a
runner/runneradminsystem_user. Both were dropped — the env var brokereport_to_sentry()'s own dedup/cap/breaker tests (which run under CI), and the account-name check would false-positive on a real customer namedrunner/runneradmin(per @greptile-apps), suppressing even their priority/terminal reports. The loopbackdomainalready covers 100% of the 346 observed events, so it is the complete and FP-free signal. Bare-contextextract/detectemits are out of scope for this in-function filter; the fix for those is source-side (don't point the production DSN at CI runs).The guard never raises and fails open (defaults to keeping the event), so a malformed context can never suppress a genuine customer error.
Test plan
127.0.0.1,127.1,::1,[0:0:0:0:0:0:0:1],::ffff:127.0.0.1,localhost) match; real gateways/FQDNs (api.getunbound.ai,127.example.com,127.0.0.1.evil.com,10.0.0.5,8.8.8.8) do not. Arunneruser with a real domain is not suppressed.report_to_sentry()transport tests (TestSentryRunGuards,TestSentryDebugLogging,TestSentryPriorityBypassesCap) still pass underGITHUB_ACTIONS=true.python -m unittest discover, CI's runner): alltestjobs green on macOS + Windows × py 3.9/3.11/3.12.elite-pr-reviewer: APPROVE./security-review+ Cursor Security + Greptile: addressed; no high-confidence findings.Notes
no_tools_foundinstrumentation (PR [WEB-4956] Add no_tools_found Sentry event to diagnose empty discovery scans #215) currently lives on staging, notmain, so this guard must ride the normal main→staging merge-commit sync to fully silence-17. The guard is phase-agnostic and lands cleanly on both.DISCOVERY-TOOL-SCRIPT-17/-13/-12/-Din Sentry (intentionally not using aFixes <ISSUE>auto-close keyword, since events can keep arriving until staging carries the guard).🤖 Generated with Claude Code
Note
Low Risk
Single choke-point filter with fail-open semantics; only suppresses events whose report target is loopback, not production customer domains.
Overview
Stops discovery-tool CI and local test runs from polluting the production Sentry project. CI exercises the real script against a loopback mock gateway (
--domain http://127.0.0.1:…), which previously triggered the samereport_to_sentry()paths as customer installs.In
utils.py,report_to_sentry()now returns early when the event context’sdomainhost is loopback—before dedup, per-run caps, or the circuit breaker, so skipped events have no side effects. New helpers normalize the domain string (nourllib, for Zscaler compatibility) and detect loopback vialocalhost,0.0.0.0, and stdlib IP parsing for IPv4 shorthand,::1, and IPv4-mapped forms. The check fails open (malformed context still reports). Real customer gateways are unchanged.Reviewed by Cursor Bugbot for commit 2030019. Bugbot is set up for automated code reviews on this repo. Configure here.
Greptile Summary
This PR reduces production Sentry noise from local discovery-tool runs. The main changes are:
report_to_sentry().Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
Reviews (7): Last reviewed commit: "Drop CI/local-run noise from production ..." | Re-trigger Greptile