Skip to content

fix: honour XDG_CONFIG_HOME on Windows so the CI matrix can go green - #17

Merged
samlehoy merged 2 commits into
masterfrom
fix/windows-config-dir
Aug 19, 2026
Merged

samlehoy merged 2 commits into
masterfrom
fix/windows-config-dir

Conversation

@samlehoy

Copy link
Copy Markdown
Owner

Both windows-latest legs of the CI matrix have been red since the matrix was added — including on the 0.1.3 release commit. This fixes the cause and corrects the docs that misreported it.

The bug

configDir() checked the platform before the override:

if (platform() === 'win32') return join(process.env.APPDATA ?? …, 'plx');
return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'plx');

So XDG_CONFIG_HOME was honoured everywhere except Windows. tests/config.test.ts points that variable at a fresh temp dir per test for isolation, which meant every Windows test instead shared one real %APPDATA%\plx. A credential written by one case survived into the next, and config.test.ts:43 read back 'arl-value' where it expected ''.

Nothing about the shipped Windows behaviour was broken — only its overridability, and therefore the tests.

The fix

Check the override first, then branch on platform. %APPDATA% stays the Windows default and ~/.config the Unix one; only precedence changes.

Docs

The out-of-scope note treated Windows, Linux and Firefox cookie decryption as one undifferentiated backlog. Two corrections:

  • Windows Chromium is closed, not pending. App-Bound Encryption (Chrome 127+, July 2024) wraps the cookie key in User-DPAPI then SYSTEM-DPAPI, so only a SYSTEM process or elevation_service.exe can unwrap it. Published bypasses are COM hijacking or injection into the elevation service — malware behaviour that would get plx flagged as an infostealer.
  • Firefox was described as key4.db-encrypted. key4.db protects saved logins; cookies.sqlite stores cookie values in plaintext on every OS. That makes Firefox the one cheap backend — and the only realistic route to auto-fetch on Windows — not a hard one.

README now also states plainly that Windows and Linux run plx fine and only lack the auto-fetch shortcut.

Verification

typecheck, lint, build and 116/116 tests pass locally on macOS. The point of this PR is the windows-latest legs — the bug is a Windows bug and macOS cannot prove it fixed. Merge once those are green.

🤖 Generated with Claude Code

samlehoy and others added 2 commits August 19, 2026 15:23
configDir() checked win32 first and returned %APPDATA%\plx unconditionally,
so the explicit override was ignored on exactly one platform. The test suite
points XDG_CONFIG_HOME at a fresh temp dir per test for isolation, which meant
every Windows test instead shared one real %APPDATA%\plx: a credential saved by
one case was still there for the next, and config.test.ts:43 read back
'arl-value' where it expected ''. Both Windows legs of the CI matrix have been
red since the matrix was added.

Check the override before the platform branch. %APPDATA% stays the Windows
default and ~/.config the Unix one; only the precedence changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The out-of-scope note lumped Windows, Linux and Firefox together as "not done
yet", which was wrong in both directions. Windows Chromium is not pending work
but closed: App-Bound Encryption (Chrome 127+) wraps the cookie key in
SYSTEM-DPAPI, and every bypass is malware behaviour. Firefox was listed as
key4.db-encrypted, but key4.db holds logins — cookies.sqlite is plaintext on
every OS, making it the one cheap backend, not a hard one.

Also record why both Windows CI legs were red, and state in the README that
Windows and Linux run plx fine and only lack the auto-fetch shortcut.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
plx 9564961 Commit Preview URL

Branch Preview URL
Aug 19 2026, 08:24 AM

@samlehoy
samlehoy merged commit 7b4670f into master Aug 19, 2026
7 checks passed
@samlehoy
samlehoy deleted the fix/windows-config-dir branch August 19, 2026 08:28
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