Skip to content

Split-gpg2 fails in Flatpak Evolution with "command filtered out" #10340

@jay-okay

Description

@jay-okay

Qubes OS release

  • Qubes 4.3-rc2
  • split-gpg2-1.1.10-1.fc42.noarch
  • Evolution 3.58.0 via Flathub

Brief summary

Opening an encrypted email in Evolution installed with Flatpak attempts to access the decryption key through split-gpg2. On the vault side, split-gpg2 errors out with "command filtered out".

Split-gpg2 works correctly in the email qube from the commandline, and from a shell inside the Evolution Flatpak (i.e. shell launched with flatpak enter $EVOLUTION_PID bash).

This appears to be due to Evolution's gpg client sending "OPTION xauthority", which split-gpg2 denies. Issue goes away by adding xauthority to the dict returned by default_options().

Steps to reproduce

  • Set up split-gpg2 per instructions
  • Attempt to open encrypted email in Flatpak Evolution

Expected behavior

I get prompted to allow/deny PKDECRYPT. After allowing the operation, email message gets decrypted.

Actual behavior

Split-gpg2 errors with "command filtered out"

Relevant debug log from split-gpg2:

Using GnuPG home directory /home/user/.gnupg
C <<<: OK Pleased to meet you, process 3599
C >>>: RESET
A <<<: RESET
A >>>: OK
C <<<: OK
C >>>: OPTION ttyname=/dev/tty7
C <<<: OK
C >>>: OPTION display=:0
C <<<: OK
C >>>: OPTION xauthority=/run/flatpak/Xauthority

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/splitgpg2/__init__.py", line 720, in command_OPTION
    action, opts = self.options[untrusted_name]
                   ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: b'xauthority'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/splitgpg2/__init__.py", line 524, in handle_command
    await command(untrusted_args=untrusted_args)
  File "/usr/lib/python3.13/site-packages/splitgpg2/__init__.py", line 723, in command_OPTION
    raise Filtered from e
splitgpg2.Filtered

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/splitgpg2/__init__.py", line 720, in command_OPTION
    action, opts = self.options[untrusted_name]
                   ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: b'xauthority'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/splitgpg2/__init__.py", line 524, in handle_command
    await command(untrusted_args=untrusted_args)
  File "/usr/lib/python3.13/site-packages/splitgpg2/__init__.py", line 723, in command_OPTION
    raise Filtered from e
splitgpg2.Filtered
C <<<: ERR 67109888 Command filtered by split-gpg2.
command filtered out; Closing!
C >>>: 

Additional information

The issue appears to be caused by Evolution's gpg sending OPTION xauthority=/run/flatpak/Xauthority, which is filtered out.

The issue can be fixed (?) by changing splitgpg2/__init__.py by adding b'xauthority': (OptionHandlingType.fake, b'OK') to the dictionary returned by default_options() at line 570. This edit resolves the issue and decrypting email works as I expect, but I don't know if there are unintended/unwanted side effects to making this change.

My modified default_options() for reference:

   @staticmethod
    def default_options() -> Dict[bytes, Tuple[OptionHandlingType, Optional[bytes]]]:
        return {
            b'xauthority': (OptionHandlingType.fake, b'OK'),    # This line is added
            b'ttyname': (OptionHandlingType.fake, b'OK'),
            b'ttytype': (OptionHandlingType.fake, b'OK'),
            b'display': (OptionHandlingType.fake, b'OK'),
            b'lc-ctype': (OptionHandlingType.fake, b'OK'),
            b'lc-messages': (OptionHandlingType.fake, b'OK'),
            b'putenv': (OptionHandlingType.fake, b'OK'),
            b'pinentry-mode': (OptionHandlingType.fake, b'ERR 67108924 Not supported <GPG Agent>'),
            b'allow-pinentry-notify': (OptionHandlingType.fake, b'OK'),
            b'agent-awareness': (OptionHandlingType.verify, b'2.1.0'),
        }