Skip to content

feat: enforce strict modes on secrets file permissions (#278, #279) - #2478

Merged
oferchen merged 1 commit into
masterfrom
worktree-agent-a0b9704b
Feb 22, 2026
Merged

oferchen merged 1 commit into
masterfrom
worktree-agent-a0b9704b

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Enforce strict_modes (default: true) on secrets file during daemon authentication
  • Reject secrets files accessible by "other" users (mode & 0o006) — matches upstream authenticate.c check_secret()
  • When running as root, also reject secrets files not owned by root
  • No-op on non-Unix platforms (matching upstream)

Test plan

  • check_permissions_accepts_owner_only_file — mode 0600 passes
  • check_permissions_rejects_other_readable_file — mode 0604 rejected
  • check_permissions_rejects_other_writable_file — mode 0602 rejected
  • check_permissions_allows_group_readable_without_other — mode 0640 passes (upstream only checks & 06)
  • verify_secret_rejects_other_accessible_when_strict_modes_enabled — integration test
  • verify_secret_accepts_other_accessible_when_strict_modes_disabled — strict_modes=false bypasses check
  • verify_secret_succeeds_with_strict_modes_and_correct_permissions — correct perms + strict_modes=true works

When strict_modes is enabled (default), validate secrets file permissions
before reading: reject other-accessible files (mode & 0o006) and
non-root-owned files when running as root. Matches upstream
authenticate.c check_secret() behavior.
@github-actions github-actions Bot added the enhancement New feature or request label Feb 22, 2026
@oferchen
oferchen merged commit a9cde85 into master Feb 22, 2026
31 checks passed
@oferchen
oferchen deleted the worktree-agent-a0b9704b branch February 22, 2026 22:29
oferchen added a commit that referenced this pull request May 1, 2026
…2478)

When strict_modes is enabled (default), validate secrets file permissions
before reading: reject other-accessible files (mode & 0o006) and
non-root-owned files when running as root. Matches upstream
authenticate.c check_secret() behavior.
oferchen added a commit that referenced this pull request May 5, 2026
…2478)

When strict_modes is enabled (default), validate secrets file permissions
before reading: reject other-accessible files (mode & 0o006) and
non-root-owned files when running as root. Matches upstream
authenticate.c check_secret() behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant