From 455fee1126ba93f17d475b075d41067793646340 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 1 Jan 2021 18:15:58 +0100 Subject: [PATCH] warn about nonfunctioning options, permanently remove unused ones. If you are affected by this change, please do reach out by filing an issue. --- CHANGELOG.md | 3 +++ mitmproxy/addons/core.py | 4 ++++ mitmproxy/addons/streambodies.py | 15 ------------- mitmproxy/addons/upstream_auth.py | 3 +++ mitmproxy/options.py | 25 ---------------------- mitmproxy/utils/arg_check.py | 1 - test/mitmproxy/addons/test_streambodies.py | 6 ------ 7 files changed, 10 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 190b604cb..6cecf7f73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ If you depend on these features, please raise your voice in * Remove all deprecated pathod and pathoc tools and modules (@Kriechi) * In reverse proxy mode, mitmproxy now does not assume TLS if no scheme is given but a custom port is provided (@mhils) +* Remove the following options: `http2_priority`, `relax_http_form_validation`, `upstream_bind_address`, + `spoof_source_address`, and `stream_websockets`. If you depended on one of them please let us know. + mitmproxy never phones home, which means we don't know how prominently these options were used. (@mhils) * --- TODO: add new PRs above this line --- * ... and various other fixes, documentation improvements, dependency version bumps, etc. diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core.py index 6aa5856db..2034947aa 100644 --- a/mitmproxy/addons/core.py +++ b/mitmproxy/addons/core.py @@ -42,6 +42,10 @@ class Core: "add_upstream_certs_to_client_chain requires the upstream_cert option to be enabled." ) if "body_size_limit" in updated: + if opts.body_size_limit: # pragma: no cover + ctx.log.warn( + "body_size_limit is currently nonfunctioning, " + "see https://github.com/mitmproxy/mitmproxy/issues/4348") try: human.parse_size(opts.body_size_limit) except ValueError: diff --git a/mitmproxy/addons/streambodies.py b/mitmproxy/addons/streambodies.py index c568e944c..e0cd8d7a3 100644 --- a/mitmproxy/addons/streambodies.py +++ b/mitmproxy/addons/streambodies.py @@ -19,13 +19,6 @@ class StreamBodies: Understands k/m/g suffixes, i.e. 3m for 3 megabytes. """ ) - loader.add_option( - "stream_websockets", bool, False, - """ - Stream WebSocket messages between client and server. - Messages are captured and cannot be modified. - """ - ) def configure(self, updated): if "stream_large_bodies" in updated and ctx.options.stream_large_bodies: @@ -54,11 +47,3 @@ class StreamBodies: def responseheaders(self, f): self.run(f, False) - - def websocket_start(self, f): - if ctx.options.stream_websockets: - f.stream = True - ctx.log.info("Streaming WebSocket messages between {client} and {server}".format( - client=human.format_address(f.client_conn.peername), - server=human.format_address(f.server_conn.address)) - ) diff --git a/mitmproxy/addons/upstream_auth.py b/mitmproxy/addons/upstream_auth.py index c0581e27c..dc1a64419 100644 --- a/mitmproxy/addons/upstream_auth.py +++ b/mitmproxy/addons/upstream_auth.py @@ -47,6 +47,9 @@ class UpstreamAuth(): if ctx.options.upstream_auth is None: self.auth = None else: + if ctx.options.upstream_auth: # pragma: no cover + ctx.log.warn("upstream_auth is currently nonfunctioning, " + "see https://github.com/mitmproxy/mitmproxy/issues/4348") self.auth = parse_upstream_auth(ctx.options.upstream_auth) def http_connect(self, f): diff --git a/mitmproxy/options.py b/mitmproxy/options.py index a047358bb..b480045ec 100644 --- a/mitmproxy/options.py +++ b/mitmproxy/options.py @@ -83,10 +83,6 @@ class Options(optmanager.OptManager): "listen_port", int, LISTEN_PORT, "Proxy service port." ) - self.add_option( - "upstream_bind_address", str, "", - "Address to bind upstream requests to." - ) self.add_option( "mode", str, "regular", """ @@ -105,13 +101,6 @@ class Options(optmanager.OptManager): "Enable/disable HTTP/2 support. " "HTTP/2 support is enabled by default.", ) - self.add_option( - "http2_priority", bool, False, - """ - PRIORITY forwarding for HTTP/2 connections. Disabled by default to ensure compatibility - with misbehaving servers. - """ - ) self.add_option( "websocket", bool, True, "Enable/disable WebSocket support. " @@ -122,14 +111,6 @@ class Options(optmanager.OptManager): "Enable/disable raw TCP connections. " "TCP connections are enabled by default. " ) - - self.add_option( - "spoof_source_address", bool, False, - """ - Use the client's IP for server-side connections. Combine with - --upstream-bind-address to spoof a fixed source address. - """ - ) self.add_option( "ssl_insecure", bool, False, "Do not verify upstream server SSL/TLS certificates." @@ -166,11 +147,5 @@ class Options(optmanager.OptManager): TLS key size for certificates and CA. """ ) - self.add_option( - "relax_http_form_validation", bool, False, - """ - Disable HTTP form validation. - """ - ) self.update(**kwargs) diff --git a/mitmproxy/utils/arg_check.py b/mitmproxy/utils/arg_check.py index a0089ee63..44ef971ac 100644 --- a/mitmproxy/utils/arg_check.py +++ b/mitmproxy/utils/arg_check.py @@ -71,7 +71,6 @@ REPLACEMENTS = { "--order": "view_order", "--no-mouse": "console_mouse", "--reverse": "view_order_reversed", - "--no-http2-priority": "http2_priority", "--no-websocket": "websocket", "--no-upstream-cert": "upstream_cert", "--upstream-trusted-confdir": "ssl_verify_upstream_trusted_confdir", diff --git a/test/mitmproxy/addons/test_streambodies.py b/test/mitmproxy/addons/test_streambodies.py index b980ea0b7..d62f869f1 100644 --- a/test/mitmproxy/addons/test_streambodies.py +++ b/test/mitmproxy/addons/test_streambodies.py @@ -29,9 +29,3 @@ def test_simple(): f = tflow.tflow(resp=True) f.response.headers["content-length"] = "invalid" tctx.cycle(sa, f) - - tctx.configure(sa, stream_websockets = True) - f = tflow.twebsocketflow() - assert not f.stream - sa.websocket_start(f) - assert f.stream