Skip to content

openclaw agent startup resets ~/.openclaw to 755 via default-umask mkdirSync #92771

Description

@raffymontemayor

Summary

openclaw agent startup calls fs.mkdirSync(dir, { recursive: true }) without an explicit mode argument. On Linux, this defaults to 755 via the process umask, resetting ~/.openclaw from 700 to 755.

The doctor in doctor-state-integrity-Dup_jTAf.js detects this and applies chmodSync(stateDir, 448) (chmod 700), but only on certain CLI entrypoints — not during security audit or any path that does not trigger the doctor.

Reproduction

  1. chmod 700 ~/.openclaw (confirm it is 700)
  2. openclaw agent --agent main --message "test" (or any agent invocation)
  3. stat ~/.openclaw — mode is now 755

Expected

~/.openclaw stays 700 after agent startup

Actual

~/.openclaw is reset to 755

Workaround

Add chmod 700 ~/.openclaw after any script that calls openclaw agent.

Suggested fix

Pass { recursive: true, mode: 0o700 } to fs.mkdirSync when creating the state directory, or run the doctor normalization on all CLI entrypoints including security audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions