-
Notifications
You must be signed in to change notification settings - Fork 1
π‘οΈ Sentinel: [CRITICAL] Fix TOCTOU vulnerability in SSH key generation #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Sentinel Journal | ||
|
|
||
| ## 2025-04-12 - Prevent TOCTOU vulnerabilities in file creation | ||
|
|
||
| **Vulnerability:** SSH private keys and other sensitive files were being written | ||
| to disk and subsequently restricted using `chmod 600`. This creates a | ||
| Time-of-Check to Time-of-Use (TOCTOU) race condition where the file is briefly | ||
| readable with default permissions before `chmod` executes. | ||
| **Learning:** Shell scripts generating sensitive files must ensure the file is | ||
| created with secure permissions from the moment of creation. Explicitly calling | ||
| `chmod` after creation leaves a brief window for local privilege escalation or | ||
| unauthorized read access. | ||
| **Prevention:** Wrap the file creation logic in a subshell `(...)` and set | ||
| `umask 077` immediately before the command that writes the file. This ensures | ||
| the file is created with 600 permissions without affecting the global script's | ||
| umask. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,33 +8,38 @@ | |||||
| ## [Unreleased] | ||||||
|
|
||||||
| ### Added | ||||||
|
|
||||||
| - Brave browser extensions management (`tools/install-brave-extensions.sh`) | ||||||
| - Windows support documentation in README and CLAUDE.md | ||||||
| - CHANGELOG.md for tracking changes | ||||||
| - SECURITY.md for security policy | ||||||
| - CONTRIBUTING.md for contributor guidelines | ||||||
|
|
||||||
| ### Changed | ||||||
|
|
||||||
| - Standardized script naming to kebab-case (e.g., `install-global-tools.sh`) | ||||||
| - Updated Go version to 1.23.4 in apt.sh | ||||||
| - Updated yq version to v4.44.6 in apt.sh | ||||||
| - Updated lsd version to 1.1.5 in apt.sh | ||||||
| - Fixed Yarn installation to use modern `signed-by` method instead of deprecated `apt-key` | ||||||
|
Check failure on line 24 in CHANGELOG.md
|
||||||
| - Fixed `cron/update.sh` to detect Homebrew path (supports both Apple Silicon and Intel Macs) | ||||||
|
Check failure on line 25 in CHANGELOG.md
|
||||||
| - Fixed `destroy.sh` to be compatible with macOS (removed GNU-specific `xargs -r`) | ||||||
|
|
||||||
| ### Removed | ||||||
|
|
||||||
| - Removed broken test suite (was referencing non-existent files) | ||||||
| - Removed example hook scripts (`scripts/custom/`) | ||||||
| - Removed invalid `[brew]` and `[cron]` sections from `.chezmoi.toml.tmpl` | ||||||
|
|
||||||
| ### Fixed | ||||||
|
|
||||||
| - Fixed `build.sh` references to deleted directories | ||||||
| - Fixed Composer installation in apt.sh that would exit the entire script | ||||||
|
|
||||||
| ## [1.0.0] - 2024-12-01 | ||||||
|
|
||||||
| ### Added | ||||||
|
Check failure on line 41 in CHANGELOG.md
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI failure: duplicate Markdown heading at Line 41 (MD024). Docs lint is failing on the repeated β Minimal file-local fix-### Added
+### Added (1.0.0)π Committable suggestion
Suggested change
π§° Toolsπͺ GitHub Check: Lint Documentation[failure] 41-41: Multiple headings with the same content π€ Prompt for AI Agents |
||||||
|
|
||||||
| - Initial release with Chezmoi-based dotfiles management | ||||||
| - Cross-platform support (macOS, Linux, Windows) | ||||||
| - 1Password CLI integration for SSH key management | ||||||
|
|
@@ -48,6 +53,7 @@ | |||||
| - Templated configurations for Git, Zsh, Neovim, Tmux | ||||||
|
|
||||||
| ### Documentation | ||||||
|
|
||||||
| - README with quick start guide | ||||||
| - Installation guide with prerequisites | ||||||
| - Customization guide for forking | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
Check failure on line 3 in CLAUDE.md
|
||
|
|
||
| ## Overview | ||
|
|
||
| Cross-platform dotfiles (macOS, Linux & Windows) managed with [Chezmoi](https://chezmoi.io/), following XDG Base Directory conventions. | ||
|
Check failure on line 7 in CLAUDE.md
|
||
|
|
||
| ## Common Commands | ||
|
|
||
|
|
@@ -35,20 +35,24 @@ | |
| ## Architecture | ||
|
|
||
| ### Chezmoi Template System | ||
|
|
||
| - Source files live in `home/` directory with Chezmoi naming conventions | ||
| - `dot_` prefix β `.` (e.g., `dot_gitconfig.tmpl` β `~/.gitconfig`) | ||
| - `.tmpl` suffix indicates Go template processing | ||
| - Machine-specific config via `.chezmoidata.yaml` in repo root (defines variables like `email`, `name`, `is_work_machine`) | ||
| - Chezmoi stores source at `~/.local/share/chezmoi`, config at `~/.config/chezmoi/chezmoi.toml` | ||
|
|
||
| ### XDG Directory Structure | ||
|
|
||
| All configs follow XDG conventions: | ||
|
|
||
| - `~/.config` (XDG_CONFIG_HOME) - App configurations | ||
| - `~/.local/share` (XDG_DATA_HOME) - App data, Zsh history, NVM, SDKMAN | ||
| - `~/.cache` (XDG_CACHE_HOME) - Cache files | ||
| - `~/.local/bin` (XDG_BIN_HOME) - User binaries | ||
|
|
||
| ### Key Directories | ||
|
|
||
| - `home/` - Chezmoi-managed dotfile templates | ||
| - `home/dot_config/` - XDG config files (zsh, nvim, tmux, git, etc.) | ||
| - `tools/` - Bootstrap and management scripts | ||
|
|
@@ -57,19 +61,24 @@ | |
| - `Brewfile` - Homebrew package manifest | ||
|
|
||
| ### Bootstrap Flow | ||
|
|
||
| `tools/bootstrap.sh` runs: Homebrew install β Chezmoi install β Apply dotfiles β Essential packages (Brewfile.essential) β Oh My Zsh β Zsh plugins β Cron setup | ||
|
|
||
| After bootstrap, run `dotfiles setup` for complete installation (packages, extensions, ssh, defaults). | ||
|
|
||
| ### Global Tools Config | ||
|
|
||
| Edit `~/.config/dotfiles/config.yaml` to manage npm/pip/dotnet global tools, then run `dotfiles packages global`. | ||
|
|
||
| ### Extensions | ||
|
|
||
| Edit extension config files, then run `dotfiles packages extensions`: | ||
|
|
||
| - `~/.config/dotfiles/vscode-extensions.txt` - VS Code extension IDs (one per line) | ||
| - `~/.config/dotfiles/brave-extensions.txt` - Brave extension IDs (one per line) | ||
|
|
||
| ### Windows Support | ||
|
|
||
| - PowerShell profile at `~/Documents/PowerShell/` sources modular config from `~/.config/powershell/` | ||
| - Windows bootstrap: `tools/os_installers/setup.ps1` | ||
| - Chocolatey packages: `tools/os_installers/choco.ps1` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Journal date likely needs correction for timeline accuracy.
Line 3 uses
2025-04-12, while this PR was opened on 2026-04-12. If this entry documents this incident, update the date to avoid audit ambiguity.ποΈ Suggested edit
π Committable suggestion
π€ Prompt for AI Agents