When you use AI coding tools like GitHub Copilot, Cursor, or Claude Code, your source code often gets transmitted to external servers for processing. Understanding what leaves your machine is essential for protecting proprietary code, meeting compliance requirements, and making informed decisions about your development environment.
This guide covers practical methods to audit and monitor network traffic from AI coding tools, giving you visibility into exactly what data gets transmitted.
Why Auditing AI Coding Tool Traffic Matters
Developers frequently work with proprietary algorithms, internal APIs, trade secrets, and customer data. AI coding assistants can inadvertently transmit this sensitive information to third-party servers, creating security and compliance risks. Industries like finance, healthcare, and government have strict regulations about where code can travel.
Beyond compliance, auditing helps you understand the behavior of AI tools. Different tools handle context windows, code uploads, and telemetry differently. By monitoring traffic, you can choose tools that align with your privacy requirements.
Method 1: Network Traffic Monitoring with HTTP Debugging Tools
The most direct approach is intercepting HTTP/HTTPS traffic from your IDE or terminal. Tools like mitmproxy, Charles Proxy, or Wireshark let you inspect requests in real time.
Setting Up mitmproxy
mitmproxy creates a local proxy server that captures all HTTP/HTTPS traffic. Here’s how to use it:
# Install mitmproxy
pip install mitmproxy
# Start the proxy on port 8080
mitmproxy -p 8080
Configure your system or IDE to use 127.0.0.1:8080 as the HTTP proxy. For HTTPS inspection, you’ll need to install the mitmproxy CA certificate on your system.
For a simpler approach, use the mitmweb interface:
mitmweb -p 8080
This opens a web interface at http://127.0.0.1:8081 where you can browse captured requests.
Capturing AI Tool Traffic
Start mitmproxy, then launch your AI coding tool. Watch for requests to domains like:
-
api.github.com(Copilot) -
api.anthropic.com(Claude-based tools) -
api.openai.com(OpenAI models) -
api.codeium.com(Codeium) -
Vendor-specific endpoints
Each request body typically contains snippets of your code, file paths, and context. You’ll see exactly what gets sent alongside prompts.
Method 2: Using strace for System Call Monitoring
On Linux, strace traces system calls made by a process. This works even for encrypted traffic, showing you when and where connections are made.
# Trace network-related system calls for a process
strace -e trace=network -f -p <PID> 2>&1 | grep -E "(connect|sendto)"
# Save full output to a file
strace -e trace=network -f -o /tmp/ai-tool-trace.txt -p <PID>
For a new process:
strace -e trace=network -f -o /tmp/cursor-trace.txt cursor
Look for connect calls to external IP addresses. This reveals all network destinations, even if the traffic is encrypted.
Method 3: Local DNS Logging
Every external connection starts with a DNS query. Logging DNS requests shows which domains your AI tools contact without inspecting encrypted traffic.
Using dnsmasq for Logging
Configure dnsmasq as your local DNS server with query logging:
# /etc/dnsmasq.conf
log-queries
log-facility=/var/log/dnsmasq.log
Restart dnsmasq and set your machine’s DNS to 127.0.0.1. All DNS queries get logged with timestamps.
Quick DNS Check with tcpdump
# Capture DNS queries on port 53
sudo tcpdump -i any -n port 53 -c 100
Run this while using your AI coding tool. You’ll see every domain being resolved, giving you a list of external services.
Method 4: Inspecting Claude Code and Similar Tools
Claude Code and similar agents often run as CLI tools or desktop applications. They typically have configuration files or verbose modes that reveal behavior.
Enabling Verbose Logging
Many CLI tools support verbose output:
# Claude Code verbose mode (if available)
claude --verbose chat
# Check environment variables
env | grep -i claude
env | grep -i anthropic
Examining Configuration Files
AI tools store configuration in standard locations:
# Find Claude Code config
ls ~/.config/claude/
ls ~/Library/Application\ Support/Claude/
# Check for telemetry settings
cat ~/.config/claude/settings.json | grep -i telemetry
Look for options to disable telemetry or limit data transmission.
Method 5: Firewall-Based Blocking and Monitoring
Create explicit firewall rules to monitor or block specific connections.
Using pfctl on macOS
# Create a simple rule to log connections to specific domains
echo "block drop log all proto tcp to any port 443 domain ai-tool.com" | sudo pfctl -f -
Using iptables on Linux
# Log connections to specific IPs
sudo iptables -A OUTPUT -p tcp -d 140.82.121.6 -j LOG --log-prefix "COPILOT: "
Review logs with:
sudo journalctl -f | grep "COPILOT"
Practical Audit Workflow
Combine these methods for visibility:
-
Start with DNS logging to identify all contacted domains
-
Use mitmproxy to inspect specific request payloads
-
Run strace on new or suspicious processes
-
Review tool configuration for privacy settings
-
Create firewall rules to block or alert on specific connections
What to Look For
When auditing, pay attention to:
-
Full code uploads: Some tools send entire files rather than snippets
-
File paths: Paths may reveal project structure and naming conventions
-
Context accumulation: Some tools maintain conversation history that grows over time
-
Telemetry: Background analytics may transmit usage patterns
-
Third-party services: Check for requests to analytics or logging services
Reducing Transmitted Data
After auditing, consider these mitigation strategies:
-
Use local-only AI models when available
-
Configure context windows to limit uploaded code
-
Disable telemetry in tool settings
-
Use network isolation or VPN tunnels for sensitive work
-
Review and rotate API keys if using direct integrations
Related Articles
- What Source Code Context Window Do Different AI Coding Tools
- Copilot Code Referencing Feature: How It Handles Open Source
- Fine Tune Open Source Code Models for Your Codebase
- AI Audit Trail and Evidence Collection Tools
- Best AI Tool for Auditors: Audit Report Generation Compared
Built by theluckystrike — More at zovo.one