security: create session dirs with private permissions#45901
Conversation
Greptile SummaryThis PR hardens the security posture of session directory creation by replacing bare Key observations:
Confidence Score: 4/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/commands/onboard-helpers.ts
Line: 10-11
Comment:
**Duplicate import from same module**
Lines 10 and 11 are two separate `import` statements from the same `"../config/sessions.js"` module. They should be merged into a single statement:
```suggestion
import { resolveSessionTranscriptsDirForAgent, ensurePrivateSessionsDir } from "../config/sessions.js";
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 9e8262b |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e8262b95b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58e760bdf0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f609b3fa7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea56a65155
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91684c2296
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91cfea1ba7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
91cfea1 to
24fa665
Compare
f4816a8 to
0a426cd
Compare
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Describe the problem and fix in 2–5 bullets:
agents/<id>/sessions/directories were created with default permissions, which landed as0755on POSIX hosts in practice.ensurePrivateSessionsDir(...)for managed session directories and reused it across setup, onboarding, agent creation, and managed session store / transcript flows.mkdir, while managed paths now reject symlinked final or ancestor components before permission hardening, including customOPENCLAW_STATE_DIRroots.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Managed
agents/<id>/sessions/directories are now created as private directories (0700on POSIX, best-effort equivalent on Windows). Caller-supplied custom session store / transcript directories keep their previous plain-mkdirbehavior.Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain risk + mitigation:Repro + Verification
Environment
Steps
agents/<id>/sessions/.sessions/directory permissions and compare before/after behavior.Expected
agents/<id>/sessions/directories are created with private permissions (0700on POSIX, best-effort equivalent on Windows).Actual
0755in local verification.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm test -- src/config/sessions/paths.test.ts src/config/sessions/sessions.test.ts src/commands/setup.test.ts0700pnpm checkReview Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoFailure Recovery (if this breaks)
src/config/sessions/paths.tsand the managed session-directory callersRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.mkdir; only managed session paths are hardened.