diff options
| author | srdusr <[email protected]> | 2026-02-17 19:18:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2026-02-17 19:18:00 +0200 |
| commit | b8e5d5ea37cc64ffa05352c3fb3130ca59471935 (patch) | |
| tree | 18357a1a92214dec735b7422a66d9293fa64b565 /internal/ipc | |
| parent | b33c1e5cc7086da46b36122aa5645ccee26be69f (diff) | |
| download | mitmux-b8e5d5ea37cc64ffa05352c3fb3130ca59471935.tar.gz mitmux-b8e5d5ea37cc64ffa05352c3fb3130ca59471935.zip | |
Flagged marker for history entries
Last of the "should build soon" items from the Burp/ZAP/Caido gap
research - Burp's row highlighting and Caido's Findings both serve
the same real workflow: mark something interesting mid-engagement,
revisit later. Scoped to a boolean flag (★) rather than full free-text
notes/comments, which would need their own text-input overlay for
comparatively modest extra value over a simple marker - tracked as a
real follow-up in PLAN.md, not dropped silently.
internal/store: history gains a flagged column (migrated in for
existing databases the same way source was) plus Store.SetFlagged and
Summary/Entry.Flagged. Search's structured-filter layer (added last
commit for status:/source:) gains flagged:true/false alongside them -
extractStructured already existed for exactly this kind of "pull it out
before it reaches FTS5" filter. internal/ipc gains a "set_flagged"
request. cmd/mitmux: 'f' toggles the flag on the selected history row
(applied optimistically to local state, persisted async - a drift
between local and server state on failure is an acceptable trade-off
for a marker this low-stakes), shown as a ★ column in the list and in
the detail view's title.
store_test.go covers the flagged: parsing (true/false spellings, and
a "looks like it but isn't" case - flagged:maybe - falling through as
literal search text, matching the existing pattern for status:).
Verified live: toggling 'f' shows the star immediately, flagged:true
correctly filtered to just that entry, and a direct SQLite check
confirmed the flag actually persisted to the database (flagged=1),
not just reflected in local UI state.
Diffstat (limited to 'internal/ipc')
| -rw-r--r-- | internal/ipc/ipc.go | 24 | ||||
| -rw-r--r-- | internal/ipc/server.go | 9 |
2 files changed, 31 insertions, 2 deletions
diff --git a/internal/ipc/ipc.go b/internal/ipc/ipc.go index d295238..7d81473 100644 --- a/internal/ipc/ipc.go +++ b/internal/ipc/ipc.go @@ -44,11 +44,14 @@ type Request struct { Rule *rules.Rule `json:"rule,omitempty"` RuleID int64 `json:"rule_id,omitempty"` RuleEnabled bool `json:"rule_enabled,omitempty"` + + // For "set_flagged": ID identifies the history entry. + Flagged bool `json:"flagged,omitempty"` } // Response is sent by the daemon to a client. type Response struct { - Type string `json:"type"` // "list", "get", "new", "repeat", "rules", "intrude_result", "intrude_done", "status", or "error" + Type string `json:"type"` // "list", "get", "new", "repeat", "rules", "intrude_result", "intrude_done", "status", "flagged", or "error" Entries []store.Summary `json:"entries,omitempty"` // for "list" Detail *EntryDetail `json:"detail,omitempty"` // for "get" and "repeat" New *store.Summary `json:"new,omitempty"` // for "new" (subscribe push) @@ -117,6 +120,25 @@ func (c *Client) Close() error { return c.conn.Close() } +// SetFlagged sets the flagged marker on a history entry - a simple +// "mark this, revisit later" bit, filterable via flagged:true/false in +// Search. +func (c *Client) SetFlagged(id int64, flagged bool) error { + c.mu.Lock() + defer c.mu.Unlock() + if err := c.enc.Encode(Request{Type: "set_flagged", ID: id, Flagged: flagged}); err != nil { + return err + } + var resp Response + if err := c.dec.Decode(&resp); err != nil { + return err + } + if resp.Type == "error" { + return errors.New(resp.Error) + } + return nil +} + // Status returns basic daemon info for a status bar. func (c *Client) Status() (*StatusMsg, error) { c.mu.Lock() diff --git a/internal/ipc/server.go b/internal/ipc/server.go index eea0ebb..28279a7 100644 --- a/internal/ipc/server.go +++ b/internal/ipc/server.go @@ -178,6 +178,13 @@ func (s *Server) handleConn(conn net.Conn) { } enc.Encode(Response{Type: "intrude_done"}) + case "set_flagged": + if err := s.db.SetFlagged(req.ID, req.Flagged); err != nil { + enc.Encode(Response{Type: "error", Error: err.Error()}) + continue + } + enc.Encode(Response{Type: "flagged"}) + case "rules_list": rs, err := s.db.ListRules() if err != nil { @@ -259,7 +266,7 @@ func detailFromEntry(e *store.Entry) *EntryDetail { ID: e.ID, StartedAt: e.StartedAt, Duration: e.Duration, Method: e.Method, Scheme: e.Scheme, Host: e.Host, Path: e.Path, StatusCode: e.StatusCode, ReqSize: len(e.RequestRaw), RespSize: len(e.ResponseRaw), - Error: e.Error, Source: e.Source, + Error: e.Error, Source: e.Source, Flagged: e.Flagged, }, RequestRaw: e.RequestRaw, ResponseRaw: e.ResponseRaw, RequestExact: e.RequestExact, ResponseExact: e.ResponseExact, |