Commit graph

2848 commits

Author SHA1 Message Date
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
Maximilian Hils
8fa4717fc2
Hardening: unify header validation across HTTP versions (#7343)
* hardening: unify header validation across HTTP versions

This is meant to prevent request smuggling attacks over different HTTP versions.

* docs++, reject transfer-encoding for HTTP/1.0

* [autofix.ci] apply automated fixes

* tests++

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-24 22:45:13 +00:00
Maximilian Hils
03bf350924
improve next layer log message (#7337) 2024-11-23 02:42:06 +00:00
Sujal Singh
fd346055b7
Increase HTTP/2 default flow control window. (#7317)
* increase default flow control window

* fix tests

* fix test

* update changelog

* [autofix.ci] apply automated fixes

* simpler way to override default settings

* acknowledge settings

* document hyper-h2 workaround

* quote RFC

* [autofix.ci] apply automated fixes

* increase MAX_FRAME_SIZE

* update comment

* max out initial window size

* [autofix.ci] apply automated fixes

* increment connection control window

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-11-18 09:26:07 +00:00
8192bytes
bdeeb52911
Proper error handling for corrupted compressed body (#7320)
* Proper error handling for corrupted compressed body

* [autofix.ci] apply automated fixes

* Proper error handling for corrupted compressed body

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-14 17:03:26 +01:00
lukant
c10ff719f7
Fix interaction of modifyheaders addon with stream_large_bodies option (#7286)
* Fix interaction of modifyheaders addon with stream_large_bodies option

`modifyheaders` addon uses `request` and `response` hooks which, when
`stream_large_bodies` is enabled, are called after headers have already
been sent and can no longer be modified.

This commit changes `modifyheaders` addon to use
`requestheaders` and `responseheaders` hooks.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-31 22:08:17 +00:00
Maximilian Hils
69f455b962
Add tun proxy mode on Linux (#7278)
* simplify stream handling callback

* add `tun` proxy mode from mitmproxy_rs

* tun mode: tests++

* [autofix.ci] apply automated fixes

* bump mitmproxy_rs

* fix bugs

* ci: use macOS 13 for builds as 12 is being phased out

* test debugging

* bump mitmproxy_rs

* bump python version in ci, 3.13 is stable now

* nits

* is unshare to blame?

* how about this?

* coverage++

* [autofix.ci] apply automated fixes

* debüg

* debüüg

* debüüüg

* bump mitmproxy_rs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-29 02:34:39 +05:30
Sujal Singh
ae882ffb00
Add support for starting a preconfigured Firefox instance via browser.start command. (#7239)
* add firefox linux support

* [autofix.ci] apply automated fixes

* fix nits

* add MacOS search path

* remove unnecessary import

support for version 3.9 and below was dropped

* fix tests

* coverage

* add windows search path

* changelog

* [autofix.ci] apply automated fixes

* handle case for invalid browser name

* remove socks and ftp

* remove popup

* reduce telemetry

* remove default bookmarks

* [autofix.ci] apply automated fixes

* reduce telemetry

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-19 12:45:51 +02:00
Maximilian Hils
93649e8baf
Set @SECLEVEL=0 if old TLS versions are requested (#7241)
* set `@SECLEVEL=0` if old TLS versions are requested

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-14 19:45:48 +02:00
Fata Nugraha
af88265f5c
Improve HTTP detection heuristic (#7228)
* Improve HTTP checking heuristic

* fix changelog

* Fix checking

* [autofix.ci] apply automated fixes

* simplify condition

---------

Co-authored-by: Fata Nugraha <fata.nugraha@grabtaxi.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-10-04 15:22:26 +00:00
Nicolai Søborg
a44191a9b1
Add --show-ignored-hosts (#6720)
* Add `--show-ignored-hosts`

Maybe a bit counterintuitive, but mitmproxy is very nice even without
the MITM part.  When doing `--ignore-hosts '.*'` it is not possible to
see SNI's, so add new flag to show the raw TCP/UDP streams.

Fixes #6421

* Add tests for `--show-ignored-hosts`

* Changelog for `--show-ignored-hosts`

* [autofix.ci] apply automated fixes

* fixups

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-10-01 15:28:28 +00:00
Rūdolfs Bundulis
72a0448566
Propogate end_stream from downstream http/2 requests (#7196)
* Propogate end_stream from downstream http/2 requests

* [autofix.ci] apply automated fixes

* add test, simply patch
*) add test to check if end_stream is propogated on request / response
*) simplify the patch

* [autofix.ci] apply automated fixes

* fix linting in is_websocket

* adjust websocket test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-09-30 18:49:25 +00:00
Matteo Luppi
e1ea491ad7
expose available web columns to Python (#7205)
* add script to generate all possible web columns

* remove test for now

* Make web_columns.py executable

* [autofix.ci] apply automated fixes

* add back tests

* [autofix.ci] apply automated fixes

* update changelog

* update changelog and add coauthor

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Abhishek-Bohora <abhishek.bohora16@gmail.com>
2024-09-22 19:21:41 +02:00
Maximilian Hils
badb2e52dd
ruff: make mitmproxy_rs first party (#7203) 2024-09-22 07:27:00 +02:00
Maximilian Hils
f8b742753b
Enable HTTP/3 in transparent mode by default (#7202)
* fixup raw quic handling

* enable HTTP/3 in transparent mode by default

* fix nits
2024-09-21 14:29:31 +00:00
Maximilian Hils
358fca3e72
tls_version: QUIC -> QUICv1 (#7201)
* tls_version: QUIC -> QUICv1

this aligns us with what OpenSSL is returning

* tests: add quic dumpfile
2024-09-21 16:22:09 +02:00
Maximilian Hils
8964deda8a
strip HTTPS records ALPN if http3 is disabled (#7185)
* strip HTTPS records ALPN if http3 is disabled

* Update strip_dns_https_records.py

* Update strip_dns_https_records.py

* [autofix.ci] apply automated fixes

* Update strip_dns_https_records.py

* [autofix.ci] apply automated fixes

* Update strip_dns_https_records.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-19 17:42:35 +00:00
Maximilian Hils
b53d2bd19a
Split mitmproxy.proxy.layers.quic into subpackages (#7187)
* individual coverage: skip logic-free __init__ files

* split quic layer into subpackages

this commit should not introduce any functional changes
2024-09-18 22:52:51 +05:30
Maximilian Hils
e7d1ad69b9
Individual coverage: skip logic-free __init__ files (#7186)
individual coverage: skip logic-free __init__ files
2024-09-18 22:37:12 +05:30
Maximilian Hils
68c4e9ff35
proxy server: skip modes without listen_port when calculating conflicts (#7177)
* proxy server: skip modes without listen_port when calculating conflicts

* lint!

* docs++
2024-09-16 17:01:49 +05:30
Denis Stanishevsky
eec3214dfc
Fix of duration in import from HAR (#7179)
* Fix of measurement unit in HAR import, duration is in milliseconds

* Update CHANGELOG.md

* Fixes of "timestamp_end" in test samples

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Denis Stanishevskiy <>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-16 13:12:39 +02:00
Maximilian Hils
9a8f761cf7
Upgrade to mitmproxy_rs 0.8 (#7162)
* upgrade to mitmproxy_rs 0.8

* [autofix.ci] apply automated fixes

* Update pyproject.toml

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-04 23:36:55 +02:00
Matteo Luppi
46c10c030e
add 2 new endpoints for processes extraction and process image (#7136)
* add 2 new endpoints for processes extraction and process image

* [autofix.ci] apply automated fixes

* add review changes

* add tests

* [autofix.ci] apply automated fixes

* nit

* update tests

* [autofix.ci] apply automated fixes

* add fallback image and update tests

* [autofix.ci] apply automated fixes

* fix lint error

* fix tests

* [autofix.ci] apply automated fixes

* try to use base64

* still trying to fix test on win

* [autofix.ci] apply automated fixes

* nit

* [autofix.ci] apply automated fixes

* TRANSPARENT_PNG: use raw bytes to avoid base64 step

* tests: use feature-based detection

* hardening: prevent mime type sniffing

* fixup feature detection

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-09-01 20:22:51 +00:00
Maximilian Hils
f2500dd0ae
Warn if TLS version is unsupported by OpenSSL (#7139)
* warn if TLS version is unsupported by OpenSSL

fix #7138

* [autofix.ci] apply automated fixes

* coverage++

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-31 12:32:12 +05:30
Maximilian Hils
343ad7aa72
DNS resolver: add getaddrinfo fallback, fix test duration (#7122)
* dns addon: add getaddrinfo fallback, fix test duration

* fix docstring

* fix tests

* [autofix.ci] apply automated fixes

* tests++

* [autofix.ci] apply automated fixes

* debug windows

* add Windows workaround

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-29 00:06:58 +05:30
Michele Russo
332f222994
optimize tnetstring parsing (#7121)
* Use memoryview to represent tnetstring

* Allow :data: in pop to be bytes | memory view to accomodate test

* Update CHANGELOG.md

* [autofix.ci] apply automated fixes

* Use str() instead of decode() to avoid one copy

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Keep diff minimal

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Make pop only accept argument of type memory view

* cache `ord()`

---------

Co-authored-by: Michele Russo <michele.russo@huawei.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2024-08-20 19:55:47 +00:00
Gaurav Jain
499e8e8742
Merge https and http3 reverse-proxy modes (#7114)
* Merge https and http3 reverse-proxy modes

* Fix existing tests

* [autofix.ci] apply automated fixes

* mypy

* Preserve http3 reverse-proxy mode

* [autofix.ci] apply automated fixes

* Add tests

* [autofix.ci] apply automated fixes

* Add CHANGELOG entry

* Remove None from transport_protocol type annotations

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-08-20 14:44:38 +00:00
Maximilian Hils
ecf5132e71
QUIC: Support STOP_SENDING frames (#7119)
* handle QUIC `STOP_SENDING` frames

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-20 16:35:10 +02:00
Maximilian Hils
a81a1d3555 StopQuicStream -> StopSendingQuicStream 2024-08-19 22:42:43 +02:00
Maximilian Hils
b488c40f81 start_h3_client -> start_h3_proxy
the previous naming managed to confuse me once, so it shall not do that again
2024-08-19 22:42:43 +02:00
Maximilian Hils
5b10a8aebe testing: integrate MultiPlaybook into Playbook 2024-08-19 22:42:43 +02:00
Maximilian Hils
9c6a9d06a1 http3: remove push support 2024-08-19 22:42:43 +02:00
Gaurav Jain
6bb536e0ff
add addon to update the ports in alt-svc header in reverse mode (#7093)
* Add addon to update the ports in alt-svc header to the port that we're listening on

* [autofix.ci] apply automated fixes

* Add suggested changes

* Add tests

* [autofix.ci] apply automated fixes

* mypy

* style

* [autofix.ci] apply automated fixes

* Add CHANGELOG entry

* [autofix.ci] apply automated fixes

* nits

* [autofix.ci] apply automated fixes

* nit: improve option wording

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2024-08-17 16:20:31 +00:00
Maximilian Hils
0f0c5ee250
Fix urwid deprecation warnings (#7098)
* migrate to new urwid apis

* AttrWrap -> AttrMap
2024-08-14 17:02:14 +02:00