XWayland: allow snooping non-character keys with elevated snooping modes

These keys do not represent a security risk to allow apps to snoop since
they can't be used to type passwords etc.

BUG: 474705
FIXED-IN: 6.0
master
Nate Graham 1 year ago
parent 28c27609a4
commit c5a3749a40

@ -65,10 +65,10 @@ KCM.SimpleKCM {
text: i18n("Never")
}
QQC2.RadioButton {
text: i18n("Only Meta, Control, Alt, and Shift keys")
text: i18n("Only non-character keys")
}
QQC2.RadioButton {
text: i18n("All keys, but only while Meta, Ctrl, Alt, or Shift keys are pressed")
text: i18n("As above, plus any key typed while a modifier key is pressed")
}
QQC2.RadioButton {
id: always

@ -35,8 +35,8 @@ enum HiddenPreviews {
enum XwaylandEavesdropsMode {
None,
Modifiers,
Combinations,
NonCharacterKeys,
AllKeysWithModifier,
All
};

@ -117,18 +117,239 @@ public:
Qt::Key_Meta,
};
static const QSet<quint32> characterKeys = {
Qt::Key_Any,
Qt::Key_Space,
Qt::Key_Exclam,
Qt::Key_QuoteDbl,
Qt::Key_NumberSign,
Qt::Key_Dollar,
Qt::Key_Percent,
Qt::Key_Ampersand,
Qt::Key_Apostrophe,
Qt::Key_ParenLeft,
Qt::Key_ParenRight,
Qt::Key_Asterisk,
Qt::Key_Plus,
Qt::Key_Comma,
Qt::Key_Minus,
Qt::Key_Period,
Qt::Key_Slash,
Qt::Key_0,
Qt::Key_1,
Qt::Key_2,
Qt::Key_3,
Qt::Key_4,
Qt::Key_5,
Qt::Key_6,
Qt::Key_7,
Qt::Key_8,
Qt::Key_9,
Qt::Key_Colon,
Qt::Key_Semicolon,
Qt::Key_Less,
Qt::Key_Equal,
Qt::Key_Greater,
Qt::Key_Question,
Qt::Key_At,
Qt::Key_A,
Qt::Key_B,
Qt::Key_C,
Qt::Key_D,
Qt::Key_E,
Qt::Key_F,
Qt::Key_G,
Qt::Key_H,
Qt::Key_I,
Qt::Key_J,
Qt::Key_K,
Qt::Key_L,
Qt::Key_M,
Qt::Key_N,
Qt::Key_O,
Qt::Key_P,
Qt::Key_Q,
Qt::Key_R,
Qt::Key_S,
Qt::Key_T,
Qt::Key_U,
Qt::Key_V,
Qt::Key_W,
Qt::Key_X,
Qt::Key_Y,
Qt::Key_Z,
Qt::Key_BracketLeft,
Qt::Key_Backslash,
Qt::Key_BracketRight,
Qt::Key_AsciiCircum,
Qt::Key_Underscore,
Qt::Key_QuoteLeft,
Qt::Key_BraceLeft,
Qt::Key_Bar,
Qt::Key_BraceRight,
Qt::Key_AsciiTilde,
Qt::Key_nobreakspace,
Qt::Key_exclamdown,
Qt::Key_cent,
Qt::Key_sterling,
Qt::Key_currency,
Qt::Key_yen,
Qt::Key_brokenbar,
Qt::Key_section,
Qt::Key_diaeresis,
Qt::Key_copyright,
Qt::Key_ordfeminine,
Qt::Key_guillemotleft,
Qt::Key_notsign,
Qt::Key_hyphen,
Qt::Key_registered,
Qt::Key_macron,
Qt::Key_degree,
Qt::Key_plusminus,
Qt::Key_twosuperior,
Qt::Key_threesuperior,
Qt::Key_acute,
Qt::Key_mu,
Qt::Key_paragraph,
Qt::Key_periodcentered,
Qt::Key_cedilla,
Qt::Key_onesuperior,
Qt::Key_masculine,
Qt::Key_guillemotright,
Qt::Key_onequarter,
Qt::Key_onehalf,
Qt::Key_threequarters,
Qt::Key_questiondown,
Qt::Key_Agrave,
Qt::Key_Aacute,
Qt::Key_Acircumflex,
Qt::Key_Atilde,
Qt::Key_Adiaeresis,
Qt::Key_Aring,
Qt::Key_AE,
Qt::Key_Ccedilla,
Qt::Key_Egrave,
Qt::Key_Eacute,
Qt::Key_Ecircumflex,
Qt::Key_Ediaeresis,
Qt::Key_Igrave,
Qt::Key_Iacute,
Qt::Key_Icircumflex,
Qt::Key_Idiaeresis,
Qt::Key_ETH,
Qt::Key_Ntilde,
Qt::Key_Ograve,
Qt::Key_Oacute,
Qt::Key_Ocircumflex,
Qt::Key_Otilde,
Qt::Key_Odiaeresis,
Qt::Key_multiply,
Qt::Key_Ooblique,
Qt::Key_Ugrave,
Qt::Key_Uacute,
Qt::Key_Ucircumflex,
Qt::Key_Udiaeresis,
Qt::Key_Yacute,
Qt::Key_THORN,
Qt::Key_ssharp,
Qt::Key_division,
Qt::Key_ydiaeresis,
Qt::Key_Multi_key,
Qt::Key_Codeinput,
Qt::Key_SingleCandidate,
Qt::Key_MultipleCandidate,
Qt::Key_PreviousCandidate,
Qt::Key_Mode_switch,
Qt::Key_Kanji,
Qt::Key_Muhenkan,
Qt::Key_Henkan,
Qt::Key_Romaji,
Qt::Key_Hiragana,
Qt::Key_Katakana,
Qt::Key_Hiragana_Katakana,
Qt::Key_Zenkaku,
Qt::Key_Hankaku,
Qt::Key_Zenkaku_Hankaku,
Qt::Key_Touroku,
Qt::Key_Massyo,
Qt::Key_Kana_Lock,
Qt::Key_Kana_Shift,
Qt::Key_Eisu_Shift,
Qt::Key_Eisu_toggle,
Qt::Key_Hangul,
Qt::Key_Hangul_Start,
Qt::Key_Hangul_End,
Qt::Key_Hangul_Hanja,
Qt::Key_Hangul_Jamo,
Qt::Key_Hangul_Romaja,
Qt::Key_Hangul_Jeonja,
Qt::Key_Hangul_Banja,
Qt::Key_Hangul_PreHanja,
Qt::Key_Hangul_PostHanja,
Qt::Key_Hangul_Special,
Qt::Key_Dead_Grave,
Qt::Key_Dead_Acute,
Qt::Key_Dead_Circumflex,
Qt::Key_Dead_Tilde,
Qt::Key_Dead_Macron,
Qt::Key_Dead_Breve,
Qt::Key_Dead_Abovedot,
Qt::Key_Dead_Diaeresis,
Qt::Key_Dead_Abovering,
Qt::Key_Dead_Doubleacute,
Qt::Key_Dead_Caron,
Qt::Key_Dead_Cedilla,
Qt::Key_Dead_Ogonek,
Qt::Key_Dead_Iota,
Qt::Key_Dead_Voiced_Sound,
Qt::Key_Dead_Semivoiced_Sound,
Qt::Key_Dead_Belowdot,
Qt::Key_Dead_Hook,
Qt::Key_Dead_Horn,
Qt::Key_Dead_Stroke,
Qt::Key_Dead_Abovecomma,
Qt::Key_Dead_Abovereversedcomma,
Qt::Key_Dead_Doublegrave,
Qt::Key_Dead_Belowring,
Qt::Key_Dead_Belowmacron,
Qt::Key_Dead_Belowcircumflex,
Qt::Key_Dead_Belowtilde,
Qt::Key_Dead_Belowbreve,
Qt::Key_Dead_Belowdiaeresis,
Qt::Key_Dead_Invertedbreve,
Qt::Key_Dead_Belowcomma,
Qt::Key_Dead_Currency,
Qt::Key_Dead_a,
Qt::Key_Dead_A,
Qt::Key_Dead_e,
Qt::Key_Dead_E,
Qt::Key_Dead_i,
Qt::Key_Dead_I,
Qt::Key_Dead_o,
Qt::Key_Dead_O,
Qt::Key_Dead_u,
Qt::Key_Dead_U,
Qt::Key_Dead_Small_Schwa,
Qt::Key_Dead_Capital_Schwa,
Qt::Key_Dead_Greek,
Qt::Key_Dead_Lowline,
Qt::Key_Dead_Aboveverticalline,
Qt::Key_Dead_Belowverticalline};
switch (mode) {
case None:
m_filter = {};
break;
case Modifiers:
case NonCharacterKeys:
m_filter = [](int key, Qt::KeyboardModifiers) {
return modifierKeys.contains(key);
return !characterKeys.contains(key);
};
break;
case Combinations:
case AllKeysWithModifier:
m_filter = [](int key, Qt::KeyboardModifiers m) {
return m != Qt::NoModifier || modifierKeys.contains(key);
return m != Qt::NoModifier
|| modifierKeys.contains(key)
|| !characterKeys.contains(key);
};
break;
case All:

Loading…
Cancel
Save