diff --git a/backend/open_webui/__init__.py b/backend/open_webui/__init__.py index 92cadefe7c..4369cf4b58 100644 --- a/backend/open_webui/__init__.py +++ b/backend/open_webui/__init__.py @@ -38,7 +38,7 @@ def serve( typer.echo('Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.') if not KEY_FILE.exists(): typer.echo(f'Generating a new secret key and saving it to {KEY_FILE}') - KEY_FILE.write_bytes(base64.b64encode(random.randbytes(12))) + KEY_FILE.write_bytes(base64.b64encode(random.randbytes(24))) typer.echo(f'Loading WEBUI_SECRET_KEY from {KEY_FILE}') os.environ['WEBUI_SECRET_KEY'] = KEY_FILE.read_text() diff --git a/backend/start.sh b/backend/start.sh index 9e65465095..e832c08600 100755 --- a/backend/start.sh +++ b/backend/start.sh @@ -38,7 +38,7 @@ if [[ -z "${WEBUI_SECRET_KEY:-}" && -z "${WEBUI_JWT_SECRET_KEY:-}" ]]; then if [[ ! -f "$KEY_FILE" ]]; then echo "Generating new WEBUI_SECRET_KEY..." - head -c 12 /dev/random | base64 > "$KEY_FILE" + head -c 24 /dev/random | base64 > "$KEY_FILE" fi echo "Loading WEBUI_SECRET_KEY from ${KEY_FILE}"