Skip to content

fix(auth): tighten stored credential permissions - #76

Merged
ralyodio merged 1 commit into
moshcoder:mainfrom
rissrice2105-agent:fix/credentials-file-permissions
Jul 30, 2026
Merged

fix(auth): tighten stored credential permissions#76
ralyodio merged 1 commit into
moshcoder:mainfrom
rissrice2105-agent:fix/credentials-file-permissions

Conversation

@rissrice2105-agent

Copy link
Copy Markdown
Contributor

Summary

  • enforce owner-only 0600 permissions every time credentials are saved
  • tighten pre-existing world-readable credential files after login refresh
  • add a POSIX regression test for the overwrite case

Why

writeFileSync(..., { mode: 0o600 }) only applies the mode when the file is created. If ~/.moshcode/credentials.json already existed with broader permissions, subsequent logins replaced its token contents while preserving the unsafe mode.

Tests

  • node --test test/auth.test.mjs — 4 passed, 1 POSIX-only test skipped on Windows
  • full suite — 163 passed, 30 skipped; 5 pre-existing failures rely on POSIX signal/shell behavior and do not run cleanly on Windows

GitHub's Ubuntu CI exercises the new permission assertion.

@ralyodio
ralyodio merged commit d6ef72b into moshcoder:main Jul 30, 2026
3 checks passed
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.

2 participants