Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot type header filter expression alone in mitmweb but no problem with the terminal mitmproxy #6805

Open
xxr0ss opened this issue Apr 17, 2024 · 0 comments

Comments

@xxr0ss
Copy link

xxr0ss commented Apr 17, 2024

Problem Description

There's inconsistent behavior between mitmweb and mitmproxy for filters.

When there're both HTTP flows and other flows recorded, we can use header filter alone in mitmproxy terminal, but have to add ~http filter before ~hq in mitmweb.

I debugged and it turned out that DNS flows are passed to match_header()
image

according to these fields: authoritative_answer, recursion_desired etc. this is a DNSMessage, which has no headers, and filter expression is cleared with error raised:

TypeError: Cannot read properties of undefined (reading 'length')
    at ResponseUtils.match_header (http://127.0.0.1:8081/static/app.js:62:5954)
    at responseHeaderFilter (http://127.0.0.1:8081/static/app.js:64:13978)
    at http://127.0.0.1:8081/static/app.js:65:49926
    ...

I think the behavior of mitmproxy terminal makes more sense and more easy to use.

related issue: #6168

Steps to reproduce the behavior:

  1. start mitmweb -r <http_and_other_flows>
  2. type ~hq x or ~hs (header filter)
  3. input is cleared immediately
  4. type ~http & ~hq x
  5. mitmweb is happy with the ~http filter

System Information

Mitmproxy: 11.0.0.dev (+29, commit b858a82)
Python:    3.12.1
OpenSSL:   OpenSSL 3.2.1 30 Jan 2024
Platform:  Windows-11-10.0.22635-SP0
@xxr0ss xxr0ss added the kind/triage Unclassified issues label Apr 17, 2024
@mhils mhils added kind/bug area/web and removed kind/triage Unclassified issues labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants