Start sessions with --dangerously-skip-permissions
Unattended sessions otherwise stop at every tool approval until someone answers through Remote Control. The limits that make this acceptable (bot token scoped to allowlisted repos, branch protection, nothing production on the box) are written down in the README's security model, along with the remaining risk of prompt injection. The one-time bypass-mode warning would block an unattended session. It's suppressed by skipDangerousModePermissionPrompt in ~/.claude/settings.json, and if it ever shows anyway, status now reports it as needs_attention, the same way as the folder-trust prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CyWXJ3BVzrZ9VWk5c2CoAr
This commit is contained in:
parent
b55ea07c96
commit
ece7458a55
3 changed files with 34 additions and 6 deletions
22
README.md
22
README.md
|
|
@ -59,6 +59,20 @@ from="<IP of reudy.net>",restrict,command="…/sessions-ctl --remote" ssh-ed2551
|
|||
capabilities dropped, published only on `127.0.0.1`.
|
||||
- Every remote call is logged on the dev box: `journalctl -t sessions-ctl`.
|
||||
|
||||
**No permission prompts:** sessions run with `--dangerously-skip-permissions`,
|
||||
so Claude acts without asking for approval: shell commands, file edits, git
|
||||
pushes. That's acceptable only because of where the limits already are. The
|
||||
git token is a bot limited to allowlisted repos, and branch protection makes an
|
||||
unmerged PR the worst case. Nothing production lives on the box, and
|
||||
instructions only arrive through Remote Control (your claude.ai account). The
|
||||
remaining risk is prompt injection: a fetched page or a malicious repo file can
|
||||
steer a session into running commands without anyone confirming them. Only
|
||||
allowlist repos you trust, and treat the dev box as disposable.
|
||||
The one-time "Bypass Permissions mode" warning would block an unattended
|
||||
session. `"skipDangerousModePermissionPrompt": true` in `~/.claude/settings.json`
|
||||
suppresses it. Without that setting the page shows *"stuck on the
|
||||
bypass-permissions warning"*.
|
||||
|
||||
**Folder trust:** Claude Code asks "do you trust this folder?" on first launch
|
||||
in a new directory, which would block an unattended session. There is no CLI
|
||||
flag for that in interactive mode, so `sessions-ctl` records the trust in
|
||||
|
|
@ -74,9 +88,10 @@ Claude Code field. If a Claude Code update breaks it, the session shows
|
|||
fixed conversation UUID) and runs `systemctl --user enable --now
|
||||
claude-session@NAME`.
|
||||
- The unit starts a **dedicated tmux server** (`tmux -L claude-NAME`) running
|
||||
`claude --remote-control dev-box-NAME`. The first launch uses `--session-id
|
||||
<uuid>` and later launches use `--resume <uuid>`, so a restart continues the
|
||||
same conversation and keeps the same Remote Control link.
|
||||
`claude --dangerously-skip-permissions --remote-control dev-box-NAME`. The
|
||||
first launch uses `--session-id <uuid>` and later launches use `--resume
|
||||
<uuid>`, so a restart continues the same conversation and keeps the same
|
||||
Remote Control link.
|
||||
- **Crash:** `Restart=always`, 10 s delay, at most 5 restarts in 10 min.
|
||||
- **Reboot:** enabled units start with the user manager, because `agent` has
|
||||
linger on.
|
||||
|
|
@ -164,6 +179,7 @@ sessions.reudy.net {
|
|||
| "Host key verification failed" | The dev box's host key changed. Check that the change is expected, then update `SESSIONS_DEV_HOST_KEY`. Never turn off checking |
|
||||
| Session `failed` | `journalctl --user -u claude-session@NAME -n 50`. After 5 crashes in 10 min systemd gives up; fix the cause, then Start again |
|
||||
| "stuck on the folder-trust prompt" | `tmux -L claude-NAME attach`, accept, detach. Then the trust field has moved in a Claude Code update, so fix `trust_workspace()` |
|
||||
| "stuck on the bypass-permissions warning" | Add `"skipDangerousModePermissionPrompt": true` to `~/.claude/settings.json`, then `tmux -L claude-NAME attach`, accept, detach |
|
||||
| No "Open in Claude" link | The link is read from the pane once Remote Control is up; refresh after a few seconds |
|
||||
|
||||
## Relation to `sess`
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ NAME_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,31}$")
|
|||
BRANCH_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._/-]{0,99}$")
|
||||
RC_URL_RE = re.compile(r"https://claude\.ai/code/session_[A-Za-z0-9]+")
|
||||
TRUST_PROMPT = "Yes, I trust this folder"
|
||||
# One-time warning for --dangerously-skip-permissions; skipped when ~/.claude/settings.json
|
||||
# has "skipDangerousModePermissionPrompt": true.
|
||||
BYPASS_PROMPT = "running in Bypass Permissions mode"
|
||||
|
||||
REMOTE_VERBS = {"list", "repos", "status", "create", "start", "stop", "health"}
|
||||
|
||||
|
|
@ -221,9 +224,13 @@ def untrust_workspace(path: Path, claude_json: Path = CLAUDE_JSON) -> None:
|
|||
|
||||
|
||||
def claude_args(state: dict, prefix: str, projects_dir: Path = CLAUDE_PROJECTS) -> list[str]:
|
||||
"""First launch pins the conversation id; every later launch resumes it."""
|
||||
"""First launch pins the conversation id; every later launch resumes it.
|
||||
|
||||
Sessions run with --dangerously-skip-permissions: no tool call waits for
|
||||
approval. See README "Security model" for why that is acceptable here.
|
||||
"""
|
||||
rc_name = f"{prefix}-{state['name']}"
|
||||
args = ["claude", "--remote-control", rc_name, "--name", state["name"]]
|
||||
args = ["claude", "--dangerously-skip-permissions", "--remote-control", rc_name, "--name", state["name"]]
|
||||
if any(projects_dir.glob(f"*/{state['uuid']}.jsonl")):
|
||||
return args + ["--resume", state["uuid"]]
|
||||
return args + ["--session-id", state["uuid"]]
|
||||
|
|
@ -253,6 +260,8 @@ def session_view(state: dict, with_pane: bool = True) -> dict:
|
|||
write_state(state)
|
||||
if TRUST_PROMPT in pane:
|
||||
view["needs_attention"] = "stuck on the folder-trust prompt; attach with tmux to accept"
|
||||
elif BYPASS_PROMPT in pane:
|
||||
view["needs_attention"] = "stuck on the bypass-permissions warning; attach with tmux to accept"
|
||||
return view
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -110,9 +110,12 @@ class ClaudeArgs(unittest.TestCase):
|
|||
first = sc.claude_args(state, "dev-box", projects)
|
||||
self.assertEqual(first[-2:], ["--session-id", state["uuid"]])
|
||||
self.assertIn("dev-box-s1", first)
|
||||
self.assertIn("--dangerously-skip-permissions", first)
|
||||
(projects / "-home-agent-sessions-s1").mkdir()
|
||||
(projects / "-home-agent-sessions-s1" / f"{state['uuid']}.jsonl").write_text("")
|
||||
self.assertEqual(sc.claude_args(state, "dev-box", projects)[-2:], ["--resume", state["uuid"]])
|
||||
resumed = sc.claude_args(state, "dev-box", projects)
|
||||
self.assertEqual(resumed[-2:], ["--resume", state["uuid"]])
|
||||
self.assertIn("--dangerously-skip-permissions", resumed)
|
||||
|
||||
|
||||
class MainContract(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue