diff options
| author | srdusr <[email protected]> | 2026-04-17 22:19:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2026-04-17 22:19:00 +0200 |
| commit | d7d50ae9902d69b2e52d446684b5ab01a5ecab1e (patch) | |
| tree | c5b88cde9000b311997288ad270c7d8c9d103ab0 /go.sum | |
| parent | 70b1c783715eddc9886e3681f6570d49ea8357ed (diff) | |
| download | mitmux-d7d50ae9902d69b2e52d446684b5ab01a5ecab1e.tar.gz mitmux-d7d50ae9902d69b2e52d446684b5ab01a5ecab1e.zip | |
Reject an invalid regex when saving a match-and-replace rule
internal/rules/rules.go's apply() treats a regex that fails to compile
exactly the same as "no match" - it silently returns the text unchanged
with no error surfaced anywhere in the call chain. rules_save had no
validation before persisting, so a rule with a typo'd regex would save
successfully, show as Enabled in the UI, and simply never fire on any
traffic - no indication anything was wrong.
internal/ipc/server.go's "rules_save" handler now compiles r.Match with
regexp.Compile before persisting when IsRegex is set, rejecting with a
clear "invalid regex: ..." error otherwise. No TUI changes needed: the
existing ruleWriteDoneMsg error path already surfaces any saveRule
error inline via the status line and - since it only clears ruleForm on
success - keeps the form open with the user's draft intact so they can
fix the pattern without losing their edits. That path already existed
for other error classes (DB errors); this just adds a new one flowing
through it.
Verified live over the real protocol (raw JSON on the control socket):
an unclosed-bracket regex is rejected with the expected error and never
reaches the rules table; a valid regex rule still saves and returns
normally.
go build/vet/gofmt/test/mod tidy all clean.
Diffstat (limited to 'go.sum')
0 files changed, 0 insertions, 0 deletions