-
Notifications
You must be signed in to change notification settings - Fork 18
[plan] add content inspection for sensitive data patterns #308
Copy link
Copy link
Closed
Labels
Description
Objective
Implement optional DLP (Data Loss Prevention) scanning in Squid to detect and prevent exfiltration of API keys, tokens, and credentials in outgoing requests.
Context
Current state: Domain allowlisting restricts which hosts can be contacted, but doesn't inspect request content.
Risk: Attacker could encode sensitive data (API keys, tokens) in HTTP requests to allowed domains (e.g., creating GitHub gists with credentials).
Risk level: 🟡 MEDIUM - Information disclosure via allowed domains
Implementation Approach
- Add
--enable-dlpflag to enable content inspection (opt-in for performance) - Define regex patterns for common credential formats:
- GitHub tokens:
ghp_[A-Za-z0-9]{36},gho_[A-Za-z0-9]{36},ghs_[A-Za-z0-9]{36} - OpenAI API keys:
sk-[A-Za-z0-9]{48} - AWS keys:
AKIA[0-9A-Z]{16} - Generic patterns:
[Aa]pi[_-]?[Kk]ey,[Tt]oken
- GitHub tokens:
- Use Squid's
adaptation_service_setwith ICAP or eCAP adapter - Log blocked requests with
[DLP_BLOCKED]prefix - Return 403 Forbidden when sensitive pattern detected
Files to Modify
src/cli.ts- Add--enable-dlpflagsrc/squid-config.ts- Generate ICAP/eCAP configuration when enabledsrc/types.ts- Add DLP config toWrapperConfigcontainers/squid/dlp-adapter.sh- Simple ICAP adapter script for pattern matchingcontainers/squid/Dockerfile- Install ICAP adapter dependenciesREADME.md- Document DLP feature and detected patterns
Testing
- Test detection of GitHub personal access token (
ghp_...) - Test detection of OpenAI API key (
sk-...) - Test detection of AWS access key (
AKIA...) - Verify legitimate requests without credentials pass through
- Confirm DLP only active when
--enable-dlpflag used
Acceptance Criteria
-
--enable-dlpflag enables content inspection - GitHub tokens detected and blocked
- OpenAI API keys detected and blocked
- AWS credentials detected and blocked
- Blocked requests logged with
[DLP_BLOCKED]prefix - Performance impact documented (< 10% latency increase)
- Feature documented with security benefits
Related to [plan] security improvements from threat model review #306
AI generated by Plan Command for discussion #302
Reactions are currently unavailable
Metadata
Metadata
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.