aboutsummaryrefslogtreecommitdiffstats
path: root/webui.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-11-04 08:00:32 +0000
committerGitHub <noreply@github.com>2022-11-04 08:00:32 +0000
commite9c767d8dba884762b39d36fbd7cd43f818acf24 (patch)
treeb1d1a0cb9a445443ec18524b0c3906e94d21a26e /webui.py
parentb2c48091db394c2b7d375a33f18d90c924cd4363 (diff)
parent2913b9f02500049c76c3d1469c086767411cefa9 (diff)
downloadstable-diffusion-webui-gfx803-e9c767d8dba884762b39d36fbd7cd43f818acf24.tar.gz
stable-diffusion-webui-gfx803-e9c767d8dba884762b39d36fbd7cd43f818acf24.tar.bz2
stable-diffusion-webui-gfx803-e9c767d8dba884762b39d36fbd7cd43f818acf24.zip
Merge branch 'master' into 7flash/fix-api-compatibility
Diffstat (limited to 'webui.py')
-rw-r--r--webui.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/webui.py b/webui.py
index 3b21c071..81df09dd 100644
--- a/webui.py
+++ b/webui.py
@@ -141,6 +141,12 @@ def webui():
# after initial launch, disable --autolaunch for subsequent restarts
cmd_opts.autolaunch = False
+ # gradio uses a very open CORS policy via app.user_middleware, which makes it possible for
+ # an attacker to trick the user into opening a malicious HTML page, which makes a request to the
+ # running web ui and do whatever the attcker wants, including installing an extension and
+ # runnnig its code. We disable this here. Suggested by RyotaK.
+ app.user_middleware = [x for x in app.user_middleware if x.cls.__name__ != 'CORSMiddleware']
+
app.add_middleware(GZipMiddleware, minimum_size=1000)
if launch_api: