Expand description
Proxy filtering and modification system
This module provides sophisticated request/response filtering and modification capabilities for the MITM proxy.
§Certificate Modes
The proxy supports three certificate modes:
- Generate - Generate a self-signed CA certificate on-demand for full MITM
- LoadFromFile - Load CA certificate from specified path for full MITM
- None - No MITM, pass-through origin certificates (allow/block only)
§Full MITM Mode (Generate or LoadFromFile)
When a certificate is configured:
- HTTPS traffic is decrypted and re-encrypted
- LLM sees: method, URL, path, headers, body content
- LLM can: pass, block, or modify (headers, URL, body)
- HTTP traffic is also fully inspectable and modifiable
§Pass-Through Mode (None)
When no certificate is configured:
- HTTPS traffic passes through with origin certificate (no decryption)
- LLM sees: destination host, destination port, SNI (Server Name Indication)
- LLM can: allow or block only (no modifications possible)
- HTTP traffic is still fully inspectable and modifiable (no TLS involved)
Structs§
- Full
Request Info - Full request information available in MITM mode
- Full
Response Info - Full response information available in MITM mode
- Https
Connection Filter - Filter configuration for intercepting HTTPS connections (pass-through mode)
- Https
Connection Info - Information available to LLM for HTTPS connection (pass-through mode)
- Proxy
Filter Config - Complete proxy filter configuration
- Regex
Replacement - Regex-based text replacement
- Request
Filter - Filter configuration for intercepting requests
- Response
Filter - Filter configuration for intercepting responses
Enums§
- Certificate
Mode - Certificate mode for MITM proxy
- Filter
Mode - Filter mode determines behavior when no filters match
- Https
Connection Action - Actions available for HTTPS connections in pass-through mode (no MITM)
- Request
Action - Actions that can be taken on a filtered request
- Response
Action - Actions that can be taken on a filtered response
Constants§
- FRAMING_
HEADERS - Headers the proxy frames itself when it rewrites a message. A model-added
Content-Lengthbeside the one the proxy computes, or aTransfer-Encoding: chunkedover a body the proxy writes whole, is the ambiguity request-smuggling and response-desync attacks are built on, so neither may be added throughheaders(remove_headersmay still name them).
Functions§
- check_
header_ name - A header name is an RFC 9110 token.
- check_
header_ value - A header value carries no CR, LF or other control character (HTAB excepted).
- check_
modify_ headers - Every added header is a token with a control-free value and is not a framing header.
- check_
query_ params - Every query name and value passes
check_request_target_part. - check_
request_ target_ part - A piece of the request target (
new_path, a query name or value) carries no whitespace or control character: the request line is space-delimited and CRLF-terminated, so either would end the line early.