Add Flowfilter description strings#8245
Open
lups2000 wants to merge 6 commits into
Open
Conversation
mhils
reviewed
Jun 1, 2026
mhils
left a comment
Member
There was a problem hiding this comment.
LGTM % CI failure! You can just bump the lower version bound for pyparsing to the current upper bound if that's easiest. :)
Member
Author
easy 😄 regarding the next steps do you have any thoughts? should we move the conversation on discord? |
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.
Description
This PR revives the old draft in #7710 and completes the missing test coverage for the new str implementations in flowfilter.py.
The broader goal behind this work is to move filter descriptions to the backend so that mitmweb can eventually stop relying on filt.js. I initially thought that backend descriptions plus the removal of filt.js could be done together in one PR, but after digging into the mitmweb flow I think that second step needs a bit more discussion. For that reason, I’d prefer to merge this first and follow up separately with the mitmweb changes.
One thing to note is that CI currently fails on old-dependencies (https://github.com/mitmproxy/mitmproxy/actions/runs/26331517591/job/77518316616?pr=8245). I guess we can't ignore that, but how should we fix that? never encountered this type of error.
General Discussion for next steps
This PR is only the first step. The remaining open design question is how mitmweb should validate filter expressions once filt.js is removed.
Today mitmweb has three places that use filter expressions:
Search and Highlight are closely related: they use the websocket flow-filter path and already have dedicated update messages. Intercept is different: it is configured through the /options endpoint.
Because of that, moving validation from the frontend to the backend is not entirely straightforward. The main implementation options I see are:
Keep Search and Highlight on the existing websocket filter-update path, and add a separate backend validation path only for Intercept.
This avoids duplicated work for Search/Highlight, because validation and application are effectively the same operation there.
Introduce one unified backend validation channel for all three inputs (Search, Highlight, Intercept), and keep the existing websocket//options paths only for committing valid values.
This is more uniform conceptually, but it introduces some duplication for Search and Highlight, because the same expression may be parsed once for validation and again for application.
Enrich the existing Search/Highlight websocket messages with validation metadata, and extend the /options endpoint so that backend validation errors can be surfaced directly in the UI. The downside is that this changes the semantics of the general options update path, not only the intercept.
Thoughts?
Checklist