From 9bc2d541964d5cbbe91b23b2df33742c5f072abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 20 Sep 2022 14:57:10 +0200 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=94=96=20staging/bugfix=20is=20now?= =?UTF-8?q?=201.8.4.dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .versioneer-lookup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index 2353cdbca..fd66b44e7 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -24,10 +24,10 @@ maintenance 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev fix/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev improve/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev -# staging/bugfix is the branch for preparation of the 1.8.3 bugfix release +# staging/bugfix is the branch for preparation of the 1.8.4 bugfix release # so are any bug/... branches -staging/bugfix 1.8.3 87f4a4e8c967dab147beb6213cbf61cca32bec62 pep440-dev -bug/.* 1.8.3 87f4a4e8c967dab147beb6213cbf61cca32bec62 pep440-dev +staging/bugfix 1.8.4 d0d226f3e0ad0a6436e4f32519bf38a82aa576ca pep440-dev +bug/.* 1.8.4 d0d226f3e0ad0a6436e4f32519bf38a82aa576ca pep440-dev # staging/maintenance is currently the branch for preparation of 1.8.0rc6 # so is regressionfix/... From b87b965fc533120a9bf03825760f3b709309c0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 22 Sep 2022 17:45:33 +0200 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20global=20API=20key?= =?UTF-8?q?=20vs=20session=20sigs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4648 --- src/octoprint/access/users.py | 12 ++++++++---- src/octoprint/server/util/flask.py | 9 +++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/octoprint/access/users.py b/src/octoprint/access/users.py index 6533d68e8..b42785e20 100644 --- a/src/octoprint/access/users.py +++ b/src/octoprint/access/users.py @@ -177,8 +177,10 @@ class UserManager(GroupChangeListener): def cleanup_legacy_hashes(self): pass - def signature_key_for_user(self, username, salt=None): - return self.create_password_hash(username, salt=salt) + def signature_key_for_user(self, username, secret): + return hashlib.sha512( + to_bytes(username, encoding="utf-8", errors="replace") + to_bytes(secret) + ).hexdigest() def add_user(self, username, password, active, permissions, groups, overwrite=False): pass @@ -809,14 +811,16 @@ class FilebasedUserManager(UserManager): self._settings.remove(["accessControl", "salt"]) self._settings.save() - def signature_key_for_user(self, username, salt=None): + def signature_key_for_user(self, username, secret): + if username == "_api": + return super().signature_key_for_user(username, secret) if username not in self._users: raise UnknownUser(username) user = self._users[username] return hashlib.sha512( to_bytes(username + user._passwordHash, encoding="utf-8", errors="replace") - + to_bytes(salt) + + to_bytes(secret) ).hexdigest() def change_user_setting(self, username, key, value): diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 244bd8e20..cdf9052a8 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -433,7 +433,7 @@ def encode_remember_me_cookie(value): name = value.split("|")[0] try: remember_key = userManager.signature_key_for_user( - name, salt=current_app.config["SECRET_KEY"] + name, current_app.config["SECRET_KEY"] ) timestamp = datetime.utcnow().timestamp() return encode_cookie(f"{name}|{timestamp}", key=remember_key) @@ -453,7 +453,7 @@ def decode_remember_me_cookie(value): try: # valid signature? signature_key = userManager.signature_key_for_user( - name, salt=current_app.config["SECRET_KEY"] + name, current_app.config["SECRET_KEY"] ) cookie = decode_cookie(value, key=signature_key) if cookie: @@ -1908,11 +1908,12 @@ class OctoPrintJsonEncoder(flask.json.JSONEncoder): def session_signature(user, session): from octoprint.server import userManager - key = userManager.signature_key_for_user(user, salt=current_app.config["SECRET_KEY"]) + key = userManager.signature_key_for_user(user, current_app.config["SECRET_KEY"]) return hmac.new( key.encode("utf-8"), session.encode("utf-8"), hashlib.sha512 ).hexdigest() def validate_session_signature(sig, user, session): - return hmac.compare_digest(sig, session_signature(user, session)) + user_sig = session_signature(user, session) + return len(user_sig) == len(sig) and hmac.compare_digest(sig, user_sig) From 147d982c875ff581eb3e9823d0e745e2b2dce4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 22 Sep 2022 18:52:06 +0200 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20invalid=20API=20key?= =?UTF-8?q?=20and=20guest=20behaviour=20vs=20CSRF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes second issue discovered in #4648 --- src/octoprint/server/util/__init__.py | 6 +++--- src/octoprint/server/util/csrf.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/octoprint/server/util/__init__.py b/src/octoprint/server/util/__init__.py index 79bf9e05e..5a477b0ab 100644 --- a/src/octoprint/server/util/__init__.py +++ b/src/octoprint/server/util/__init__.py @@ -43,7 +43,7 @@ def loginFromApiKeyRequestHandler(): if loginUserFromApiKey(): _flask.g.login_via_apikey = True except InvalidApiKeyException: - _flask.abort(403) + _flask.abort(403, "Invalid API key") def loginFromAuthorizationHeaderRequestHandler(): @@ -54,7 +54,7 @@ def loginFromAuthorizationHeaderRequestHandler(): if loginUserFromAuthorizationHeader(): _flask.g.login_via_header = True except InvalidApiKeyException: - _flask.abort(403) + _flask.abort(403, "Invalid credentials in Basic Authorization header") class InvalidApiKeyException(Exception): @@ -69,7 +69,7 @@ def loginUserFromApiKey(): user = get_user_for_apikey(apikey) if user is None: # invalid API key = no API key - return False + raise InvalidApiKeyException("Invalid API key") return loginUser(user, login_mechanism="apikey") diff --git a/src/octoprint/server/util/csrf.py b/src/octoprint/server/util/csrf.py index 74821440a..aaa7b133b 100644 --- a/src/octoprint/server/util/csrf.py +++ b/src/octoprint/server/util/csrf.py @@ -77,8 +77,9 @@ def validate_csrf_request(request): # Irrelevant method for CSRF, bypass return - if getattr(flask.g, "login_via_apikey", False): - # API key authorization, bypass + session = getattr(flask, "session", {}) + if len(session) == 0 or session.get("login_mechanism") == "apikey": + # empty session, not a browser context return if is_exempt(request.endpoint): From daa5dbc4d6391aaf202063865b7ef86b51133ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 26 Sep 2022 12:19:26 +0200 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20setting=20CSRF=20coo?= =?UTF-8?q?kie=20on=20cached=20responses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case of a "Not modified" response, the CSRF cookie wasn't added, leading to a loading failure. Closes #4650 --- src/octoprint/server/util/csrf.py | 2 +- src/octoprint/server/views.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/octoprint/server/util/csrf.py b/src/octoprint/server/util/csrf.py index aaa7b133b..b08974af6 100644 --- a/src/octoprint/server/util/csrf.py +++ b/src/octoprint/server/util/csrf.py @@ -65,7 +65,7 @@ def validate_csrf_tokens(cookie, header): def add_csrf_cookie(response): if not isinstance(response, OctoPrintFlaskResponse): - return + response = flask.make_response(response) token = generate_csrf_token() response.set_cookie("csrf_token", token, httponly=False) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 2654a8144..6a9442bf8 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -225,8 +225,7 @@ def login(): _logger.exception("Error processing theming CSS, ignoring") resp = make_response(render_template("login.jinja2", **render_kwargs)) - add_csrf_cookie(resp) - return resp + return add_csrf_cookie(resp) @app.route("/recovery") @@ -258,8 +257,7 @@ def recovery(): _logger.exception("Error adding backup upload size info, ignoring") resp = make_response(render_template("recovery.jinja2", **render_kwargs)) - add_csrf_cookie(resp) - return resp + return add_csrf_cookie(resp) @app.route("/cached.gif") @@ -700,8 +698,7 @@ def index(): if response is None: return abort(404) - add_csrf_cookie(response) - return response + return add_csrf_cookie(response) def _get_render_kwargs(templates, plugin_names, plugin_vars, now): From f334decb33aea263533bee9a2ee389e0ee059f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 26 Sep 2022 17:56:18 +0200 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=90=9B=20Only=20enable=20argon2=20i?= =?UTF-8?q?f=20backend=20is=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We not only import it but also do a quick hash and verify run to make sure the backend actually works, otherwise we only support pbkdf2_sha256. Additionally support multiple hash algorithms and detect which one to use based on the password hash. --- src/octoprint/access/users.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/octoprint/access/users.py b/src/octoprint/access/users.py index b42785e20..5a9debb0b 100644 --- a/src/octoprint/access/users.py +++ b/src/octoprint/access/users.py @@ -10,6 +10,7 @@ import uuid import wrapt from flask_login import AnonymousUserMixin, UserMixin +from passlib.hash import pbkdf2_sha256 from werkzeug.local import LocalProxy from octoprint.access.groups import Group, GroupChangeListener @@ -19,10 +20,22 @@ from octoprint.util import atomic_write, deprecated, generate_api_key from octoprint.util import get_fully_qualified_classname as fqcn from octoprint.util import to_bytes, yaml +password_hashers = [] + try: - from passlib.hash import argon2 as passwordhash -except ImportError: - from passlib.hash import pbkdf2_sha256 as passwordhash + from passlib.hash import argon2 + + # test if we can actually hash and verify, if not we won't use this backend + hash = argon2.hash("test") + argon2.verify("test", hash) + + password_hashers.append(argon2) +except Exception: + logging.getLogger(__name__).warning( + "Argon2 passlib backend is not available, not using it for password hashing" + ) + +password_hashers.append(pbkdf2_sha256) class UserManager(GroupChangeListener): @@ -141,7 +154,7 @@ class UserManager(GroupChangeListener): @staticmethod def create_password_hash(password, *args, **kwargs): - return passwordhash.hash(password) + return password_hashers[0].hash(password) @staticmethod def create_legacy_password_hash(password, salt): @@ -1173,10 +1186,14 @@ class User(UserMixin): if legacy: return self._passwordHash == password - try: - return passwordhash.verify(password, self._passwordHash) - except ValueError: - return False + for password_hash in password_hashers: + if password_hash.identify(self._passwordHash): + try: + return password_hash.verify(password, self._passwordHash) + except ValueError: + pass + + return False def get_id(self): return self.get_name() From 73c199c98c90b05585cd69cb9f5350fd2e5ec24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 27 Sep 2022 13:02:39 +0200 Subject: [PATCH 06/10] =?UTF-8?q?=E2=9C=A8=20Add=20a=20reverse=20proxy=20t?= =?UTF-8?q?est=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will show variables needed for URL generation and cookie suffix generation, both as seen by client and server, and highlight any mismatches. Also links to the reverse proxy FAQ and includes information on which request headers are relevant. Not translated, kept as simple as possible. Not behind a login since none of this information should be news to a client on a properly configured proxy setup. --- src/octoprint/server/util/flask.py | 26 ++-- src/octoprint/server/views.py | 20 +++ src/octoprint/static/js/app/client/base.js | 10 +- .../reverse_proxy_test/reverse_proxy_test.js | 43 ++++++ .../templates/reverse_proxy_test.jinja2 | 130 ++++++++++++++++++ 5 files changed, 217 insertions(+), 12 deletions(-) create mode 100644 src/octoprint/static/js/reverse_proxy_test/reverse_proxy_test.js create mode 100644 src/octoprint/templates/reverse_proxy_test.jinja2 diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index cdf9052a8..263698128 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -470,6 +470,20 @@ def decode_remember_me_cookie(value): raise ValueError("Invalid remember me cookie") +def get_cookie_suffix(request): + """ + Request specific suffix for set and read cookies + + We need this because cookies are not port-specific and we don't want to overwrite our + session and other cookies from one OctoPrint instance on our machine with those of another + one who happens to listen on the same address albeit a different port or script root. + """ + result = "_P" + request.server_port + if request.script_root: + return result + "_R" + request.script_root.replace("/", "|") + return result + + class OctoPrintFlaskRequest(flask.Request): environment_wrapper = staticmethod(lambda x: x) @@ -518,17 +532,7 @@ class OctoPrintFlaskRequest(flask.Request): @cached_property def cookie_suffix(self): - """ - Request specific suffix for set and read cookies - - We need this because cookies are not port-specific and we don't want to overwrite our - session and other cookies from one OctoPrint instance on our machine with those of another - one who happens to listen on the same address albeit a different port or script root. - """ - result = "_P" + self.server_port - if self.script_root: - return result + "_R" + self.script_root.replace("/", "|") - return result + return get_cookie_suffix(self) class OctoPrintFlaskResponse(flask.Response): diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 6a9442bf8..9666e6c60 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -331,6 +331,26 @@ def in_cache(): return abort(404) +@app.route("/reverse_proxy_test") +@app.route("/reverse_proxy_test/") +def reverse_proxy_test(): + from octoprint.server.util.flask import get_cookie_suffix, get_remote_address + + remote_address = get_remote_address(request) + cookie_suffix = get_cookie_suffix(request) + + return render_template( + "reverse_proxy_test.jinja2", + theming=[], + client_ip=remote_address, + server_protocol=request.environ.get("wsgi.url_scheme"), + server_name=request.environ.get("SERVER_NAME"), + server_port=request.environ.get("SERVER_PORT"), + server_path=request.script_root if request.script_root else "/", + cookie_suffix=cookie_suffix, + ) + + @app.route("/") def index(): from octoprint.server import connectivityChecker, printer diff --git a/src/octoprint/static/js/app/client/base.js b/src/octoprint/static/js/app/client/base.js index 1cbf2e871..79870fd86 100644 --- a/src/octoprint/static/js/app/client/base.js +++ b/src/octoprint/static/js/app/client/base.js @@ -107,7 +107,7 @@ return url; }; - OctoPrintClient.prototype.getCookieSuffix = function () { + OctoPrintClient.prototype.getParsedBaseUrl = function () { if (!this.options.baseurl) return ""; try { @@ -121,6 +121,14 @@ var url = new URL(parsed.protocol + "//" + parsed.host + path); } + return url; + }; + + OctoPrintClient.prototype.getCookieSuffix = function () { + if (!this.options.baseurl) return ""; + + var url = this.getParsedBaseUrl(); + var port = url.port || (url.protocol === "https:" ? 443 : 80); if (url.pathname && url.pathname !== "/") { var path = url.pathname; diff --git a/src/octoprint/static/js/reverse_proxy_test/reverse_proxy_test.js b/src/octoprint/static/js/reverse_proxy_test/reverse_proxy_test.js new file mode 100644 index 000000000..fcb991d3d --- /dev/null +++ b/src/octoprint/static/js/reverse_proxy_test/reverse_proxy_test.js @@ -0,0 +1,43 @@ +$(function () { + //~~ OctoPrint client setup + + var OctoPrint = window.OctoPrint; + OctoPrint.options.baseurl = BASE_URL; + + //~~ Lodash setup + + _.mixin({sprintf: sprintf, vsprintf: vsprintf}); + + //~~ View Model + + function ReverseProxyTestViewModel() { + var self = this; + + var url = OctoPrint.getParsedBaseUrl(); + var cookieSuffix = OctoPrint.getCookieSuffix(); + var protocol = url.protocol; + var path = url.pathname || "/"; + + if (path && path !== "/") { + if (path.endsWith("/")) { + path = path.substring(0, path.length - 1); + } + } + + self.serverProtocol = protocol.substring(0, protocol.length - 1); + self.serverName = url.hostname; + self.serverPort = url.port || (url.protocol === "https:" ? 443 : 80); + self.serverPath = path; + self.cookieSuffix = cookieSuffix; + + self.serverProtocolMatch = self.serverProtocol == SERVER_PROTOCOL; + self.serverNameMatch = self.serverName == SERVER_NAME; + self.serverPortMatch = self.serverPort == SERVER_PORT; + self.serverPathMatch = self.serverPath == SERVER_PATH; + self.cookieSuffixMatch = self.cookieSuffix == COOKIE_SUFFIX; + } + + var viewModel = new ReverseProxyTestViewModel(); + + ko.applyBindings(viewModel, document.getElementById("reverse_proxy_test")); +}); diff --git a/src/octoprint/templates/reverse_proxy_test.jinja2 b/src/octoprint/templates/reverse_proxy_test.jinja2 new file mode 100644 index 000000000..a92ab3f1a --- /dev/null +++ b/src/octoprint/templates/reverse_proxy_test.jinja2 @@ -0,0 +1,130 @@ + + + + OctoPrint Reverse Proxy Test + + + + + + + + + + + + + + + {% for url in theming %} + + {% endfor %} + + + + + + + + + + + {% assets "js_client" %} + + {% endassets %} + + + + + + +
+
+ Warning! The used cookie suffix doesn't match between client and server. That means that OctoPrint's + UI won't work properly. Please check your configuration and fix it. +
+ +

+ This page helps you identify issues in your reverse proxy configuration. It will show you information about + some of the variables that OctoPrint uses to set cookies and generate fully qualified URLs. If you see + any mismatches highlighted in red below, that means that something is not configured properly and you + need to fix it. +

+ +

+ The table also shows you the client IP that your server saw you as. Make sure that this client IP is what + OctoPrint should be seeing, and not for example your reverse proxy itself. +

+ +

+ For each variable, information is displayed what influences the value the server sees and thus where to + start debugging in case of any observed mismatches. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableSourceClientServer
Client IPX-Forwarded-For-{{ client_ip }}
ProtocolX-Forwarded-Protocol, X-Scheme or config{{ server_protocol }}
HostX-Forwarded-Host, Host, X-Forwarded-Server or config{{ server_name }}
PortX-Forwarded-Host, Host, X-Forwarded-Port or config{{ server_port }}
PathX-Script-Name or config{{ server_path }}
Cookie SuffixBuilt from port & path{{ cookie_suffix }}
+ +

+ Please refer to the Reverse Proxy FAQ entry + for information on correct configuration and examples. +

+ +
+ + + From 0093d96da4e12195f97010089a50dbb5164fb77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 27 Sep 2022 13:28:28 +0200 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=9A=B8=20Downgrade=20SameSite=20set?= =?UTF-8?q?ting=20to=20Lax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Strict was causing issues for users who navigate to their OctoPrint instance using a custom start page, since `SameSite=Strict` would suppress all cookies in that case, forcing you to login again. --- src/octoprint/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 1735fcb41..fa4999fe3 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -228,7 +228,7 @@ default_settings = { "preemptiveCache": {"exceptions": [], "until": 7}, "ipCheck": {"enabled": True, "trustedSubnets": []}, "allowFraming": False, - "cookies": {"secure": False, "samesite": "strict"}, + "cookies": {"secure": False, "samesite": "lax"}, }, "webcam": { "webcamEnabled": True, From be0d452ab9927c03aee219a27490a1d76de52388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 27 Sep 2022 13:43:32 +0200 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20stale=20session=20re?= =?UTF-8?q?porting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix handling of `stale` reauthRequired in UI and document it. Also send it in case of an `auth` message with an unknown session. Closes #4653 --- docs/api/push.rst | 2 +- src/octoprint/server/util/sockjs.py | 1 + src/octoprint/static/js/app/viewmodels/loginstate.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/api/push.rst b/docs/api/push.rst index a9796b663..158fb3984 100644 --- a/docs/api/push.rst +++ b/docs/api/push.rst @@ -30,7 +30,7 @@ following message types are currently available for usage by 3rd party clients: * ``connected``: Initial connection information, sent only right after establishing the socket connection. See :ref:`the payload data model `. * ``reauthRequired``: A reauthentication of the current login session is required. The ``reason`` parameter in the - payload defines whether a full active login is necessary (values ``logout`` and ``removed``) or a simple passive + payload defines whether a full active login is necessary (values ``logout``, ``stale``, ``removed``) or a simple passive login will suffice (all other values). * ``current``: Rate limited general state update, payload contains information about the printer's state, job progress, accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index 0bc529f56..f6aa9a971 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -305,6 +305,7 @@ class PrinterStateConnection( f"Unknown user/session combo: {user_id}:{user_session}" ) self._on_logout() + self._sendReauthRequired("stale") self._register() diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js index e78f71cc2..6bfb286fb 100644 --- a/src/octoprint/static/js/app/viewmodels/loginstate.js +++ b/src/octoprint/static/js/app/viewmodels/loginstate.js @@ -308,7 +308,7 @@ $(function () { }; self.onDataUpdaterReauthRequired = function (reason) { - if (reason === "logout" || reason === "removed") { + if (reason === "logout" || reason === "stale" || reason === "removed") { self.logout(); } else { self.requestData(); From 2703d528a3fc570386199b4415eac5bcac23d7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 27 Sep 2022 15:46:20 +0200 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=93=9D=20Forgot=20to=20mention=20a?= =?UTF-8?q?=20port=20relevant=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/templates/reverse_proxy_test.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/templates/reverse_proxy_test.jinja2 b/src/octoprint/templates/reverse_proxy_test.jinja2 index a92ab3f1a..801038ec8 100644 --- a/src/octoprint/templates/reverse_proxy_test.jinja2 +++ b/src/octoprint/templates/reverse_proxy_test.jinja2 @@ -101,7 +101,7 @@ Port - X-Forwarded-Host, Host, X-Forwarded-Port or config + X-Forwarded-Host, Host, X-Forwarded-Port, X-Forwarded-Protocol, X-Scheme or config {{ server_port }} From 27a576e352a9b3d9abee89ab92cd02012c0e39dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 27 Sep 2022 15:48:12 +0200 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=94=96=20Preparing=20release=20of?= =?UTF-8?q?=201.8.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/plugins/errortracking/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index 0c1ab7565..a9c4295b7 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -18,10 +18,10 @@ from octoprint.util.version import ( ) SENTRY_URL_SERVER = ( - "https://af30d06358144fb8af076ffd8984136d@o118517.ingest.sentry.io/1373987" + "https://289cde39ce7d410f82280cb5b0bb62e8@o118517.ingest.sentry.io/1373987" ) SENTRY_URL_COREUI = ( - "https://e1d6b5d760f241408382d62a3e7fb416@o118517.ingest.sentry.io/1374096" + "https://af2c0c034c9044889b8cf06163ea00fc@o118517.ingest.sentry.io/1374096" ) SETTINGS_DEFAULTS = {