Skip to content
Skills Library
Security · Building & coding

secure-local-runner

/secure-local-runner

The Python local runner that executes code on a user's own machine - outbound-only WebSocket, device pairing codes, scoped short-lived tokens, workspace path allowlisting, command policy, process supervision, and terminal streaming. Use when working in apps/local-runner or its server-side counterpart.

Repository
veritas-bot ↗
Licence
Apache-2.0
Last repository change
12.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

The Python local runner that executes code on a user's own machine - outbound-only WebSocket, device pairing codes, scoped short-lived tokens, workspace path allowlisting, command policy, process supervision, and terminal streaming. Use when working in apps/local-runner or its server-side counterpart.

Original author description

The Python local runner that executes code on a user's own machine - outbound-only WebSocket, device pairing codes, scoped short-lived tokens, workspace path allowlisting, command policy, process supervision, and terminal streaming. Use when working in apps/local-runner or its server-side counterpart.

How it works

  1. When to use
  2. Threat model
  3. Pairing flow
  4. Path authorisation
  5. Command policy (enforced locally)
  6. Process supervision
  7. Terminal streaming
  8. Update path
  9. Checklist
Original SKILL.md headings · 91 lines, 595 words
SKILL.md preview
---
name: secure-local-runner
description: The Python local runner that executes code on a user's own machine - outbound-only WebSocket, device pairing codes, scoped short-lived tokens, workspace path allowlisting, command policy, process supervision, and terminal streaming. Use when working in apps/local-runner or its server-side counterpart.
---

# Secure Local Runner

## When to use
Any change to device pairing, the runner WebSocket protocol, filesystem access, process
control, or the server endpoints that drive them.

## Threat model
The runner has the user's real filesystem and real credentials. Assume:
- The platform could be compromised and send malicious commands.
- Repo content could contain prompt-injected instructions.
- The network between runner and server is untrusted.

Therefore: outbound-only connection, no inbound listening socket, explicit workspace
allowlist chosen by the user in a native dialog, short-lived scoped tokens, and a local
deny-list that the server cannot override.

## Pairing flow
1. User clicks "Connect device" in the web app -> `POST /api/v1/runners/pairing/` returns a
   6-digit code and `expires_at` (10 min), plus a single-use `pairing_id`.
2. Runner prompts for the code, calls `POST /api/v1/runners/pairing/claim/` with code +
   device fingerprint (hostname hash, OS, arch) -> receives a `device_id` and a
   device-bound refresh token.
3. Runner opens `wss://api/ws/runner/?device=<id>` with `Authorization: Bearer <access>`
   where access tokens are 15-minute, audience `runner`, and scoped to that device.
4. Server records `LocalRunnerDevice(status, last_seen, runner_version, os, arch)`.

```python
# apps/api/execution/local/tokens.py
def mint_runner_token(device: LocalRunnerDevice) -> str:
    return jwt.encode({
        "sub": str(device.id),
        "aud": "runner",
        "org": str(device.organization_id),
        "scope": ["exec", "fs", "git", "stream"],
        "exp": now() + timedelta(minutes=15),
        "jti": uuid4().hex,
    }, settings.RUNNER_JWT_KEY, algorithm="EdDSA")
```
Tokens are device-bound and revoked on unpair, on 3 auth failures, or on a version below
the minimum supported.

## Path authorisation
```python
class Workspace:
    def resolve(self, candidate: str) -> Path:
        root = Path(self.root).resolve()
        target = (root / candidate).resolve() if not os.path.isabs(candidate) \
                 else Path(candidate).resolve()
        if target != root and root not in target.parents:
            raise PathOutsideWorkspace(candidate)      # reject before any I/O
        if target.is_symlink() or any(p.is_symlink() for p in target.parents):
            raise SymlinkRefused(candidate)
        return target
```
Workspace roots are registered locally by the user and stored in the runner's own config
file. The server cannot add a root; it can only read the list.

## Command policy (enforced locally)
- Deny: privilege escalation, disk formatting, recursive deletion outside the workspace,
  package managers run with elevated rights, piping remote content into a shell, writes to
  `~/.ssh`, `~/.aws`, `~/.config/gh`, and browser profile paths.
- Require approval: installs, long-running servers, git operations that rewrite history.
- Always: timeout (default 120s, max from env), output cap 200 KB, `cwd` inside workspace,
  scrub env down to an allowlist (`PATH`, `HOME`, `LANG`, project-provided vars), never
  inherit the runner's own tokens into the child process.

## Process supervision
Track every spawned process in a registry keyed by `session_id`. On disconnect, keep
servers alive but stream nothing; on `stop`, terminate the process group, wait 5s, then
force. On runner shutdown, terminate all children. Never leave an orphan dev server.

## Terminal streaming
Frames: `{type: "stdout"|"stderr"|"exit"|"pong", session, seq, data}`. `seq` is monotonic so
the client can detect gaps and request a replay from the ring buffer (last 2 MB per
session, in memory only). Heartbeat every 20s; server drops the socket after 45s of
silence and the runner reconnects with jittered backoff.

## Update path
Runner checks a signed manifest on start, reports its version on connect, and the server
refuses devices below `MIN_RUNNER_VERSION`. Auto-update is opt-in; the default shows an
instruction with the exact command for the user's OS.

## Checklist
- [ ] No inbound port opened by the runner.
- [ ] Path resolution rejects `..`, absolute escapes, and symlinks.
- [ ] Token audience `runner`, <= 15 min, revocable.
- [ ] Child env scrubbed; runner tokens never inherited.
- [ ] Timeout + output cap + process-group cleanup tested.
- [ ] Pairing code single-use, expiring, rate limited (5 attempts/hour/device).

Versions

The database has no other skills named secure-local-runner.

Database snapshot: 13.11.2026 · package version 9671887b1a63 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100security-benchmark-runner
    Manage security benchmark runner operations. Auto-activating skill for Security Advanced. Triggers on: security benchmark runner, security benchmark runner Part of the Security Advanced skill category. Use when working with security benchmark runner functionality. Trigger with…
  • 100cloud-local-github-loop
    云端 AI Agent(Claude on the Web / Claude Code Cloud / Codex Cloud)与本地自托管 GitHub Runner(macOS / Linux)协同执行任务闭环:通过 GitHub Actions(remote-cmd.yml / ai-loop.yml)安全派发本地计算任务、拉取 Artifact 结果、遵守 5MB 单文件与密钥红线门禁,并在宿主机休眠离线时自动写入 .ai/next_task.md 排队。Use whenever the user asks to 让本地机器跑、派发…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.