WayfireWM / WayfireWM/wf-shell

Tray tooltip variables are used without checking for escape sequences

Open
#266 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
179
Forks
55
Avg merge
16d 1h
Merged PRs (30d)
3

Description

https://github.com/WayfireWM/wf-shell/blob/3e7576f1a74abf746d3b6c3da914a428bbbd2ca7/src/panel/widgets/tray/item.cpp#L188

both tooltip_title and tooltip_text should be checked for escapable characters before passing to set_markup

The equivalent python code I've written previously to clean this up is

def sanitize_string(self, string):
        """Sanitize a text message so that it doesn't interfere with Pango's XML format"""
        string = string.replace("&", "&")
        string = string.replace("<", "&lt;")
        string = string .replace(">", "&gt;")
        string = string.replace("'", "&#39;")
        string = string.replace("\"", "&#34;")
        return string

And the error can be triggered with this short python code

import gi
gi.require_version("Gtk", "3.0")
gi.require_version('AppIndicator3', '0.1')
# pylint: disable=wrong-import-position,wrong-import-order
from gi.repository import Gtk, Gdk, GLib  # nopep8
from gi.repository import AppIndicator3

window = Gtk.Window()
window.set_title("& WHY")
window.show()
menu = Gtk.Menu()
ind = AppIndicator3.Indicator.new(
    "test",
    "test",
    AppIndicator3.IndicatorCategory.APPLICATION_STATUS)
ind.set_title("& discover")
ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
ind.set_menu(menu)
window.connect('destroy', Gtk.main_quit)
Gtk.main()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/panel/widgets/tray/item.cpp around line 188, where tooltip_title and tooltip_text are passed to set_markup. Use the provided Python reproducer to trigger the issue and inspect how the tooltip values reach that call. Done means both values handle escapable characters before being passed to set_markup.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.