-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix markup injection issues #236
base: main
Are you sure you want to change the base?
Conversation
merge conflict, otherwise looks fine (but let's tests check it too) |
81f3f70
to
be5c363
Compare
4efac67
to
a224c12
Compare
This fixes some (theoretical) markup injection problems. I believe none of the strings that I escape here will ever contain "<" or "&", but it is always safer to escape.
a224c12
to
fd9ff2f
Compare
@@ -96,6 +98,20 @@ def check_update(vm) -> bool: | |||
return True | |||
return False | |||
|
|||
def _escape_str(s: Union[str, float, int]) -> Union[str, float, int]: | |||
# pylint: disable=unidiomatic-typecheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylint was right here, use isinstance()
@@ -87,19 +88,21 @@ def setup_menu(self): | |||
self.tray_menu.set_reserve_toggle_size(False) | |||
|
|||
if self.vms_needing_update: | |||
self.tray_menu.append(TextItem(_("<b>Qube updates available!</b>"))) | |||
self.tray_menu.append(TextItem("Qube updates available!")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better apply _()
to the string constant (tools extracting strings for translation will be happier).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #236 +/- ##
==========================================
- Coverage 93.43% 93.08% -0.35%
==========================================
Files 57 58 +1
Lines 10999 11068 +69
==========================================
+ Hits 10277 10303 +26
- Misses 722 765 +43 ☔ View full report in Codecov by Sentry. |
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024121519-4.3&flavor=pull-requests Test run included the following:
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024111705-4.3&flavor=update
Failed tests9 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/119126#dependencies 3 fixed
Unstable tests
|
FWIW openQA says:
|
This fixes some (theoretical) markup injection problems. I believe none of the strings that I escape here will ever contain "<" or "&", but it is always safer to escape.