Skip to content

Proton VPN credentials write unescaped raw newlines into keyring secrets, corrupting GNOME Keyring files #33

Open

Description

@grold

Environment

  • OS: Arch Linux / Omarchy Linux
  • GNOME Keyring Version: gnome-keyring 1:51.1-1 (also affects 1:50.0-1)
  • Package versions:
    • proton-vpn-cli 1.0.5-1
    • python-proton-keyring-linux 0.2.3-1
    • python-proton-vpn-api-core 5.8.7-1
    • gnome-keyring 1:51.1-1
    • libsecret 0.21.7-1 / 0.21.8.2-1
    • python-keyring 25.7.0-3

Description

When protonvpn stores authentication credentials (such as Password for 'proton-sso-account-...' on 'Proton'), it serializes a JSON payload containing PEM certificates (-----BEGIN PUBLIC KEY-----, -----BEGIN CERTIFICATE-----) with raw literal newline characters inside the secret string rather than escaping them as \n.

In GNOME Keyring file-based storage (~/.local/share/keyrings/*.keyring), entries in passwordless keyrings are stored in standard INI format (key=value), where values must be strictly single-line. Because literal unescaped newlines are written into secret=, the .keyring file becomes malformed across multiple physical lines.

Consequence

On subsequent system boot or session login, gnome-keyring-daemon (tested on 1:51.1-1) fails to parse the file:

gnome-keyring-daemon: keyring was in an invalid or unrecognized format: ~/.local/share/keyrings/Default_keyring.keyring

When this occurs:

  1. gnome-keyring-daemon drops the entire keyring as unparseable.
  2. The system prompts the user with desktop authentication dialogs (e.g., "Authentication required: The login keyring did not get unlocked").
  3. All other application credentials stored in the same keyring become inaccessible.

Malformed Content Example (Sanitized)

[13]
item-type=0
display-name=Password for 'proton-sso-account-xxx' on 'Proton'
secret={"UID": "xxx", "certificate": {"ClientKey": "-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAMHEP/L4WUx/V43288cAdq7Dfjyds8HF+KiBcGX79Xmo=
-----END PUBLIC KEY-----", "Certificate": "-----BEGIN CERTIFICATE-----
MIIB9zCCAamgAwIBAgIFBBKPaOcwBQYDK2VwMDEx...
...
-----END CERTIFICATE-----
", "ExpirationTime": 1792305663, ...}}
mtime=1791811165
ctime=1791635757

Verification & Workaround

Replacing the physical raw newlines in the secret= JSON string with escaped \n characters (collapsing the field into a single line) immediately resolves the parsing failure: gnome-keyring-daemon 1:51.1-1 parses and unlocks the keyring with zero errors.

Proposed Fix

Ensure that serialized JSON strings or certificates containing newlines are sanitized / escaped as single-line strings before writing to the secret storage backend.


Assisted by Gemini 3.8 Flash (Reasoning: Medium)

Activity

  1. jparlay commented on Oct 18, 2026

    @jparlay

    Second independent reproduction, with measurements (Omarchy 4.0.5-1, gnome-keyring 1:51.1-1, proton-vpn-cli 1.0.5-1, python-proton-keyring-linux 0.2.3-1 — 2026-10-18). Everything above checks out against an instrumented case.

    On a passwordless (plaintext INI) default keyring, the secret stored as Password for 'proton-sso-account-…' measured 2,485 bytes unfolding across 17 physical secret= lines in ~/.local/share/keyrings/Default.keyring. From the first such store onward, gnome-keyring-daemon rejected the entire file at the next start:

    gnome-keyring-daemon: keyring was in an invalid or unrecognized format: …/Default.keyring
    

    then dropped the whole collection, not just the Proton item. Everything keyed off it became unreachable at once — Chromium Safe Storage (Chromium silently rotated to a fresh key, so every browser session was lost), gh tokens, mail credentials. Under SDDM autologin there is no PAM password available to unlock or repair anything, so each login ended in a "create a new keyring" prompt.

    Worth keeping the two halves of this bug distinct when routing it:

    Two details from the repair work that may help others debugging this:

    • Only interior newlines corrupt the file. A trailing newline self-heals on the next rewrite (GLib tolerates the resulting blank line), which is why seemingly similar entries behave differently.
    • Full-data repair: fold each multi-line secret= back onto one physical line, escaping \ as \\ and each newline as \n — byte-identical to what the fixed writer produces. g_key_file_get_string() then restores the exact original value and the app keeps working. Verified on 51.1: file parses, all items load, unlock is silent, no errors across reboots.

    Resolution on our machine: deleted the two Proton items and uninstalled proton-vpn-cli entirely — no recurrence since. A fix on the proton side would be genuinely valuable given how reliably this payload wedges the keyring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions