How to Block Paths Where Local Terminal AI Tools Leak Source Code
TuBrief 편집팀
2026년 7월 16일
0
Computing/Software원본 영상을 바탕으로 AI의 도움을 받아 작성했습니다. 원본 영상이 기준입니다.
커뮤니티의 다른 글
댓글 (0)
Log in to leave a comment
아직 작성된 글이 없습니다
원본 영상을 바탕으로 AI의 도움을 받아 작성했습니다. 원본 영상이 기준입니다.
Log in to leave a comment
아직 작성된 글이 없습니다
AI agents that boost backend developer productivity are all the rage these days. While they are certainly convenient, by their very nature, these tools scrape our entire local codebase and send it to external servers. Many startups spend hundreds of millions of won on cloud infrastructure security while ignoring the real-time data outbound occurring directly from developers' terminal computers. The cost of cleaning up after a security breach is over 13 times higher than the cost of preventing it in the first place. Simply posting a company-wide notice to stop using certain tools is ineffective, as developers will find workarounds. You must build practical defensive walls that physically block transmission paths at the system level.
AI CLI tools crawl through the local file system under the guise of indexing. Then, they attempt to open outbound ports to transmit the analysis results to external servers. You must monitor and cut these attempts directly at the OS kernel level. Here are specific configurations to isolate traffic in both macOS and Linux environments.
On macOS, we use the open-source firewall LuLu. LuLu operates as a System Extension and stores rules in /Library/Objective-See/LuLu/rules.plist to control traffic at the kernel level. Using the lulu-cli tool, we can block unauthorized AI tools from making external connections by default and only allow rules for gateways approved by the company.
`bash
sudo lulu-cli add --key "" --path "" --action block --addr "" --port ""
sudo lulu-cli add --key "/usr/local/bin/ai-agent" --path /usr/local/bin/ai-agent --action allow --addr "api.approved-ai-proxy.com" --port 443
sudo lulu-cli reload
`
Once this rule is active, any attempt to send code to unauthorized external domains is blocked immediately. This reduces the worry of unauthorized intellectual property leaks.
On Linux servers or local development machines, you can use the iptables Owner module to isolate the specific account running the AI tool from the network.
`bash
sudo iptables -I OUTPUT 1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -I OUTPUT 2 -o lo -j ACCEPT
sudo iptables -I OUTPUT 3 -m owner --uid-owner 1002 -m conntrack --ctstate NEW -j REJECT
`
With this configuration, internal communications (IPC) between the AI agent and local database sessions function normally, while only the path for shooting packets directly to the external internet is completely blocked.
Many organizations rely on .gitignore to prevent remote transmission. However, this is a very dangerous assumption. Many intelligent AI agents and indexing engines on the market are coded to bypass local .gitignore settings under the pretext of understanding the project build structure. It is also possible for agents to execute standard shell commands to read the contents of important credential files. This is why you need a global exclusion policy that operates independently of version control rules.
Create a JetBrains-specific .aiignore, Cursor-specific .cursorignore, and Aider-specific .aiderignore in the project root directory, and list the environment variables and key file paths that should be blocked from external transmission.
**/.env **/*.pem **/config/credentials.json
If you are using Anthropic's Claude Code, you must create a .claude/settings.json file directly and specify permissions.deny as shown below. This prevents the agent from using loopholes to bypass local tool execution permissions and read information.
json { "permissions": { "deny": [ "Read(./.env)", "Read(./.env.*)", "Read(./**/*.pem)", "Read(./config/credentials.json)", "Bash(cat .env)", "Bash(grep -R *)" ] } }
You must defend against situations where developers forget to create ignore files in individual project folders. Add global ignore environment variables to your global shell profile file (~/.zshrc or ~/.bashrc).
bash export AIDER_IGNORE="<strong>/.env,</strong>/.env.*,**/*.pem,**/secrets/*,**/id_rsa"
Forcing development environments to run only inside containerized virtual development environments (Dev Containers), rather than on the local host drive, is also a very reliable isolation method.
According to analysis by the data security platform Cyberhaven, 11% of the data knowledge workers upload to external Large Language Models (LLMs) consists of corporate source code and sensitive confidential documents. You cannot lower this figure by relying solely on the individual attention of developers. Before executing a local commit, you should deploy automated validation scripts that check the development environment configuration and cancel the commit itself if security standards are not met.
Place the Bash script below in the project's .git/hooks/pre-commit path. It automatically checks whether the developer's VS Code telemetry settings are turned off and whether required ignore files exist.
`bash
#!/usr/bin/env bash
set -euo pipefail
EXIT_CODE=0
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
echo "=== [STAGE 1] Verifying AI Tool Telemetry Disablement ==="
VSCODE_SETTINGS="{VSCODE_SETTINGS}" ]; then
TELEMETRY_LEVEL={VSCODE_SETTINGS}" | cut -d'"' -f4 || true)
if [ "${TELEMETRY_LEVEL}" != "off" ]; then
echo "[ERROR] Telemetry blocking (off) is missing in the ${VSCODE_SETTINGS} file."
EXIT_CODE=1
fi
fi
echo "=== [STAGE 2] Verifying Presence of Required AI Exclusion Files ==="
REQUIRED_IGNORES=(".cursorignore" ".aiderignore" ".aiignore")
for ignore_file in "{PROJECT_ROOT}/${ignore_file}" ]; then
echo "[ERROR] Required exception filter file ${ignore_file} is missing from the project root; leakage risk exists."
EXIT_CODE=1
fi
done
if [ ${EXIT_CODE} -eq 0 ]; then
echo "[SUCCESS] All local AI security configuration requirements met."
else
echo "[FAIL] Settings found that do not comply with company development security guidelines."
fi
exit ${EXIT_CODE}
`
This is a kill switch script for emergency situations, assuming abnormally large amounts of outbound traffic are detected on a developer machine. It immediately cuts local connections and kills resident AI agent daemons with signal 9.
`bash
#!/usr/bin/env bash
set -euo pipefail
echo "[CRITICAL ALERT] Abnormal traffic detected on local development node. Isolating network."
if command -v lulu-cli &> /dev/null; then
sudo lulu-cli add --key "" --path "" --action block --addr "" --port ""
sudo lulu-cli reload
echo "[STATUS] Set macOS LuLu firewall to global outbound block mode."
elif command -v iptables &> /dev/null; then
sudo iptables -P OUTPUT DROP
sudo iptables -F OUTPUT
echo "[STATUS] Set Linux iptables outbound default policy to DROP."
fi
pkill -9 -f "cursor" || true
pkill -9 -f "aider" || true
pkill -9 -f "claude" || true
echo "[COMPLETE] Local host threat factors have been isolated."
`
By establishing this level of verification environment in the company-wide development infrastructure, you can reduce management resources wasted on monitoring and controlling individual developers by over 80%.
Actual corporate asset leakage accidents occur from trivial misuse by employees rather than sophisticated infiltration techniques by hackers. Representatively, in the spring of 2023, engineers at Samsung Electronics' Semiconductor Device Solutions (DS) division entered equipment design logs and database transcripts directly into ChatGPT chat windows, leading to corporate secrets leaking to external servers. Following this, many large corporations completely blocked the use of AI, but this only reinforced the 'Shadow AI' phenomenon, where developers secretly used AI via personal computers or untraceable paths. Eventually, in June 2026, Samsung Electronics built its own 500 billion won secure internal AI infrastructure, providing a safe environment that masks input values and legitimizing previously underground AI usage.
For startups as well, establishing differential control standards based on the nature of the data is much more realistic than blind prohibition.
| Data Grade | Example Data | Internal AI Tool Transmission Standard | Required Actions |
|---|---|---|---|
| Grade 1 (Top Secret) | DB root password, PEM private key, proprietary core algorithms | Absolute prohibition of transfer to external AI prompts and indexing | Block via local firewall and register the folder in global ignore files |
| Grade 2 (Secret) | Internal YAML configuration files, internal test API endpoint info | Limited allowance only for code fragments anonymized by an approved internal gateway | Execute terminal shell memory clear command after usage |
| Grade 3 (General) | Simple sorting algorithms, open-source library wrapping utility code, UI markup | Freely usable within licensed enterprise tools | Maintain full telemetry disablement setting in editor |
If you detect that credentials or core code have already leaked externally despite proactive measures, you must begin recovery without delay according to the protocol below.