feat: TCP session reconstruction with application-layer payload decoding#149
Merged
NotYuSheng merged 2 commits intomainfrom Apr 2, 2026
Merged
feat: TCP session reconstruction with application-layer payload decoding#149NotYuSheng merged 2 commits intomainfrom
NotYuSheng merged 2 commits intomainfrom
Conversation
…ing (#139) - Add SessionReconstructionService: uses tshark -z follow,tcp/udp,raw to reassemble the full byte stream for a conversation; auto-detects transport protocol (tries tcp then udp) so HTTP, TLS, FTP-DATA, DNS etc. all work - Add SessionResponse DTO with ordered client/server chunks, HTTP exchange parsing (headers, gzip body decompression, chunked transfer decoding), truncation flag at 1 MB, and errorMessage for graceful failures - Expose GET /api/conversations/{conversationId}/session endpoint - Frontend: add Session tab to ConversationDetail with Wireshark-style interleaved single-pane stream view (client=red, server=blue); HTTP conversations additionally offer a Parsed HTTP view with collapsible request/response blocks showing headers and decoded bodies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new session reconstruction feature that allows users to view reconstructed TCP/UDP streams and decoded application-layer payloads (such as HTTP) for specific conversations. While the implementation provides a useful new capability, the review identified several critical performance and correctness issues in the SessionReconstructionService. Specifically, the current approach of downloading entire PCAP files to temporary storage is inefficient, the HTTP message splitting logic is prone to false positives, the stream merging process suffers from
- Add 500 MB PCAP size guard before downloading to avoid excessive I/O - Replace O(N²) byte array merging with ByteArrayOutputStream accumulator - Replace fragile HTTP pattern scan with sequential parser that uses Content-Length/chunked boundaries to skip message bodies, preventing false positives when body content contains HTTP method strings - Return null for odd-length hex strings instead of silently corrupting the last byte by appending '0' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #139
Summary
SessionReconstructionService— on-demand tshark-based stream reassembly: auto-detects TCP vs UDP transport (so HTTP, TLS, FTP-DATA, DNS etc. all work), tries both endpoint directions, truncates at 1 MBSessionResponseDTO — ordered client/server chunks, parsed HTTP exchanges (headers, gzip decompression, chunked transfer decoding), truncation flag, graceful error messagesGET /api/conversations/{conversationId}/session— new endpointConversationDetail— Wireshark-style interleaved single-pane stream (client=red, server=blue); HTTP conversations add a Parsed HTTP view with collapsible request/response blocksTest plan
gzip decodedbadge appears and body is readable🤖 Generated with Claude Code