Commit graph

830 commits

Author SHA1 Message Date
Copilot
6bc7f0a4f2
Rename mitmweb XSRF cookie to _mitmproxy_xsrf to recover broken Firefox sessions (#8224)
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2026-05-12 12:30:47 +00:00
Ariel
d482bbaa20
web: Reduce FlowTable Redux subscriptions from O(rows) to O(1) (#8104)
* web: Reduce FlowTable Redux subscriptions from O(rows) to O(1)

Lift shared state (displayColumnNames, flowIndex) from per-row/per-cell
useAppSelector calls to the FlowTable parent component. This eliminates
N identical Redux subscriptions across all visible rows.

Changes:
- FlowTable.tsx: Fetch displayColumnNames from state.options.web_columns
  in mapStateToProps; pass as prop to FlowRow along with flowIndex.
- FlowRow.tsx: Accept displayColumnNames and flowIndex as props instead
  of useAppSelector. Remove unused useAppSelector import.
- FlowColumns.tsx: Accept optional flowIndex prop in index column;
  use it instead of per-cell useAppSelector(_listIndex).
- FlowTableHead.tsx: Add null guard on displayColumnNames for
  edge-case during initial state hydration.
- FlowRowSpec.tsx: Update test to pass new required props.

* [autofix.ci] apply automated fixes

* fix: pass flowIndex prop in FlowColumnsSpec snapshot test

The index column now uses flowIndex prop instead of
useAppSelector. Pass flowIndex={0} in the generic column
render loop so the snapshot matches the expected numeric
output.

* address review feedback: rename flowIndex to rowNumber, remove defensive guards

- Rename flowIndex → rowNumber per reviewer suggestion
- Make rowNumber required in FlowColumnProps (never undefined)
- Remove unnecessary || [] null guard in FlowTableHead
- Read displayColumnNames from test store instead of hardcoding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

* fix: use list position (not view position) for # column

rowNumber now comes from _listIndex (insertion order) instead of
vScroll.start + idx (view position). This preserves the original
behavior where the # column shows the flow's arrival order regardless
of sorting or filtering.

Added test to verify index column displays rowNumber + 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

* docs: add CHANGELOG entry for FlowTable optimization

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Ariel <ariel@captaintech.io>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2026-04-10 14:39:20 +00:00
Ariel
b34f397b4f
fix(web): allow clearing body content to empty in editor (#8149)
* fix(web): allow clearing body content to empty in editor

The body editor's save function used `editedContent || content || ""`
which treats empty string as falsy, falling back to the original body
content. This makes it impossible to clear a body to empty via the
Edit button — the save always sends the original content.

Changed to `editedContent ?? content ?? ""` so that only `undefined`
(user didn't edit) falls back, while empty string is sent as-is.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

* test: move body edit tests into HttpMessageSpec.tsx

Move the two body-edit tests from the separate HttpMessageEditSpec.tsx
into HttpMessageSpec.tsx as requested in review. The CodeEditor mock is
now file-scoped, which simplifies the edit-mode snapshot (CodeMirror DOM
replaced by a lightweight textarea stub).

* Update CHANGELOG.md

Co-authored-by: Matteo Luppi <100372313+lups2000@users.noreply.github.com>

* test: use conditional CodeEditor mock to preserve snapshot

Use a mockUseCodeEditor flag so the real CodeEditor renders by default
(keeping the existing snapshot unchanged) and only the body-edit tests
switch to the textarea mock. Rename CVD → cvd for consistency.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
2026-04-08 16:49:05 +02:00
skrattara
ef48ecbc14
Mitmweb: Add number of selected flows in the footer (#8057)
* Mitmweb: Add number of selected flows in the footer

* [autofix.ci] apply automated fixes

* Mitmweb: Fix failing tests for #8057

* [autofix.ci] apply automated fixes

* Resolve https://github.com/mitmproxy/mitmproxy/pull/8057#discussion_r2744939186

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-31 13:42:21 +01:00
Maximilian Hils
e6aa924bb4
eslint: consistent-type-imports (#7975)
* eslint: consistent-type-imports

* [autofix.ci] apply automated fixes

* fix tests

* more types

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-02 01:44:09 +01:00
DNEGEL3125
f51edd5cba
Fix TypeScript build (#7988)
* Fix TypeScript build

- Add package `@types/react`
- Remove `@ts-expect-error no popover support yet` in `Popover.tsx`

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-02 01:39:38 +01:00
xBZZZZ
872f900125
mitmweb: show intercept filter tag at the bottom for default options (#8026) 2026-01-02 00:33:29 +01:00
Maximilian Hils
4c0013aa7d
Update node.js version (#7992)
update node version
2025-11-24 18:46:06 +00:00
Maximilian Hils
2607487981
Move mitmweb to Vite (#7971)
* Partially Revert "Web: harden `xsrf_token` usage (#7491)"

This reverts commit b761cb46c4.

The reason for this revert is that it's incompatible with Vite's
server (https://github.com/mitmproxy/mitmproxy/issues/7969).

We keep the parts that are compatible, and add an additional
`Sec-Fetch-Site` check for for all requests.

* use type imports for Vite compatibility

* make flow columns work with function name minification

* make modals work with function name minification

* vite: move assets

* web: switch builds to vite

* move to vite

* vite: move css and js

* update CHANGELOG

* [autofix.ci] apply automated fixes

* fix test failures

* fix static viewer

* obtain xsrf cookie lazily

* split js/css bundles into app/vendor

* [autofix.ci] apply automated fixes

* update compiled assets

* fix nits

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-13 18:05:51 +00:00
Keshav Krishna
9e22acffcb
feat: Make TCP inactivity timeout configurable (#7910)
* feat: Make TCP inactivity timeout configurable (currently fixed at 10 minutes) #7909

* docs: updated CHANGELOG

* [autofix.ci] apply automated fixes

* fix: add tests

* fix: testcase

* fix nits:

- We currently only add command line flags for the most important options. `--set tcp_timeout=10` is the recommended approach for now.
- Move timeout to the "wait for close" part specifically.

---------

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-11-11 12:27:39 +00:00
Matteo Luppi
40f345204c
Web: Show Local timezone in the Timing tab (#7804)
* show local datetime

* Add TZ=UTC in test script

* update changelog

* review changes

* [autofix.ci] apply automated fixes

* review changes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-08 08:08:30 +02:00
Maximilian Hils
b5ac8e62ea
add CSS and JS syntax highlighting (#7749)
* add CSS and JS syntax highlighting

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-01 13:19:14 +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
Matteo Luppi
3ead2ab150
Web: Fix crash when no explicit Server-Connection is logged (#7734)
* fix bug

* update changelog

* nit review
2025-05-28 13:55:04 +02:00
Maximilian Hils
5e15aacae5
Web: simplify connection state reducer (#7728)
* web: simplify connection state reducer

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-26 18:57:25 +02:00
Maximilian Hils
1207e9d2e8
web: account for race conditions during flow fetching (#7729)
* web: account for race conditions during flow fetching

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-25 16:43:01 +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
Maximilian Hils
d7c36bb18b
web: remove unused prop-types dependency (#7722) 2025-05-23 07:35:15 +02:00
Maximilian Hils
a6814fec48
web: move eventlog reducer off immer (#7714)
* web: move eventlog reducer off immer

* web: add eventlog benchmark
2025-05-19 18:04:17 +02:00
Maximilian Hils
e12bb695c5
fix display of ipv6 addresses (#7700)
* fix display of ipv6 addresses

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-14 19:16:26 +02:00
Maximilian Hils
76f407d709
web: Upgrade to CodeMirror 6 (#7709)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-14 17:30:11 +02:00
Maximilian Hils
b49264cfbd
web: upgrade dependencies (#7707) 2025-05-13 22:56:11 +02:00
Maximilian Hils
6b0309f77a
web: misc improvements (#7706)
Co-authored-by: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
2025-05-12 19:31:18 +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
Maximilian Hils
eea4addf00
Web: fix nits (#7693)
* remove tabs.isInitial

this was not used in the first place

* fix docs links

* fix headerlookup

WeakMap allows us to finally have proper cache invalidation

* store capture tab in url state
2025-05-05 11:13:50 +02:00
Matteo Luppi
01a5cceeac
[web] replay multiple selected flows (#7674)
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-04-29 12:45:19 +02:00
Matteo Luppi
519200e6d2
[web] add multiple flow selection (#7319)
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-04-27 12:21:50 +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
d0a35dcf9b
introduce new contentview API (#7623) 2025-04-21 14:56:58 +02:00
Matteo Luppi
3ed7a63336
Local mode UX enhancement in mitmweb (#7643)
* improve local mode UI/UX

* update tests
2025-04-11 11:37:01 +02:00
Matteo Luppi
f33f4dd1d6
Fix mitmweb crash when searching/highlighting by ~h/~hq/~hs (#7652)
* check for undefined headers

* update changelog
2025-04-10 22:05:18 +02:00
Matteo Luppi
5f28814482
Adjust popover anchor positioning (#7642)
* adjust popover position

* update changelog
2025-04-09 23:34:03 +02: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
Emanuele Micheletti
f373ccf45b
Preventing mitmweb crash when viewing flows with undefined headers (#7595)
* fix: check on msg.header

fix #7557

* changelog

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-11 22:23:24 +01:00
Maximilian Hils
395e641573
Ensure that all mitmweb options have help text. (#7563)
docs++
2025-02-16 21:46:30 +00:00
Maximilian Hils
3915c5af78
Revise Proxy Mode Docs (#7545)
* revise proxy mode documentation

* docs++

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-09 12:27:07 +01:00
Maximilian Hils
0bd573a599 web: add password-based authentication 2025-02-05 23:37:33 +01:00
Matteo Luppi
385800f07f
web: copy request/response data to clipboard (#7352)
* create ui component for copying content

* write function to copy viewcontentdata to clipboard

* add type string to url

* call the endpoint to fetch the full content

* update snapshots

* disable button after copying text

* update changelog

* remove disable on copy button

* [autofix.ci] apply automated fixes

* disable copy button while fetching

* [autofix.ci] apply automated fixes

* adjust isFetching and isCopied position

* hide copy button if there is no content

* update snapshot

* Delete web/src/templates/index.html

* adjust naming convention

* update test

* update snapshots

* nits

* add async/await

* [autofix.ci] apply automated fixes

* improve test coverage

* improve even more test coverage

* test coverage final improvement

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-02-03 23:37:40 +00: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
Matteo Luppi
18a29df7d0
Improve typing FilterInput component (#7426)
improve typing FilterInput component
2025-01-01 13:00:39 +01:00
Matteo Luppi
2181669f1f
Update options ui duck to rtk (#7368)
* use rtk in modal duck

* adapt flow duck to rtk

* export HIDE_MODAL event type

* change object to string in selectTab

* [autofix.ci] apply automated fixes

* update options ui duck to rtk

* [autofix.ci] apply automated fixes

* add explaining comment

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-31 14:55:03 +01:00
Matteo Luppi
e0434726f3
Exposing 'localModeUnavailable' to the frontend (#7390)
* expose localModeUnavailable

* adapt frontend

* update gen file

* [autofix.ci] apply automated fixes

* add default description

* style

* use 'localModeUnavailable' to check

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-11 16:57:19 +01:00
Matteo Luppi
0045c1f31b
allow single click to edit URL request (#7385)
* allow single click to edit URL request

* update changelog

* [autofix.ci] apply automated fixes

* update changelog

* use 'selectAllOnClick' instead of 'setCursorOnClick'

* remove 'selectAllOnClick' from capture tab page

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-10 21:19:06 +01:00
Maximilian Hils
016f311944
Implement Cache-Busting for mitmweb (#7386)
* cache-bust front end artifacts

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-10 08:07:35 +01:00
Matteo Luppi
6dce751e62
update commandBar duck to RTK (#7370) 2024-12-04 09:42:48 +01:00
Matteo Luppi
34df78c7f3
Update flow.ts and modal.ts ducks to RTK (#7311)
* use rtk in modal duck

* adapt flow duck to rtk

* export HIDE_MODAL event type

* change object to string in selectTab

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-28 19:11:07 +01:00
Matteo Luppi
006f8c97c4
Invert check for unsupported platforms in local mode (mitmweb) (#7349)
invert the check for unsupported platform in local mode
2024-11-28 19:10:05 +01:00
Maximilian Hils
999562a6e2
Align web/gen and ruff format (#7342)
align web/gen and ruff format
2024-11-23 06:20:26 +01: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