Skip to content

fix(config): store Windows secrets in Credential Manager - #182

Merged
francoischalifour merged 3 commits into
altertable-ai:mainfrom
albert20260301:fix/151-windows-credential-manager
Nov 9, 2026
Merged

francoischalifour merged 3 commits into
altertable-ai:mainfrom
albert20260301:fix/151-windows-credential-manager

Conversation

@albert20260301

@albert20260301 albert20260301 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the remaining Windows credential-protection work in #151. #158 already stopped applying POSIX mode checks to Windows files; this PR replaces the default plaintext fallback there with the current user's Windows Credential Manager.

  • Use generic credentials scoped by the existing stable profile IDs. All native calls go through a fixed Windows PowerShell/.NET wrapper around CredRead/CredWrite/CredDelete.
  • Send account names and secret values as JSON over stdin, not command arguments or dynamically interpolated scripts. Free native buffers and report native failures without logging secret output.
  • Migrate existing file credentials on read, removing plaintext entries only after the native write succeeds. Preserve explicit ALTERTABLE_SECRET_BACKEND=file for CI and add windows for an explicit native-store requirement.
  • Keep macOS Keychain and Unix file behavior unchanged. Native errors fail closed instead of silently writing plaintext.
  • Add a real native credential round-trip/migration test to the existing Windows CI job, with isolated synthetic credentials and cleanup.

Closes #151

Verification

  • Before: three new tests fail because Windows defaults to plaintext and cannot distinguish native-store failures.
  • After: default backend, stdin-only secret transport, get/exists/delete, migration, and failure-safe behavior pass with the injected native process.
  • Full bun run check on pinned Bun 1.4.4 passes: 869 unit tests (one Windows-native test skipped on Linux), 157 black-box tests, 42 browser tests, typechecks/lint/format/generated checks, both knip checks, and packed npm consumer smoke.
  • Real Credential Manager calls must pass in Windows CI before merge. Windows PowerShell is required; environments that cannot access a credential vault may explicitly select the documented file backend.

Windows verification

The real Windows vault test passed: Unicode/multiline round-trip, existence/deletion, no plaintext file for new writes, and removal of a migrated plaintext credential. The Linux/macOS/Windows user-directory checks and CodeQL analysis also passed. Full CI is now green, including canonical repository/integration verification, minimum Bun runtime, all four native compilation/smoke checks, CodeQL, and the real Windows vault test.

@albert20260301

Copy link
Copy Markdown
Contributor Author

@francoischalifour, please review the remaining Windows credential-store fix for #151. Full CI is green, including real Windows Credential Manager Unicode/multiline read/write/delete and plaintext-migration coverage, canonical integration verification, the minimum Bun runtime, and all four native builds.

The existing synchronous secret-store API and macOS/Unix behavior stay unchanged. Windows native calls use a fixed PowerShell wrapper with secret data on stdin; errors fail closed, and migration removes plaintext only after a successful native write. If it has not been reviewed by November 15, I will leave the PR open without another ping.

- Read all Altertable credentials with one CredEnumerate call and reuse the
  snapshot until another CLI process writes, tracked by a revision marker,
  so per-request auth no longer starts PowerShell each time.
- Store blobs as UTF-8 and reject secrets over the 2,560-byte vault limit
  before spawning.
- Report PowerShell absence, timeouts, restricted language mode, missing
  logon-session vaults and Win32 error codes, each with the file-backend
  opt-out.
- Skip deletes for absent credentials and no-op credentials-file rewrites.
@francoischalifour
francoischalifour merged commit 8403a07 into altertable-ai:main Nov 9, 2026
16 checks passed
@albert20260301
albert20260301 deleted the fix/151-windows-credential-manager branch November 9, 2026 11:23
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.

Windows: the file credential store refuses to read its own file ("permissions 666 are too open")

2 participants