Add proxy_search_session_bodies for full-text body search in sessions#10
Merged
Add proxy_search_session_bodies for full-text body search in sessions#10
Conversation
proxy_query_session only searches index metadata (URL, hostname, path), returning 0 results for text present in actual response/request bodies. This new tool decompresses and searches stored bodies with grep-like context snippets around matches. Features: - Pre-filters by hostname, URL, method, status code, content-type - Searches response bodies, request bodies, or both - Case-sensitive/insensitive search - Falls back to bodyPreview for preview-profile sessions - Skips binary content (null-byte detection + MIME prefix list) - Single file handle for bulk record reads (not per-record) - max_scan and limit caps for bounded resource usage Also adds responseContentType to SessionIndexEntry for efficient content-type pre-filtering without loading full records. 30 new unit tests covering core search, case sensitivity, preview fallback, all pre-filters, limits, edge cases, backward compat, and snippet extraction.
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.
Summary
proxy_search_session_bodiestool — decompresses and searches actual HTTP request/response bodies stored in persistent sessions, returning grep-like context snippets around matchesresponseContentTypetoSessionIndexEntryfor efficient content-type pre-filtering without loading full records from diskproxy_query_sessiondescription to clarify it's metadata-only and point users to the new body search toolMotivation
proxy_query_sessiontext search only matches against index metadata (URL, hostname, path, exchangeId, matchedRuleId). Users searching for text inside response bodies (e.g., a price like "299,-" in HTML) get 0 results even though the content exists in the decompressed body. The in-memoryproxy_search_trafficsearchesbodyPreviewbut only covers the live ring buffer (1000 entries, lost on restart).Key design decisions
proxy_query_sessionstays fast (index-only), body search is explicitly heavierfullandpreviewcapture profiles;sourcefield tells the agent which it gotresponseContentTypein index still workTest plan
tsc --noEmitpassesnpm run buildsucceeds