Skip to content

chat: create session files with 0600 owner-only permissions#366

Merged
tbckr merged 1 commit into
tbckr:mainfrom
SAY-5:fix-355-session-file-perms
May 5, 2026
Merged

chat: create session files with 0600 owner-only permissions#366
tbckr merged 1 commit into
tbckr:mainfrom
SAY-5:fix-355-session-file-perms

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #355. Chat session files held conversation history but were created with 0644 (world-readable) via os.Create, and existing files were reopened with defaultFilePermissions = 0755; this commit changes the constant to 0600 and replaces os.Create with os.OpenFile(..., O_WRONLY|O_CREATE|O_TRUNC, 0600) so sessions are owner-only on creation and on rewrite. Added a regression test in pkg/chat/filesystem_test.go that asserts info.Mode().Perm() == 0600 on both new and reopened session files.

Signed-off-by: SAY-5 <saiasish.cnp@gmail.com>
@SAY-5 SAY-5 requested a review from tbckr as a code owner May 5, 2026 10:59
@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.82%. Comparing base (abd2da9) to head (7df7a1b).
⚠️ Report is 329 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #366      +/-   ##
==========================================
+ Coverage   75.80%   78.82%   +3.01%     
==========================================
  Files          20       21       +1     
  Lines        1298     1143     -155     
==========================================
- Hits          984      901      -83     
+ Misses        226      154      -72     
  Partials       88       88              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tbckr tbckr merged commit d29d346 into tbckr:main May 5, 2026
7 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.

security: chat session files created with world-readable permissions (0644/0755)

2 participants