claude-code - 💡(How to fix) Fix [BUG] Managed hooks restriction bypassed when using ANTHROPIC_BASE_URL

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…
RAW_BUFFERClick to expand / collapse

Bug: allowManagedHooksOnly restriction bypassed when ANTHROPIC_BASE_URL points to a local proxy

Summary

When allowManagedHooksOnly: true is set via managed settings, Claude Code should prevent execution of non-managed hooks and /statusline scripts. However, this restriction is not enforced when the ANTHROPIC_BASE_URL environment variable is set to a local proxy address (e.g., http://localhost:4010). In that configuration, both non-managed hooks and /statusline scripts execute successfully, effectively bypassing the policy.

Expected behavior

allowManagedHooksOnly: true should block all non-managed hooks and /statusline scripts regardless of how the API backend is configured, including when routing through a local proxy.

Actual behavior

Setting ANTHROPIC_BASE_URL=http://localhost:4010 (or any local proxy) causes the allowManagedHooksOnly enforcement to be skipped. Non-managed hooks and /statusline scripts run without restriction.

Steps to reproduce

  1. Set allowManagedHooksOnly: true in managed settings.
  2. Start a local proxy (e.g., a Node.js HTTP server) on port 4010.
  3. Set ANTHROPIC_BASE_URL=http://localhost:4010.
  4. Launch Claude Code and attempt to run a non-managed hook or /statusline script.
  5. Observe that the hook/script executes despite the policy.

Environment

FieldValue
Platformwin32
Terminalwindows-terminal
Version2.1.114
Feedback IDe68fdd02-35eb-489f-82e5-e937cea055fe

extent analysis

TL;DR

To fix the allowManagedHooksOnly restriction bypass, update the code to enforce the policy regardless of the ANTHROPIC_BASE_URL configuration.

Guidance

  • Review the code that checks the allowManagedHooksOnly setting and ensure it is not skipped when ANTHROPIC_BASE_URL points to a local proxy.
  • Verify that the ANTHROPIC_BASE_URL environment variable is properly handled and does not interfere with the policy enforcement.
  • Check the proxy server configuration to ensure it is not modifying the requests in a way that bypasses the policy.
  • Consider adding additional logging or debugging statements to understand how the allowManagedHooksOnly setting is being evaluated when ANTHROPIC_BASE_URL is set to a local proxy.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The fix may require updates to the Claude Code application to properly handle the ANTHROPIC_BASE_URL environment variable and enforce the allowManagedHooksOnly policy.

Recommendation

Apply a workaround by removing the ANTHROPIC_BASE_URL environment variable or setting it to a non-local proxy address, as this will prevent the policy bypass until a proper fix is implemented.

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 [BUG] Managed hooks restriction bypassed when using ANTHROPIC_BASE_URL