Skip to content

Comments

fix(security): use 0o600 permissions for session transcript files#8751

Open
revenuestack wants to merge 1 commit intoopenclaw:mainfrom
revenuestack:fix/session-transcript-permissions
Open

fix(security): use 0o600 permissions for session transcript files#8751
revenuestack wants to merge 1 commit intoopenclaw:mainfrom
revenuestack:fix/session-transcript-permissions

Conversation

@revenuestack
Copy link

@revenuestack revenuestack commented Feb 4, 2026

Session transcript .jsonl files were being created with 0o644 (world-readable) permissions instead of 0o600 (user-only). These files may contain sensitive conversation data including accidentally shared API keys or tokens.

This fix applies mode: 0o600 to all session transcript file writes to match the security model used by other sensitive files like openclaw.json and auth-profiles.json.

Fixes #7862

Greptile Overview

Greptile Summary

This PR updates session transcript .jsonl creation/reset paths to write with mode: 0o600 (owner read/write only) instead of relying on defaults, aligning transcript files with other sensitive local state (e.g., config/auth stores).

Changes touch:

  • src/config/sessions/transcript.ts: ensureSessionHeader now writes the initial header with 0o600.
  • src/auto-reply/reply/session.ts: forked session transcript creation writes the header with 0o600.
  • src/agents/pi-embedded-runner/session-manager-init.ts: session file reset now enforces 0o600.

Overall, the fix meaningfully reduces exposure of potentially sensitive conversation content on multi-user systems by preventing world-readable transcript files.

Confidence Score: 4/5

  • This PR is safe to merge and improves security by restricting transcript file permissions.
  • The change is small and localized (write options only) and matches existing patterns for sensitive files. Main remaining concern is directory permissions for transcript storage, which may still allow information disclosure via directory listing on shared systems.
  • src/config/sessions/transcript.ts (directory permissions in ensureSessionHeader)

Session transcript .jsonl files were being created with 0o644 (world-readable)
permissions instead of 0o600 (user-only). These files may contain sensitive
conversation data including accidentally shared API keys or tokens.

This fix applies mode: 0o600 to all session transcript file writes to match
the security model used by other sensitive files like openclaw.json and
auth-profiles.json.

Fixes openclaw#7862

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Feb 4, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 4, 2026

Additional Comments (1)

src/config/sessions/transcript.ts
[P1] ensureSessionHeader still creates the transcript directory with default permissions.

You now set the transcript file mode to 0o600, but the containing directory is created via fs.promises.mkdir(..., { recursive: true }) (no mode). If the directory already exists with permissive bits, users on the same machine can still list/inspect filenames and metadata (and on some systems traverse if execute bit is set). Other sensitive stores in the repo typically use mode: 0o700 for directories. Consider passing mode: 0o700 here as well (best-effort, knowing recursive may not chmod existing dirs).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/config/sessions/transcript.ts
Line: 67:69

Comment:
[P1] `ensureSessionHeader` still creates the transcript directory with default permissions.

You now set the transcript file mode to `0o600`, but the containing directory is created via `fs.promises.mkdir(..., { recursive: true })` (no `mode`). If the directory already exists with permissive bits, users on the same machine can still list/inspect filenames and metadata (and on some systems traverse if execute bit is set). Other sensitive stores in the repo typically use `mode: 0o700` for directories. Consider passing `mode: 0o700` here as well (best-effort, knowing `recursive` may not chmod existing dirs).

How can I resolve this? If you propose a fix, please make it concise.

samuelberston added a commit to samuelberston/openclaw that referenced this pull request Feb 14, 2026
Session transcript .jsonl files contain full conversation history
including user messages, tool call arguments, and model responses.
Previously created with default 0o644 (world-readable) permissions.

Restrict all session file write paths to 0o600 (owner-only), matching
the permission model already used by saveJsonFile() for credential
and config files (CWE-732).

Write paths fixed:
- config/sessions/transcript.ts (ensureSessionHeader)
- agents/pi-embedded-helpers/bootstrap.ts (ensureSessionHeader)
- agents/pi-embedded-runner/session-manager-init.ts (reset path)
- auto-reply/reply/session.ts (forkSessionFromParent)
- gateway/server-methods/chat.ts (ensureTranscriptFile)
- gateway/server-methods/sessions.ts (manual compaction)
- agents/session-file-repair.ts (backup + repair writes)

Closes openclaw#8751

Co-authored-by: Cursor <[email protected]>
samuelberston added a commit to samuelberston/openclaw that referenced this pull request Feb 14, 2026
Session transcript .jsonl files contain full conversation history
including user messages, tool call arguments, and model responses.
Previously created with default 0o644 (world-readable) permissions.

Restrict all session file write paths to 0o600 (owner-only), matching
the permission model already used by saveJsonFile() for credential
and config files (CWE-732).

Write paths fixed:
- config/sessions/transcript.ts (ensureSessionHeader)
- agents/pi-embedded-helpers/bootstrap.ts (ensureSessionHeader)
- agents/pi-embedded-runner/session-manager-init.ts (reset path)
- auto-reply/reply/session.ts (forkSessionFromParent)
- gateway/server-methods/chat.ts (ensureTranscriptFile)
- gateway/server-methods/sessions.ts (manual compaction)
- agents/session-file-repair.ts (backup + repair writes)

Closes openclaw#8751

Co-authored-by: Cursor <[email protected]>
samuelberston added a commit to samuelberston/openclaw that referenced this pull request Feb 14, 2026
Session transcript .jsonl files contain full conversation history
including user messages, tool call arguments, and model responses.
Previously created with default 0o644 (world-readable) permissions.

Restrict all session file write paths to 0o600 (owner-only), matching
the permission model already used by saveJsonFile() for credential
and config files (CWE-732).

Write paths fixed:
- config/sessions/transcript.ts (ensureSessionHeader)
- agents/pi-embedded-helpers/bootstrap.ts (ensureSessionHeader)
- agents/pi-embedded-runner/session-manager-init.ts (reset path)
- auto-reply/reply/session.ts (forkSessionFromParent)
- gateway/server-methods/chat.ts (ensureTranscriptFile)
- gateway/server-methods/sessions.ts (manual compaction)
- agents/session-file-repair.ts (backup + repair writes)

Closes openclaw#8751

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Session transcript files (.jsonl) created with 644 permissions instead of 600

2 participants