Commit graph

2881 commits

Author SHA1 Message Date
Maximilian Hils
886055df17
Update to Python 3.14 (#7918)
* update to Python 3.14

* [autofix.ci] apply automated fixes

* fix python 3.14 compatibility

* bump minimum required zstandard version

0.15 was causing CI issues with Python 3.14.

* Revert "Bump hypothesis dependency (#7865)"

This reverts commit 0981668515.

windows-curses has no abi3 wheels, which blocks adoption of Python 3.14. Kill it with fire.

* remove compression from HAR tests

* add `build-essential` to build jobs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-15 21:32:53 +02:00
Maximilian Hils
ff2291159e
Temporarily silence a valid fuzzing finding (#7917)
temporarily silence a valid fuzzing finding
2025-10-15 17:01:02 +00:00
Maximilian Hils
46d0adc7d1
Add custom htpasswd parser (#7906)
* add custom htpasswd parser

This PR migrates us off passlib, which is unmaintained.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-10 12:29:23 +05:30
Gaurav Jain
c8ddc2140f
Bump pytest dependency group (#7864)
* Bump the pytest dependency group

* Remove deprecated event_loop fixture

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-08 15:52:14 +02:00
Maximilian Hils
12ee8193c0
fix a flow reader bug found with fuzzing (#7841) 2025-08-24 17:26:00 +00:00
Sujal Singh
f6d27fadc8
Fix auth cookie always using the default web_port option. (#7827)
* fix auth cookie always using the default `web_port`

* update changelog

* add test

* switch to webauth method
2025-08-19 23:04:34 +02:00
Justin Su
bbb95a7670
Run pyupgrade and improve f-strings (#7837)
* `pyupgrade --py312-plus **/*.py`

* Use `!r` flag in f-strings

* Remove redundant `str()` on `log.LogEntry.msg`

* Remove redundant `str()` in f-strings

* Use self-documenting f-strings

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-19 20:15:46 +02:00
Matthew Heguy
6571b9ca06
fix missing content-length header in curl export (#7810)
* fix missing content-length header in curl export

* [autofix.ci] apply automated fixes

* Simplify logic and remove redundant tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-03 18:46:19 +02:00
Maximilian Hils
e683c737f6
Ensure syntax highlighting is consistent between Rust and mitmweb (#7741)
* ensure syntax highlighting is consistent between Rust and mitmweb

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-30 23:21:40 +02:00
Maximilian Hils
72ca373b85
Do not escape non-ascii characters in the JSON contentview (#7740)
* do not escape non-ascii characters in the JSON contentview

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-30 13:02:38 +02:00
Cédrick Gauthier
790f000e1f
fix concurrent mitmweb instances overwrite each others mitmproxy auth cookie (#7690) 2025-05-24 15:03:34 +02:00
Matteo Luppi
e87f699f8a
Web: search/highlight by body content (#7704)
* Add 'updateFilter' method to the current websocket connection (#7421)

* specify types

* create backend singleton class and remove window.backend

* add example of sending a message through web socket

* back to previous version

* make sendMessage private and add updateFilter function

* send correct messages

* remove console logs

* update snapshot

* remove unrelated stuff

* [autofix.ci] apply automated fixes

* remove console.log

* move the backend update in the redux duck

* remove circular dependency, use window.backend

* improve typing

* remove cyclic dependency on backend instance

* [autofix.ci] apply automated fixes

* type -> icon naming

* remove partial

* back to prev approach and solve cyclic dependencies

* [autofix.ci] apply automated fixes

* nit

* add comment

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>

* Fix bug when sending a message while CONNECTING (#7467)

* fix problem while connecting + add more tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* web: add server-side filters (#7506)

* fix logic and conflicts

* fix tests

* client side logic to show/hide filters

* move message information inside payload

* leftover

* update filt.peg and filt.js

* [autofix.ci] apply automated fixes

* update existing tests

* [autofix.ci] apply automated fixes

* websocket broadcaster: add send task

this ensures that messages are sent in order

* websocket broadcaster: nits

* filtersUpdated -> filterUpdate

* wip: fixup flows store

* store: move flows off immer

* move flow backend actions

* bench++

* web flows: object -> map/set

* lint!

* tests++, fixes++

* web: tests++, fix sort

* be explicit about missing search filters

* fix flow deletion

* wip

* [autofix.ci] apply automated fixes

* incorporate review feedback

* add tests for view utils

* fix nits

* fix compatibility with nodejs 18

* update app.js

* nits

* [autofix.ci] apply automated fixes

* update app.js

* changelog++

* cov++

* untangle store and backend

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-05-23 20:44:33 +02:00
Sujal Singh
974a22e924
Fix raw response export incorrectly zeroing non-zero Content-Length header for HEAD requests. (#7701)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-05-12 07:20:04 +00:00
Maximilian Hils
4be711c3a1
web: increase typescript use for ducks (#7692)
* web: increase typescript use for ducks

* tests++

* web: move event log off store abstraction

* [autofix.ci] apply automated fixes

* exclude typescript guards from coverage

* fix coverage

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-09 20:35:33 +02:00
Guillaume Schaer
c69f0b3819
[web] Add token header (#7681) 2025-05-04 12:14:33 +00:00
Maximilian Hils
bdd1827687
fix various deprecation warnings (#7687) 2025-05-03 17:55:57 +00:00
Maximilian Hils
d48f9ae59c
bump mitmproxy_rs, add interop tests (#7678) 2025-04-29 12:44:53 +02:00
Maximilian Hils
4e8eef805b
migrate to new contentview API, make DNS interactive (#7670)
* migrate all views to new contentview API
* make DNS view interactive
* rename dns.Message to DNSMessage
2025-04-25 15:17:12 +00:00
Maximilian Hils
b089c5fb83
fix #7452 (#7666)
* savehar: gracefully handle if `content` raises, fix #7452

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-04-23 12:30:50 +00:00
Jordan Adams
ce151531f8
Add CRL to dummy certs (#7609)
Co-authored-by: Gabriel Huber <mail@gabrielhuber.at>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-04-22 15:29:41 +02:00
Maximilian Hils
d0a35dcf9b
introduce new contentview API (#7623) 2025-04-21 14:56:58 +02:00
Maximilian Hils
f29f146ed1
switch to uv (#7662) 2025-04-16 18:38:35 +02:00
Gaurav Jain
c281f76366
Wireguard: Bind server on IPv4 and IPv6 separately (#7589)
* Wireguard: Handle binding on IPv4 and IPv6 separately

* [autofix.ci] apply automated fixes

* cleanup

* [autofix.ci] apply automated fixes

* cleanup++

* [autofix.ci] apply automated fixes

* Add comments

* Format IPv6 address for new rust API

* Add test

* Update CHANGELOG.md

* [autofix.ci] apply automated fixes

* bump mitmproxy_rs verison

* fix process handler

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-04-14 15:46:55 +00:00
Mark Kiami
d33090b4f3
Log streamed bodies (#7637)
* Add new feature: storing of request and response streaming bodies

* Fix unit test by regenerating the options file with options_js.py

* Add test cases with store_streamed_bodies True and False

* Update Changelog

* Update Changelog with pull request ID

* [autofix.ci] apply automated fixes

* Update test with a dedicated test case for store_streamed_bodies

* Remove unnecessary option store_streamed_bodies from options.py

* Update docstrings for store_streamed_bodies and stream_large_bodies.

* Update docstring for store_streamed_bodies since it is not used anywhere in practice here.

* Fix typo in test_http.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-04-07 20:09:53 +02:00
Maximilian Hils
3c7c3ccfd5
fixup url.unparse (#7624)
the parse implementation is still awful, but this is a bit of progress
2025-03-28 22:44:11 +00:00
Maximilian Hils
cc6da7a819
Do not send empty HTTP/2 data frames unless the client sent some (#7574)
* do not send empty HTTP/2 data frames unless the client sent some, fix #7480

Co-authored-by: Yubao Liu <yubao.liu@gmail.com>

* [autofix.ci] apply automated fixes

* Update CHANGELOG.md

* tests++

---------

Co-authored-by: Yubao Liu <yubao.liu@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-28 20:47:08 +00:00
Maximilian Hils
60e3044e72
Pick random ports that work with both TCP and UDP (#7618)
* pick random ports that work with both TCP and UDP

fix #7614

* [autofix.ci] apply automated fixes

* Update free_port.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-28 21:24:03 +01:00
Maximilian Hils
4d798c29e2
Support HTTP_1_1_UPGRADE_REQUIRED, refactor protocol error status codes (#7575)
* http: add error code enum, handle http_1_1_upgrade_required

* http2: add http_1_1_upgrade_required test

* [autofix.ci] apply automated fixes

* move error conversions out of error enum

* fixup coverage

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-25 18:16:03 +01:00
Maximilian Hils
8d96ce7824
Fix CI: actually test on older Python versions (#7586)
* actually test on older Python versions

* fix tests on Python 3.12
2025-03-01 22:57:48 +00:00
Maximilian Hils
e89377ad9e
Add Support for TLS 1.3 Post Handshake Authentication (#7576)
* send post_handshake_auth tls extension if client certs are set

* tls: send data only after calling recv

* tls: add post-handshake-authentication test

* [autofix.ci] apply automated fixes

* Update CHANGELOG.md

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-02 01:14:06 +05:30
Maximilian Hils
7c1e429f71
keepserving: do not exit before client has disconnected (#7571)
* keepserving: do not exit before client has disconnected

* [autofix.ci] apply automated fixes

* fix tests

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-25 10:35:23 +00:00
DenizenB
372186f255
Content view for socket.io over websocket transport (#7570)
* socket.io content view for websocket transport

* [autofix.ci] apply automated fixes

* create tests, implement render priority

* [autofix.ci] apply automated fixes

* fix tox errors

* update changelog

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-24 11:41:47 +01:00
Maximilian Hils
8e4c695fce
Ensure export output has no surrogates (#7562)
* ensure export output has no surrogates

fix https://github.com/mitmproxy/mitmproxy/issues/7561

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-16 13:10:45 +01:00
Maximilian Hils
0bd573a599 web: add password-based authentication 2025-02-05 23:37:33 +01:00
Maximilian Hils
fa89055e19 web: add token-based authentication for the web ui API 2025-02-05 23:37:33 +01:00
Farid Rener
032e51e399
Unescape escaped characters in curl and httpie args (#7520)
* Unescape escaped characters in curl and httpie args

Fixes: [#7517]

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-03 15:48:47 +01:00
dependabot[bot]
77d1f278e1
Update ruff requirement from <=0.8.6,>=0.5.0 to >=0.5.0,<=0.9.4 (#7528)
* Update ruff requirement from <=0.8.6,>=0.5.0 to >=0.5.0,<=0.9.4

Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.5.0...0.9.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* [autofix.ci] apply automated fixes

* fixup

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-02-01 23:21:33 +00:00
Aditya
0013825c1d
fixes #7457: streamline filter expression case-sensitivity (#7483)
* make all filter expressions case-insensitive by default

* [autofix.ci] apply automated fixes

* add test cases.

* added dedicated test case for case sensitivity check

---------

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-29 20:06:36 +01:00
Maximilian Hils
6138d2a067
Next Layer: Don't wait for host header based on alpn (#7519)
* don't wait for host header based on alpn, fix #7516

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-28 17:34:17 +01:00
Sujal Singh
c5402a490a
Check flow.killable before killing prior knowledge h2 connections. (#7514)
* check for killable flow

* [autofix.ci] apply automated fixes

* add test

* changelog

* restructure test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-27 14:59:27 +01:00
Maximilian Hils
b761cb46c4
Web: harden xsrf_token usage (#7491)
web: harden `xsrf_token` usage
2025-01-19 20:40:55 +05:30
Maximilian Hils
e78ab0ffd9
web: remove unnecessary template copying build step (#7490) 2025-01-17 18:09:45 +01:00
Maximilian Hils
54829b58c1
dns resolver: make Hickory and getaddrinfo resolvers available using the same protocol (#7464)
* dns resolver: make Hickory and `getaddrinfo` resolvers available using the same protocol

* incorporate review feedback
2025-01-09 20:22:56 +05:30
Matteo Luppi
70e59c2d41
Remove check for status codes in the blocklist add-on (#7453)
* remove check status code

* fix tests

* update changelog

* Update changelog

Co-authored-by: lups2000 <100372313+lups2000@users.noreply.github.com>
Co-authored-by: AdityaPatadiya <patadiyaaditya0079@gmail.com>

---------

Co-authored-by: AdityaPatadiya <patadiyaaditya0079@gmail.com>
2025-01-08 10:54:43 +01:00
Jakub Wądołowski
784ad4be20
fix: Remove filter expression lowercasing in block_list addon (#7456)
* fix: Remove filter expression lowercasing in block_list addon

* chore: CHANGELOG update

* test: Add new test cases to verify URL case-sensitivity

* test: Add new test cases to cover case-sensitive filter expressions

* chore: Update test func name

* fix nits

---------

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2025-01-07 21:55:50 +00:00
Maximilian Hils
9957abf106
fix use of asyncio.create_task (#7443) 2025-01-06 11:39:15 +01:00
Maximilian Hils
6e4cb235fd
require Python 3.12+ (#7440) 2025-01-06 09:02:51 +00:00
Maximilian Hils
77e0469635
Refine handling of invalid request transfer-encodings (#7373)
* refine handling of invalid request transfer-encodings

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-05 10:00:12 +01:00
Maximilian Hils
18eb29c736
Improve transfer-encoding error messages, be more permissive if validate_inbound_headers is disabled (#7361)
* improve error message for header validation

* move transfer-encoding validation from http.http1.read to http.validate

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-28 18:20:27 +00:00
Maximilian Hils
29918474b7
Don't crash UI on negative durations (#7358)
* don't crash on negative durations, fix #6646

* tests++
2024-11-27 10:07:07 +00:00