claude-code - 💡(How to fix) Fix [Security] Undocumented hasTrustDialogHooksAccepted key allows bypassing hook trust prompts — risk of social engineering [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54702Fetched 2026-04-30 06:38:24
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2subscribed ×1

The hasTrustDialogHooksAccepted key in ~/.claude.json (referenced in issue #5572) appears to silently disable the "Hook PreToolUse:X requires confirmation" prompts for an entire project once set to true. This key is undocumented in the official settings reference but is functional.

Similarly, managed-settings.json allows hooks to be pre-trusted system-wide with administrator permission.

Root Cause

The hasTrustDialogHooksAccepted key in ~/.claude.json (referenced in issue #5572) appears to silently disable the "Hook PreToolUse:X requires confirmation" prompts for an entire project once set to true. This key is undocumented in the official settings reference but is functional.

Similarly, managed-settings.json allows hooks to be pre-trusted system-wide with administrator permission.

RAW_BUFFERClick to expand / collapse

Summary

The hasTrustDialogHooksAccepted key in ~/.claude.json (referenced in issue #5572) appears to silently disable the "Hook PreToolUse:X requires confirmation" prompts for an entire project once set to true. This key is undocumented in the official settings reference but is functional.

Similarly, managed-settings.json allows hooks to be pre-trusted system-wide with administrator permission.

Concern

These mechanisms can be exploited by social engineering:

  • A third-party tool or tutorial author could instruct novice users to "just add this one line to make the prompts go away"
  • Users following such advice would unknowingly disable an important security boundary that protects against malicious hook commands
  • Once hasTrustDialogHooksAccepted: true is set, ANY hook command in user scope is trusted without further confirmation

The hook trust prompt is documented as a security feature ensuring users explicitly approve commands before they execute. Bypassing it via an undocumented key undermines that guarantee.

Recommendations

  1. If hasTrustDialogHooksAccepted is intentional, document it in the official settings reference with explicit security warnings (it should not be the casual "make annoying prompts stop" answer)
  2. If it is internal-only, consider adding validation that prevents arbitrary user-scope edits (e.g., require the key to be set via an interactive command that explains the security implications)
  3. Consider whether managed-settings should require an explicit consent step even at install time

Context

Discovered while building a Claude Code companion app (an Electron desktop mascot that surfaces session state and offers an in-app allow/deny UI for tool permission prompts). We considered using the key to suppress repeated trust prompts for our own hook, but our project owner correctly identified the broader social-engineering risk. We have explicitly forbidden the bypass in our project's CLAUDE.md to prevent future agents/contributors from proposing it.

References

extent analysis

TL;DR

The hasTrustDialogHooksAccepted key in ~/.claude.json should be documented with security warnings or restricted to prevent social engineering attacks that bypass important security boundaries.

Guidance

  • Review the official settings reference to ensure that all security-related settings, including hasTrustDialogHooksAccepted, are properly documented with warnings about potential security risks.
  • Consider implementing validation to prevent arbitrary user-scope edits of sensitive settings like hasTrustDialogHooksAccepted, such as requiring an interactive command that explains the security implications.
  • Evaluate the need for explicit consent steps when setting up managed-settings to prevent unintended bypassing of security features.
  • Ensure that any documentation or tutorials related to Claude settings clearly communicate the security implications of modifying settings like hasTrustDialogHooksAccepted.

Example

No specific code snippet is provided as the issue focuses on configuration and documentation rather than code implementation.

Notes

The solution to this issue involves careful consideration of security implications and clear documentation to prevent misuse. It's crucial to balance convenience with security, ensuring that users are aware of the potential risks associated with certain settings.

Recommendation

Apply workaround: Document hasTrustDialogHooksAccepted with explicit security warnings to prevent its misuse and ensure users understand the implications of modifying this setting. This approach prioritizes security awareness and user consent over convenience.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Security] Undocumented hasTrustDialogHooksAccepted key allows bypassing hook trust prompts — risk of social engineering [2 comments, 3 participants]