fix(security): surface Windows ACL repair hint when .secret_key is unreadable#1748
Conversation
…key is unreadable When the secret key file exists but cannot be read on Windows, the error now includes the file path and actionable icacls commands to repair permissions. Previously the error was a generic 'Failed to read secret key file' that looked like an OAuth failure. Closes tinyhumansai#1742
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesWindows Secret Key Error Recovery
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openhuman/security/secrets.rs`:
- Around line 191-203: The Rust code block building the error message for
read_key_file_with_retry(&self.key_path) (assigning to hex_key) is misformatted
and failing CI; run rustfmt (cargo fmt --all) to reformat the file, then commit
the formatted changes so the message construction around self.key_path and the
Windows-specific cfg block matches project style and passes cargo fmt/prettier
checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 74938fb1-36ae-4465-a528-05f2deebd369
📒 Files selected for processing (1)
src/openhuman/security/secrets.rs
Break long format!() line to satisfy cargo fmt check.
Summary
When
.secret_keyexists but cannot be read on Windows (ACL/permission issue from the installer), the error now includes:icaclscommands to repair permissionsPreviously the error was a generic
"Failed to read secret key file"that users mistook for an OAuth failure (see #1742 — both Google and GitHub sign-in appeared broken).Problem
On Windows 11 with the official installer,
.openhuman/.secret_keycan be created with incorrect ACL/ownership, making it unreadable. The app shows a generic OAuth failure instead of pointing to the real issue.Changes
src/openhuman/security/secrets.rs: Replace.context("Failed to read secret key file")with.with_context(|| ...)that:#[cfg(windows)]), appends specificicacls /resetrepair commandsExample error output (Windows)
Testing
#[cfg(windows)]guard ensures zero impact on macOS/Linux buildsread_key_file_with_retryis unchangedCloses #1742
Summary by CodeRabbit