Make htop_history reside in $XDG_STATE_HOME and harden accessing the file against symlink attacks - #2097
Conversation
…file against symlink attacks Fixes GHSA-46qw-qjgv-jhrw, thank you 0xseiryuu. Resolves htop-dev#1944, thank you @Explorer09. Resolves htop-dev#2089. Assisted-by: OpenCode Zen
📝 WalkthroughWalkthroughThe change stores search and filter history below the XDG state directory. It creates the required directory and migrates a legacy history file when appropriate. History loading and saving now reject symlinks and invalid ownership or permission states. The command-line setup uses the new path helper. The manual documents the new location and migration behavior. Assessment against linked issues
Suggested reviewers: Poem
Merge Risk: 🟡 Moderate · up to The PR moves and hardens history persistence, but parent-directory symlinks can still redirect reads or writes, while migration races can delete a replacement legacy file or leave partial history authoritative. These bounded security and data-integrity risks should be fixed or explicitly accepted before merging. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ef7ad5ab-84c1-4f19-9548-90c7734a3247
📒 Files selected for processing (6)
CommandLine.cHistory.cHistory.hSettings.cSettings.hhtop.1.in
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Assisted-by: CodeRabbitAI, OpenCode Zen
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 55ba3159-7c1a-417f-8b07-b9eaa6698d8c
📒 Files selected for processing (5)
CommandLine.cHistory.cSettings.cSettings.hhtop.1.in
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Fixes GHSA-46qw-qjgv-jhrw, thank you 0xseiryuu.
Resolves #1944, thank you @Explorer09.
Resolves #2089.
Assisted-by: OpenCode Zen