Report outbound hosts to backend endpoint to forward to splunk/kusto - #242
Open
AbhishekBhaskar wants to merge 2 commits into
Open
Report outbound hosts to backend endpoint to forward to splunk/kusto#242AbhishekBhaskar wants to merge 2 commits into
AbhishekBhaskar wants to merge 2 commits into
Conversation
AbhishekBhaskar
force-pushed
the
abhishekbhaskar/add-endpoint-record-egress-hosts
branch
from
September 11, 2026 19:10
17bd2cd to
6c4c9bd
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Shutdown synchronization and failed-batch retention must be addressed to prevent buffered telemetry loss.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite (auto)
Findings: 2
Note
Copilot is running an experiment and ran this review at Lite.
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
internal/egress/collector.go — Shutdown can exit before the final egress flush View comment |
|
internal/egress/collector.go — Failed reports permanently discard the buffered hosts View comment |
What changed in this PR
Adds batched outbound-host reporting from the proxy to the Dependabot API for Splunk/Kusto observability.
Changes:
- Collects and aggregates observed egress hosts.
- Integrates recording with allowlist handling and proxy lifecycle.
- Adds API support and unit tests for reporting.
| File | Summary |
|---|---|
proxy.go |
Wires and stops the egress collector; shutdown does not wait for final flushing. |
internal/metrics/collector_client_test.go |
Updates the API client mock. |
internal/handlers/egress_allowlist.go |
Records observed hosts and allowlist status. |
internal/handlers/egress_allowlist_test.go |
Tests recording behavior. |
internal/egress/collector.go |
Implements batching and reporting; requires shutdown synchronization and failed-batch retention. |
internal/egress/collector_test.go |
Tests aggregation and flushing. |
internal/apiclient/client.go |
Adds the egress reporting endpoint. |
internal/apiclient/client_test.go |
Tests endpoint requests and payload handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What are you trying to accomplish?
The egress-allowlist observability data currently only lands in proxy logs, which aren't forwarded to Splunk/Kusto — so we can't analyze the outbound hosts jobs actually contact in order to tune the allowlist before flipping enforce on.
This adds a proxy-side reporter that batches the outbound hosts observed during a job and POSTs them to a new dependabot-api endpoint,
POST /update_jobs/{job_id}/record_egress_hosts(alongsiderecord_metrics), which forwards them to Splunk/Kusto.Depends on the corresponding
record_egress_hostsendpoint in dependabot-api.Anything you want to highlight for special attention from reviewers?
allowlistedflag (not just non-allowlisted), so we get the full egress picture per ecosystem. Payload shape:{"data":[{host, allowlisted, count, package_manager}, ...]}. Easy to narrow to non-allowlisted-only if preferred.egress.Collectormirrorsmetrics.CollectorClient(buffered, 1-min flush + flush-on-close, skips when the API endpoint is empty for smoke tests);RecordEgressHostsreuses the API client's retry/backoffdoRequest.proxy_egress_observe/proxy_egress_enforceis active; fail-open mode records nothing. Distinct hosts are capped (10k) to bound memory.EgressAllowlistHandlernow takes anEgressHostRecorderinterface (nil-safe), keeping the handler decoupled from the collector.How will you know you've accomplished your goal?
/update_jobs/{job_id}/record_egress_hosts; collector aggregates counts, clears its buffer, skips empty-endpoint/empty-host, and flushes on close; handler records observed hosts with correct allowlisted status and records nothing when disabled.gofmt/go vetpass locally (go test ./...).package_manager.Checklist