Skip to content

feat(exec-broker): extend fs write-scope to a path list (reconciliation R1) - #308

Merged
sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a
Jul 10, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Description

First step of the exec-broker reconciliation (design: kit-research/docs/research/pillar3-broker-reconciliation-5.0.md, #32). The profile's [scope].fs is a path list, but the existing BrokerPolicy.fs was a single root. This extends the fs model to represent a list so the signed profile scope (next PR) can map onto the canonical exec-broker faithfully — no lossy mapping.

Type of Change

  • New feature (non-breaking change that adds functionality)

Related Issues

Changes Made

  • src/exec-broker/policy.ts:
    • BrokerPolicy.fs gains an optional roots: string[] alongside the required root; the effective allowed set is [root, ...roots] (new policyFsRoots helper, de-duplicated). root stays required, so the existing .kit-exec-broker.json shape and every existing test are unaffected (non-breaking).
    • loadBrokerPolicy validates roots fail-closed (any non-string[] → null).
  • src/exec-broker/broker.ts — collectDenials: an fs write is allowed iff some allowed root passes both the pure traversal gate and the symlink-aware realpath gate; denied only when every root rejects it.

Testing

Test Coverage

  • Added new tests (validator accepts roots; multi-root allow/deny in brokerExec)
  • All tests pass (npm test) — full suite 2713 pass / 0 fail (2712 baseline + 1 net)

Manual Testing

  1. npx tsc --noEmit → clean; npx eslint src → 0 errors.
  2. npm run build && node scripts/test.mjs → 2713 pass, 0 fail.

Breaking Changes

None / N/A — root remains required; roots is additive; single-root policies behave identically.

Checklist

  • All new code has test coverage
  • All tests pass locally (npm test)
  • No new warnings or errors introduced
  • No hardcoded secrets or sensitive data
  • Code has been self-reviewed

Performance Impact

  • No performance impact

Reviewer Notes

Pure foundation change with no behavior difference for existing single-root policies — the multi-root path only activates when a policy supplies roots (which today nothing does; the signed-profile provider in R2 will be the first producer). The symlink-aware realpath check is preserved per-root. Next: R2 adds the verifiedScope → BrokerPolicy provider and the runBrokered precedence (signed profile → .kit-exec-broker.json → passthrough).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2


Generated by Claude Code

…on R1)

First reconciliation step (kit-research #32): the profile's [scope].fs is a path LIST but the
exec-broker's BrokerPolicy.fs was a single root. Extend it to represent a list so the signed
profile scope (next step) maps faithfully:

- BrokerPolicy.fs gains an optional roots[] alongside the required root; the effective allowed
  set is [root, ...roots] (policyFsRoots helper, de-duplicated). root stays required so the
  existing .kit-exec-broker.json shape and all existing tests are unaffected (non-breaking).
- loadBrokerPolicy validates roots fail-closed (any non-string[] → null).
- collectDenials: an fs write is allowed iff SOME allowed root passes BOTH the pure traversal
  gate AND the symlink-aware realpath gate; denied only when every root rejects it.

Pure/loader change, no behavior change for single-root policies. Tests: validator accepts
roots; brokerExec allows a write under any listed root, denies one under none.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit ec7e3b5 into main Jul 10, 2026
18 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a branch July 10, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants