From 64c21ba8f051051ae3824ddcdd3fe60d5a5f587e Mon Sep 17 00:00:00 2001 From: Billy Richardson Date: Sun, 24 Apr 2022 09:21:13 -0700 Subject: [PATCH 01/10] :pencil2: Documentation spelling fixes (#4497) --- docs/api/datamodel.rst | 2 +- docs/configuration/config_yaml.rst | 2 +- docs/development/virtual_printer.rst | 2 +- docs/features/accesscontrol.rst | 2 +- docs/plugins/hooks.rst | 2 +- docs/plugins/python3_migration.rst | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api/datamodel.rst b/docs/api/datamodel.rst index 24a10f904..595c91d0d 100644 --- a/docs/api/datamodel.rst +++ b/docs/api/datamodel.rst @@ -649,7 +649,7 @@ Permission record * - ``dangerous`` - 1 - boolean - - Whether the permission should be considered dangerous due to a high reponsibility (true) or not (false). + - Whether the permission should be considered dangerous due to a high responsibility (true) or not (false). * - ``default_groups`` - 1 - List of string diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index c4dd73a5d..7ab77b0e2 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -452,7 +452,7 @@ Use the following settings to enable or disable OctoPrint features: # whether G90/G91 also influence absolute/relative mode of extruders g90InfluencesExtruder: false - # Replace all special characters and spaces with text equivalent to make them univerally compatible. + # Replace all special characters and spaces with text equivalent to make them universally compatible. # Most OS filesystems work fine with unicode characters, but just in case you can revert to the # older behaviour by setting this to true. enforceReallyUniversalFilenames: false diff --git a/docs/development/virtual_printer.rst b/docs/development/virtual_printer.rst index 5e7a31e4d..f0d96138f 100644 --- a/docs/development/virtual_printer.rst +++ b/docs/development/virtual_printer.rst @@ -216,7 +216,7 @@ There many configuration options via ``config.yaml`` for the virtual printer tha # Enable virtual EEPROM # If enabled, a file `eeprom.json` will be created in the plugin data folder - # to enable settings persistence across connections. Enables M500/1/2/4 commmands + # to enable settings persistence across connections. Enables M500/1/2/4 commands # And a selection of other settings commands. Responses modeled on Marlin 2.0 enable_eeprom: true diff --git a/docs/features/accesscontrol.rst b/docs/features/accesscontrol.rst index 1c3ee2583..218e3bb9c 100644 --- a/docs/features/accesscontrol.rst +++ b/docs/features/accesscontrol.rst @@ -133,7 +133,7 @@ Example: Your PC has an IP address of ``192.168.23.42`` and a subnet mask of The easy way: Using the OctoPrint-AutoLoginConfig plugin ........................................................ -The easist way to configure AutoLogin is to install the +The easiest way to configure AutoLogin is to install the `OctoPrint-AutoLoginConfig plugin `_ via the plugin manager. diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index f19a0fefe..43a4f562f 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -1939,7 +1939,7 @@ octoprint.timelapse.capture.post Perform specific actions after capturing a timelapse frame. ``filename`` will be the path of the frame that should have been saved. - ``sucesss`` indicates whether the capture was successful or not. + ``success`` indicates whether the capture was successful or not. :param str filename: The path of the frame that should have been saved. :param boolean success: Indicates whether the capture was successful or not. diff --git a/docs/plugins/python3_migration.rst b/docs/plugins/python3_migration.rst index 170e039e7..cbf9ccaf4 100644 --- a/docs/plugins/python3_migration.rst +++ b/docs/plugins/python3_migration.rst @@ -336,7 +336,7 @@ As a summary, follow this checklist to migrate your plugin to be compatible to b # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals - * Thorougly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer + * Thoroughly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer division, relative imports from your plugin package and how the results of ``map``, ``filter`` and ``zip`` are used in your code, as those have proven to be the biggest issues during past migrations. * Once everything works under both Python versions and you've prepared a new release of your plugin (don't forget to From 885ca31168957533213ccbf471717d60afebe730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 4 May 2022 11:28:25 +0200 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20Fix=20nightly=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The action needed an upgrade due to a behaviour change in latest git. --- .github/workflows/nightly_merge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly_merge.yml b/.github/workflows/nightly_merge.yml index fc74e5415..089f44c8c 100644 --- a/.github/workflows/nightly_merge.yml +++ b/.github/workflows/nightly_merge.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 0 - name: 🔀 Merge master into maintenance - uses: robotology/gh-action-nightly-merge@v1.3.2 + uses: robotology/gh-action-nightly-merge@v1.3.3 with: stable_branch: "master" development_branch: "maintenance" @@ -24,7 +24,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 🔀 Merge maintenance into devel - uses: robotology/gh-action-nightly-merge@v1.3.2 + uses: robotology/gh-action-nightly-merge@v1.3.3 with: stable_branch: "maintenance" development_branch: "devel" From 700034d028ff3518b563a7b4ba4dacc920142d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 10 May 2022 20:56:48 +0200 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Set=20remember=5F?= =?UTF-8?q?me=20cookie=20http=20only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/server/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index bcb8f84bd..2bddf7eff 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -1352,6 +1352,7 @@ class Server: app.config["TEMPLATES_AUTO_RELOAD"] = True app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False + app.config["REMEMBER_COOKIE_HTTPONLY"] = True # we must not set this before TEMPLATES_AUTO_RELOAD is set to True or that won't take app.debug = self._debug From 8087528e4a7ddd15c7d95ff662deb5ef7de90045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 May 2022 13:02:52 +0200 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Sanitize=20and=20?= =?UTF-8?q?validate=20login=20redirect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes an XSS and an open redirect issue. --- src/octoprint/server/views.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 235e15f01..d1db66b26 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -8,6 +8,7 @@ import logging import os import re from collections import defaultdict +from urllib.parse import urlparse from flask import ( Response, @@ -170,7 +171,16 @@ def _add_additional_assets(hook): def login(): from flask_login import current_user - redirect_url = request.args.get("redirect", request.script_root + url_for("index")) + default_redirect_url = request.script_root + url_for("index") + redirect_url = request.args.get("redirect", default_redirect_url) + + parsed = urlparse(redirect_url) # check if redirect url is valid + if parsed.scheme != "" or parsed.netloc != "": + _logger.warning( + f"Got an invalid redirect URL with the login attempt, misconfiguration or attack attempt: {redirect_url}" + ) + redirect_url = default_redirect_url + permissions = sorted( filter( lambda x: x is not None and isinstance(x, OctoPrintPermission), From 5ef16773c89df25be4c10b8adf38988b549b3f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 May 2022 13:03:40 +0200 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Escape=20requeste?= =?UTF-8?q?d=20user=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes an XSS issue. --- src/octoprint/templates/login.jinja2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/templates/login.jinja2 b/src/octoprint/templates/login.jinja2 index adca8c613..252e33dbd 100644 --- a/src/octoprint/templates/login.jinja2 +++ b/src/octoprint/templates/login.jinja2 @@ -69,12 +69,12 @@
{{ _('Server is currently offline.') }} {{ _('Reconnect...') }}
{% if user_id %}

- {{ _('The following account is required:') }} {{ user_id }} + {{ _('The following account is required:') }} {{ user_id|e }}

{% elif logged_in %}

{{ _('An account with the following permissions is required:') }} {{ permission_names|join(", ") }}

{% endif %} - + {{ _('Forgot password?') }}