[BUG] Print mode (-p) bypasses IP-based authentication checks enforced in interactive mode
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using OAuth credentials copied to a machine with a different external IP address, print mode (-p) works normally while interactive mode prompts for re-authentication.
Both modes have access to the same privileged operations (Bash, Edit, Read, Write, etc.), so this creates an inconsistent security boundary.
What Should Happen?
Both interactive and print modes should enforce the same security checks (IP validation).
Error Messages/Logs
Interactive mode shows login prompt, no specific error message.
Print mode executes successfully with no errors.
Steps to Reproduce
Steps to Reproduce:
- On Machine A: Authenticate via
claude login - Copy
~/.claude/.credentials.jsonto Machine B (different external IP) - On Machine B, run
claude→ Prompts for re-authentication - On Machine B, run
claude -p "hello"→ Command executes successfully
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.15
Platform
Other
Operating System
macOS
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Tested on Ubuntu 24.04 LTS running in WSL2.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗