@boldblackai/harness 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -191,6 +191,8 @@ Each run starts the container with:
191
191
  - `--security-opt seccomp=...` — inline seccomp profile blocks `socket(AF_ALG)` to prevent kernel crypto API access (a known container escape vector)
192
192
  - Only your mounted directory (or single file with `-f`) is visible to the agent
193
193
 
194
+ Running harness from your home directory is blocked by default, since that would mount all of `$HOME` into the container — exposing dotfiles, credentials, and SSH keys to the agent and giving it a noisy, unfocused workspace. If the resolved working directory equals your home, harness exits with an error. Pass `--mount-entire-home` to opt in for the rare case where mounting all of `$HOME` is genuinely intended. `--file` mode is unaffected (it mounts a single file, not the working directory).
195
+
194
196
  These hardening flags are docker-specific. Under `HARNESS_CONTAINER_RUNTIME=apple`, `--security-opt` is not applied (apple/container workloads are microVMs with their own guest kernel, so the seccomp profile's host-kernel role is subsumed by the VM boundary); capability restrictions remain. See [Container runtime](#container-runtime).
195
197
 
196
198
  ### Image verification
@@ -241,6 +243,7 @@ If an old `.harness/` directory exists in your working directory, harness will e
241
243
  | `--no-context-files` | `-nc` | Disable mounting global context files (`~/.agents/AGENTS.md`, `~/.claude/CLAUDE.md`) |
242
244
  | `--ephemeral` | | Disable session persistence (implied by `-p` and piped stdin) |
243
245
  | `--local` | | Force local mode even with `-e` (use LM Studio / local defaults) |
246
+ | `--mount-entire-home` | | Allow running from your home directory (mounts all of `$HOME` as the workspace) |
244
247
  | `--help` | `-h` | Show help |
245
248
 
246
249
  ### Environment variables
package/bin/harness.js CHANGED
@@ -365,6 +365,7 @@ Options:
365
365
  --no-context-files Disable mounting global context files (~/.agents/AGENTS.md, ~/.claude/CLAUDE.md); alias -nc
366
366
  --ephemeral Disable session persistence (implied by -p and piped stdin)
367
367
  --local Force local mode even with -e (use LM Studio / local defaults)
368
+ --mount-entire-home Allow running from your home directory (mounts all of $HOME as the workspace)
368
369
  -h, --help Show this help message
369
370
 
370
371
  Environment variables:
@@ -402,7 +403,7 @@ function getImage(agent) {
402
403
  return `${REGISTRY}:${tag}`;
403
404
  }
404
405
  const MINIMIST_OPTS = {
405
- boolean: ["help", "h", "ephemeral", "local"],
406
+ boolean: ["help", "h", "ephemeral", "local", "mount-entire-home"],
406
407
  string: [
407
408
  "env-file",
408
409
  "e",
@@ -457,6 +458,7 @@ if (argv.help) {
457
458
  const noVerify = argv.verify === false;
458
459
  const noSkills = argv.skills === false;
459
460
  const noContextFiles = argv["context-files"] === false;
461
+ const mountEntireHome = argv["mount-entire-home"] === true;
460
462
  const localMode = argv.local;
461
463
  const envFilePath = argv["env-file"] || null;
462
464
  const fileArg = argv.file || null;
@@ -483,6 +485,19 @@ if (fileArg && node_fs_1.default.statSync(fileArg).isDirectory()) {
483
485
  console.error(`harness: --file requires a file, not a directory: ${fileArg}`);
484
486
  process.exit(1);
485
487
  }
488
+ // Guard against accidentally mounting the entire home directory as the
489
+ // workspace. Running from $HOME mounts all dotfiles/credentials into the
490
+ // container and gives the agent a noisy, unfocused workspace. Only relevant
491
+ // when the cwd is what gets mounted (not --file mode). --mount-entire-home
492
+ // is the explicit opt-in for the rare case where this is intended.
493
+ if (!fileArg && !mountEntireHome) {
494
+ const resolvedCwd = node_fs_1.default.realpathSync(workspace);
495
+ const resolvedHome = node_fs_1.default.realpathSync(node_os_1.default.homedir());
496
+ if (resolvedCwd === resolvedHome) {
497
+ console.error(`harness: refusing to run from your home directory (${resolvedHome}).\nThis would mount your entire home into the container, exposing dotfiles and credentials.\nPass --mount-entire-home to proceed, or cd into a project directory first.`);
498
+ process.exit(1);
499
+ }
500
+ }
486
501
  const volumeArgList = Array.isArray(argv.volumes)
487
502
  ? argv.volumes
488
503
  : argv.volumes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boldblackai/harness",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Portable environment for running coding agents in a container",
5
5
  "bin": {
6
6
  "harness": "bin/harness.js"