Skip to content

Harden history directory and append writes - #214

Merged
codeforester merged 2 commits into
mainfrom
security/210-20260818-history-directory-and-append-only-writes-bypass-the-package
Aug 18, 2026
Merged

Harden history directory and append writes#214
codeforester merged 2 commits into
mainfrom
security/210-20260818-history-directory-and-append-only-writes-bypass-the-package

Conversation

@codeforester

Copy link
Copy Markdown
Contributor

Summary

Fixes #210.

  • Restrict newly created history-directory components to owner-only 0700 permissions.
  • Open history append targets with O_NOFOLLOW and directory-relative handles where supported.
  • Apply 0600 permissions to the opened file descriptor, including the Windows lock sidecar path.
  • Add regressions for directory/file permissions and refusal to follow a symlink destination.

This closes the gap between history writes and the package's existing private-file hardening without changing the history schema or append-locking behavior.

Validation

  • uv run --extra dev --extra quality pytest — 413 passed, 5 skipped
  • uv run --extra quality ruff check lib/python/base_cli/history.py tests/test_history.py
  • uv run --extra dev mypy lib/python/base_cli/history.py
  • ./tests/validate.sh

@codeforester
codeforester merged commit a310ec9 into main Aug 18, 2026
90 checks passed
@codeforester
codeforester deleted the security/210-20260818-history-directory-and-append-only-writes-bypass-the-package branch August 18, 2026 08:02
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.

History directory and append-only writes bypass the package's own file/directory hardening

1 participant