oh-my-copilot 5.22.0 → 5.24.0
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +11352 -4142
- package/bridge/mcp-server.cjs +9122 -2445
- package/bridge/runtime-cli.cjs +149 -20
- package/bridge/team-mcp.cjs +148 -19
- package/bridge/team.js +149 -20
- package/dist/__tests__/npm-package-bin-surface.test.js +3 -2
- package/dist/__tests__/npm-package-bin-surface.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-forge-cli.test.js +3 -3
- package/dist/cli/commands/__tests__/factory-forge-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-poll-local-sync.test.js +2 -2
- package/dist/cli/commands/__tests__/factory-poll-local-sync.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-pr.test.js +26 -0
- package/dist/cli/commands/__tests__/factory-pr.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-run-cli.test.js +5 -3
- package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
- package/dist/cli/commands/factory-board.d.ts.map +1 -1
- package/dist/cli/commands/factory-board.js +2 -1
- package/dist/cli/commands/factory-board.js.map +1 -1
- package/dist/cli/commands/factory-check.d.ts.map +1 -1
- package/dist/cli/commands/factory-check.js +2 -1
- package/dist/cli/commands/factory-check.js.map +1 -1
- package/dist/cli/commands/factory-poll.d.ts.map +1 -1
- package/dist/cli/commands/factory-poll.js +2 -1
- package/dist/cli/commands/factory-poll.js.map +1 -1
- package/dist/cli/commands/factory-pr.d.ts.map +1 -1
- package/dist/cli/commands/factory-pr.js +25 -7
- package/dist/cli/commands/factory-pr.js.map +1 -1
- package/dist/cli/commands/factory-setup.d.ts +2 -0
- package/dist/cli/commands/factory-setup.d.ts.map +1 -1
- package/dist/cli/commands/factory-setup.js +11 -1
- package/dist/cli/commands/factory-setup.js.map +1 -1
- package/dist/cli/commands/factory-triage.d.ts.map +1 -1
- package/dist/cli/commands/factory-triage.js +2 -1
- package/dist/cli/commands/factory-triage.js.map +1 -1
- package/dist/cli/commands/factory.d.ts +10 -1
- package/dist/cli/commands/factory.d.ts.map +1 -1
- package/dist/cli/commands/factory.js +99 -24
- package/dist/cli/commands/factory.js.map +1 -1
- package/dist/copilot-run/__tests__/fake-sdk.d.ts +2 -2
- package/dist/copilot-run/__tests__/fake-sdk.d.ts.map +1 -1
- package/dist/copilot-run/__tests__/fake-sdk.js +3 -3
- package/dist/copilot-run/__tests__/fake-sdk.js.map +1 -1
- package/dist/copilot-run/__tests__/sandbox-session.test.js +11 -0
- package/dist/copilot-run/__tests__/sandbox-session.test.js.map +1 -1
- package/dist/copilot-run/__tests__/sandbox.state-deny.test.js +22 -0
- package/dist/copilot-run/__tests__/sandbox.state-deny.test.js.map +1 -1
- package/dist/copilot-run/__tests__/sandbox.test.js +33 -3
- package/dist/copilot-run/__tests__/sandbox.test.js.map +1 -1
- package/dist/copilot-run/job.d.ts +22 -0
- package/dist/copilot-run/job.d.ts.map +1 -1
- package/dist/copilot-run/job.js +69 -11
- package/dist/copilot-run/job.js.map +1 -1
- package/dist/copilot-run/sandbox-session.js +1 -1
- package/dist/copilot-run/sandbox-session.js.map +1 -1
- package/dist/copilot-run/sandbox.d.ts +62 -0
- package/dist/copilot-run/sandbox.d.ts.map +1 -1
- package/dist/copilot-run/sandbox.js +75 -1
- package/dist/copilot-run/sandbox.js.map +1 -1
- package/dist/factory/__tests__/enqueue-ado.test.js +5 -0
- package/dist/factory/__tests__/enqueue-ado.test.js.map +1 -1
- package/dist/factory/__tests__/enqueue.test.js +5 -0
- package/dist/factory/__tests__/enqueue.test.js.map +1 -1
- package/dist/factory/__tests__/offline-e2e.test.js +3 -3
- package/dist/factory/__tests__/offline-e2e.test.js.map +1 -1
- package/dist/factory/__tests__/poll-ado.test.js +4 -1
- package/dist/factory/__tests__/poll-ado.test.js.map +1 -1
- package/dist/factory/__tests__/poll.reminders.test.d.ts +2 -0
- package/dist/factory/__tests__/poll.reminders.test.d.ts.map +1 -0
- package/dist/factory/__tests__/poll.reminders.test.js +174 -0
- package/dist/factory/__tests__/poll.reminders.test.js.map +1 -0
- package/dist/factory/__tests__/poll.test.js +42 -3
- package/dist/factory/__tests__/poll.test.js.map +1 -1
- package/dist/factory/__tests__/triage-github.test.js +5 -0
- package/dist/factory/__tests__/triage-github.test.js.map +1 -1
- package/dist/factory/__tests__/triage-local.test.js +22 -4
- package/dist/factory/__tests__/triage-local.test.js.map +1 -1
- package/dist/factory/board/__tests__/board-ado.test.js +2 -0
- package/dist/factory/board/__tests__/board-ado.test.js.map +1 -1
- package/dist/factory/board/__tests__/board-review-now.test.d.ts +2 -0
- package/dist/factory/board/__tests__/board-review-now.test.d.ts.map +1 -0
- package/dist/factory/board/__tests__/board-review-now.test.js +66 -0
- package/dist/factory/board/__tests__/board-review-now.test.js.map +1 -0
- package/dist/factory/board/__tests__/board.test.js +2 -0
- package/dist/factory/board/__tests__/board.test.js.map +1 -1
- package/dist/factory/board/collect.d.ts +2 -0
- package/dist/factory/board/collect.d.ts.map +1 -1
- package/dist/factory/board/collect.js +35 -0
- package/dist/factory/board/collect.js.map +1 -1
- package/dist/factory/board/render.d.ts.map +1 -1
- package/dist/factory/board/render.js +2 -0
- package/dist/factory/board/render.js.map +1 -1
- package/dist/factory/check/__tests__/cli-ado.test.js +5 -0
- package/dist/factory/check/__tests__/cli-ado.test.js.map +1 -1
- package/dist/factory/check/__tests__/cli.test.js +5 -0
- package/dist/factory/check/__tests__/cli.test.js.map +1 -1
- package/dist/factory/check/__tests__/read-fetch-lock.test.d.ts +2 -0
- package/dist/factory/check/__tests__/read-fetch-lock.test.d.ts.map +1 -0
- package/dist/factory/check/__tests__/read-fetch-lock.test.js +185 -0
- package/dist/factory/check/__tests__/read-fetch-lock.test.js.map +1 -0
- package/dist/factory/check/__tests__/rules.test.js +1 -1
- package/dist/factory/check/__tests__/rules.test.js.map +1 -1
- package/dist/factory/check/cli.d.ts +22 -1
- package/dist/factory/check/cli.d.ts.map +1 -1
- package/dist/factory/check/cli.js +58 -8
- package/dist/factory/check/cli.js.map +1 -1
- package/dist/factory/check/rules.js +1 -1
- package/dist/factory/check/rules.js.map +1 -1
- package/dist/factory/enqueue.d.ts.map +1 -1
- package/dist/factory/enqueue.js +3 -2
- package/dist/factory/enqueue.js.map +1 -1
- package/dist/factory/heal/__tests__/cli.test.js +97 -1
- package/dist/factory/heal/__tests__/cli.test.js.map +1 -1
- package/dist/factory/heal/cli.d.ts +5 -1
- package/dist/factory/heal/cli.d.ts.map +1 -1
- package/dist/factory/heal/cli.js +66 -19
- package/dist/factory/heal/cli.js.map +1 -1
- package/dist/factory/heal/history.d.ts.map +1 -1
- package/dist/factory/heal/history.js +7 -2
- package/dist/factory/heal/history.js.map +1 -1
- package/dist/factory/heal/implement.d.ts +3 -0
- package/dist/factory/heal/implement.d.ts.map +1 -1
- package/dist/factory/heal/implement.js +1 -0
- package/dist/factory/heal/implement.js.map +1 -1
- package/dist/factory/heal/sanitize.d.ts +18 -0
- package/dist/factory/heal/sanitize.d.ts.map +1 -1
- package/dist/factory/heal/sanitize.js +40 -3
- package/dist/factory/heal/sanitize.js.map +1 -1
- package/dist/factory/poll.d.ts +21 -1
- package/dist/factory/poll.d.ts.map +1 -1
- package/dist/factory/poll.js +60 -20
- package/dist/factory/poll.js.map +1 -1
- package/dist/factory/run/__tests__/ci-heal.test.js +5 -5
- package/dist/factory/run/__tests__/ci-heal.test.js.map +1 -1
- package/dist/factory/run/__tests__/claims.test.js +111 -10
- package/dist/factory/run/__tests__/claims.test.js.map +1 -1
- package/dist/factory/run/__tests__/coding-agent-lane.test.d.ts +2 -0
- package/dist/factory/run/__tests__/coding-agent-lane.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/coding-agent-lane.test.js +335 -0
- package/dist/factory/run/__tests__/coding-agent-lane.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine-ado-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-ado-harness.js +6 -3
- package/dist/factory/run/__tests__/engine-ado-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-harness.js +3 -3
- package/dist/factory/run/__tests__/engine-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.js +3 -3
- package/dist/factory/run/__tests__/engine-local-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-outcome-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-outcome-harness.js +3 -3
- package/dist/factory/run/__tests__/engine-outcome-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-progress-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-progress-harness.js +3 -3
- package/dist/factory/run/__tests__/engine-progress-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-sandbox-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-sandbox-harness.js +4 -4
- package/dist/factory/run/__tests__/engine-sandbox-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine.ado.heal.test.js +2 -2
- package/dist/factory/run/__tests__/engine.ado.heal.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.coding-agent.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.coding-agent.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.coding-agent.test.js +388 -0
- package/dist/factory/run/__tests__/engine.coding-agent.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.commit-hardening.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.commit-hardening.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.commit-hardening.test.js +293 -0
- package/dist/factory/run/__tests__/engine.commit-hardening.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.builtin.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.builtin.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.builtin.test.js +79 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.builtin.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.test.js +491 -0
- package/dist/factory/run/__tests__/engine.gates-sandbox.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.git-hardening.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.git-hardening.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.git-hardening.test.js +66 -0
- package/dist/factory/run/__tests__/engine.git-hardening.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.human-review.local.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.human-review.local.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.human-review.local.test.js +43 -0
- package/dist/factory/run/__tests__/engine.human-review.local.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.human-review.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.human-review.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.human-review.test.js +464 -0
- package/dist/factory/run/__tests__/engine.human-review.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.ci-recheck.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.ci-recheck.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.ci-recheck.test.js +74 -0
- package/dist/factory/run/__tests__/engine.local.ci-recheck.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.claims.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.claims.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.claims.test.js +231 -0
- package/dist/factory/run/__tests__/engine.local.claims.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.dogfood.test.js +8 -4
- package/dist/factory/run/__tests__/engine.local.dogfood.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.local.hardening.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.hardening.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.hardening.test.js +391 -0
- package/dist/factory/run/__tests__/engine.local.hardening.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.reset-discard.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.reset-discard.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.reset-discard.test.js +247 -0
- package/dist/factory/run/__tests__/engine.local.reset-discard.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.test.js +4 -1
- package/dist/factory/run/__tests__/engine.local.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.private.github.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.private.github.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.private.github.test.js +57 -0
- package/dist/factory/run/__tests__/engine.private.github.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.private.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.private.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.private.test.js +522 -0
- package/dist/factory/run/__tests__/engine.private.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.resume.test.js +20 -4
- package/dist/factory/run/__tests__/engine.resume.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.sandbox.commit.test.js +3 -1
- package/dist/factory/run/__tests__/engine.sandbox.commit.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.sandbox.test.js +4 -1
- package/dist/factory/run/__tests__/engine.sandbox.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.team.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.team.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.team.test.js +134 -0
- package/dist/factory/run/__tests__/engine.team.test.js.map +1 -0
- package/dist/factory/run/__tests__/fake-coding-agent.d.ts +80 -0
- package/dist/factory/run/__tests__/fake-coding-agent.d.ts.map +1 -0
- package/dist/factory/run/__tests__/fake-coding-agent.js +158 -0
- package/dist/factory/run/__tests__/fake-coding-agent.js.map +1 -0
- package/dist/factory/run/__tests__/fake-lanes.d.ts +36 -2
- package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
- package/dist/factory/run/__tests__/fake-lanes.js +77 -10
- package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
- package/dist/factory/run/__tests__/git-hardening.test.d.ts +2 -0
- package/dist/factory/run/__tests__/git-hardening.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/git-hardening.test.js +360 -0
- package/dist/factory/run/__tests__/git-hardening.test.js.map +1 -0
- package/dist/factory/run/__tests__/lane-commit.staging.test.d.ts +2 -0
- package/dist/factory/run/__tests__/lane-commit.staging.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/lane-commit.staging.test.js +341 -0
- package/dist/factory/run/__tests__/lane-commit.staging.test.js.map +1 -0
- package/dist/factory/run/__tests__/lane-procs.test.d.ts +2 -0
- package/dist/factory/run/__tests__/lane-procs.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/lane-procs.test.js +132 -0
- package/dist/factory/run/__tests__/lane-procs.test.js.map +1 -0
- package/dist/factory/run/__tests__/local-forge-units.test.js +19 -10
- package/dist/factory/run/__tests__/local-forge-units.test.js.map +1 -1
- package/dist/factory/run/__tests__/local-gate.orphans.test.js +15 -3
- package/dist/factory/run/__tests__/local-gate.orphans.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates-harness.js +3 -3
- package/dist/factory/run/__tests__/prepare-gates-harness.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.conflict.test.js +2 -1
- package/dist/factory/run/__tests__/prepare-gates.conflict.test.js.map +1 -1
- package/dist/factory/run/__tests__/private-run.test.d.ts +2 -0
- package/dist/factory/run/__tests__/private-run.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/private-run.test.js +254 -0
- package/dist/factory/run/__tests__/private-run.test.js.map +1 -0
- package/dist/factory/run/__tests__/private-store.test.d.ts +2 -0
- package/dist/factory/run/__tests__/private-store.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/private-store.test.js +722 -0
- package/dist/factory/run/__tests__/private-store.test.js.map +1 -0
- package/dist/factory/run/__tests__/prompts.test.d.ts.map +1 -1
- package/dist/factory/run/__tests__/prompts.test.js +17 -0
- package/dist/factory/run/__tests__/prompts.test.js.map +1 -1
- package/dist/factory/run/__tests__/sandbox-exec.test.d.ts +2 -0
- package/dist/factory/run/__tests__/sandbox-exec.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/sandbox-exec.test.js +656 -0
- package/dist/factory/run/__tests__/sandbox-exec.test.js.map +1 -0
- package/dist/factory/run/__tests__/tamper-quarantine.test.d.ts +2 -0
- package/dist/factory/run/__tests__/tamper-quarantine.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/tamper-quarantine.test.js +487 -0
- package/dist/factory/run/__tests__/tamper-quarantine.test.js.map +1 -0
- package/dist/factory/run/__tests__/units.test.js +14 -2
- package/dist/factory/run/__tests__/units.test.js.map +1 -1
- package/dist/factory/run/claims.d.ts +37 -7
- package/dist/factory/run/claims.d.ts.map +1 -1
- package/dist/factory/run/claims.js +125 -20
- package/dist/factory/run/claims.js.map +1 -1
- package/dist/factory/run/clean.d.ts +48 -2
- package/dist/factory/run/clean.d.ts.map +1 -1
- package/dist/factory/run/clean.js +259 -49
- package/dist/factory/run/clean.js.map +1 -1
- package/dist/factory/run/coding-agent-lane.d.ts +281 -0
- package/dist/factory/run/coding-agent-lane.d.ts.map +1 -0
- package/dist/factory/run/coding-agent-lane.js +526 -0
- package/dist/factory/run/coding-agent-lane.js.map +1 -0
- package/dist/factory/run/engine.d.ts +104 -2
- package/dist/factory/run/engine.d.ts.map +1 -1
- package/dist/factory/run/engine.js +2971 -199
- package/dist/factory/run/engine.js.map +1 -1
- package/dist/factory/run/exec.d.ts +36 -5
- package/dist/factory/run/exec.d.ts.map +1 -1
- package/dist/factory/run/exec.js +188 -26
- package/dist/factory/run/exec.js.map +1 -1
- package/dist/factory/run/forge-roots.d.ts.map +1 -1
- package/dist/factory/run/forge-roots.js +4 -0
- package/dist/factory/run/forge-roots.js.map +1 -1
- package/dist/factory/run/gate-procs.d.ts +8 -0
- package/dist/factory/run/gate-procs.d.ts.map +1 -1
- package/dist/factory/run/gate-procs.js +25 -0
- package/dist/factory/run/gate-procs.js.map +1 -1
- package/dist/factory/run/lane-commit.d.ts +141 -4
- package/dist/factory/run/lane-commit.d.ts.map +1 -1
- package/dist/factory/run/lane-commit.js +573 -57
- package/dist/factory/run/lane-commit.js.map +1 -1
- package/dist/factory/run/lane-procs.d.ts +96 -0
- package/dist/factory/run/lane-procs.d.ts.map +1 -0
- package/dist/factory/run/lane-procs.js +227 -0
- package/dist/factory/run/lane-procs.js.map +1 -0
- package/dist/factory/run/lane.d.ts +16 -0
- package/dist/factory/run/lane.d.ts.map +1 -1
- package/dist/factory/run/lane.js +5 -2
- package/dist/factory/run/lane.js.map +1 -1
- package/dist/factory/run/ledger.d.ts +9 -0
- package/dist/factory/run/ledger.d.ts.map +1 -1
- package/dist/factory/run/ledger.js +22 -2
- package/dist/factory/run/ledger.js.map +1 -1
- package/dist/factory/run/local-gate.d.ts +35 -4
- package/dist/factory/run/local-gate.d.ts.map +1 -1
- package/dist/factory/run/local-gate.js +73 -9
- package/dist/factory/run/local-gate.js.map +1 -1
- package/dist/factory/run/private-run.d.ts +227 -0
- package/dist/factory/run/private-run.d.ts.map +1 -0
- package/dist/factory/run/private-run.js +468 -0
- package/dist/factory/run/private-run.js.map +1 -0
- package/dist/factory/run/private-store.d.ts +459 -0
- package/dist/factory/run/private-store.d.ts.map +1 -0
- package/dist/factory/run/private-store.js +1351 -0
- package/dist/factory/run/private-store.js.map +1 -0
- package/dist/factory/run/prompts.d.ts +28 -2
- package/dist/factory/run/prompts.d.ts.map +1 -1
- package/dist/factory/run/prompts.js +68 -2
- package/dist/factory/run/prompts.js.map +1 -1
- package/dist/factory/run/reset.d.ts +18 -2
- package/dist/factory/run/reset.d.ts.map +1 -1
- package/dist/factory/run/reset.js +47 -9
- package/dist/factory/run/reset.js.map +1 -1
- package/dist/factory/run/review-guard.d.ts +73 -2
- package/dist/factory/run/review-guard.d.ts.map +1 -1
- package/dist/factory/run/review-guard.js +203 -4
- package/dist/factory/run/review-guard.js.map +1 -1
- package/dist/factory/run/sandbox-exec.d.ts +201 -0
- package/dist/factory/run/sandbox-exec.d.ts.map +1 -0
- package/dist/factory/run/sandbox-exec.js +488 -0
- package/dist/factory/run/sandbox-exec.js.map +1 -0
- package/dist/factory/run/state.d.ts +155 -3
- package/dist/factory/run/state.d.ts.map +1 -1
- package/dist/factory/run/state.js +179 -14
- package/dist/factory/run/state.js.map +1 -1
- package/dist/factory/run/tamper-quarantine.d.ts +168 -0
- package/dist/factory/run/tamper-quarantine.d.ts.map +1 -0
- package/dist/factory/run/tamper-quarantine.js +769 -0
- package/dist/factory/run/tamper-quarantine.js.map +1 -0
- package/dist/factory/setup/__tests__/setup-local.test.js +14 -0
- package/dist/factory/setup/__tests__/setup-local.test.js.map +1 -1
- package/dist/factory/setup/write.d.ts +5 -0
- package/dist/factory/setup/write.d.ts.map +1 -1
- package/dist/factory/setup/write.js +33 -0
- package/dist/factory/setup/write.js.map +1 -1
- package/dist/factory/team/__tests__/context.test.d.ts +2 -0
- package/dist/factory/team/__tests__/context.test.d.ts.map +1 -0
- package/dist/factory/team/__tests__/context.test.js +92 -0
- package/dist/factory/team/__tests__/context.test.js.map +1 -0
- package/dist/factory/team/__tests__/decisions.test.d.ts +2 -0
- package/dist/factory/team/__tests__/decisions.test.d.ts.map +1 -0
- package/dist/factory/team/__tests__/decisions.test.js +64 -0
- package/dist/factory/team/__tests__/decisions.test.js.map +1 -0
- package/dist/factory/team/__tests__/reminders.test.d.ts +2 -0
- package/dist/factory/team/__tests__/reminders.test.d.ts.map +1 -0
- package/dist/factory/team/__tests__/reminders.test.js +82 -0
- package/dist/factory/team/__tests__/reminders.test.js.map +1 -0
- package/dist/factory/team/__tests__/routing.test.d.ts +2 -0
- package/dist/factory/team/__tests__/routing.test.d.ts.map +1 -0
- package/dist/factory/team/__tests__/routing.test.js +91 -0
- package/dist/factory/team/__tests__/routing.test.js.map +1 -0
- package/dist/factory/team/__tests__/seeds.test.d.ts +2 -0
- package/dist/factory/team/__tests__/seeds.test.d.ts.map +1 -0
- package/dist/factory/team/__tests__/seeds.test.js +26 -0
- package/dist/factory/team/__tests__/seeds.test.js.map +1 -0
- package/dist/factory/team/__tests__/team-prompts.test.d.ts +2 -0
- package/dist/factory/team/__tests__/team-prompts.test.d.ts.map +1 -0
- package/dist/factory/team/__tests__/team-prompts.test.js +30 -0
- package/dist/factory/team/__tests__/team-prompts.test.js.map +1 -0
- package/dist/factory/team/context.d.ts +45 -0
- package/dist/factory/team/context.d.ts.map +1 -0
- package/dist/factory/team/context.js +168 -0
- package/dist/factory/team/context.js.map +1 -0
- package/dist/factory/team/decisions.d.ts +24 -0
- package/dist/factory/team/decisions.d.ts.map +1 -0
- package/dist/factory/team/decisions.js +49 -0
- package/dist/factory/team/decisions.js.map +1 -0
- package/dist/factory/team/reminders.d.ts +36 -0
- package/dist/factory/team/reminders.d.ts.map +1 -0
- package/dist/factory/team/reminders.js +93 -0
- package/dist/factory/team/reminders.js.map +1 -0
- package/dist/factory/team/routing.d.ts +35 -0
- package/dist/factory/team/routing.d.ts.map +1 -0
- package/dist/factory/team/routing.js +88 -0
- package/dist/factory/team/routing.js.map +1 -0
- package/dist/factory/triage/__tests__/rules.test.js +14 -2
- package/dist/factory/triage/__tests__/rules.test.js.map +1 -1
- package/dist/factory/triage/rules.d.ts.map +1 -1
- package/dist/factory/triage/rules.js +23 -1
- package/dist/factory/triage/rules.js.map +1 -1
- package/dist/forge/__tests__/config.test.js +15 -0
- package/dist/forge/__tests__/config.test.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +26 -6
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
- package/dist/forge/config.d.ts +1 -0
- package/dist/forge/config.d.ts.map +1 -1
- package/dist/forge/config.js +26 -0
- package/dist/forge/config.js.map +1 -1
- package/dist/forge/github/__tests__/reviews-feedback.test.js +49 -5
- package/dist/forge/github/__tests__/reviews-feedback.test.js.map +1 -1
- package/dist/forge/github/graphql.d.ts +3 -1
- package/dist/forge/github/graphql.d.ts.map +1 -1
- package/dist/forge/github/graphql.js +32 -5
- package/dist/forge/github/graphql.js.map +1 -1
- package/dist/forge/local/checks.d.ts +11 -0
- package/dist/forge/local/checks.d.ts.map +1 -1
- package/dist/forge/local/checks.js +3 -1
- package/dist/forge/local/checks.js.map +1 -1
- package/dist/forge/local/tracker.d.ts.map +1 -1
- package/dist/forge/local/tracker.js +20 -1
- package/dist/forge/local/tracker.js.map +1 -1
- package/dist/forge/types.d.ts +18 -3
- package/dist/forge/types.d.ts.map +1 -1
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +2 -1
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js +1 -0
- package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/openclaw-disabled-real-runner.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled-real-runner.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled-real-runner.test.js +90 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled-real-runner.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled.test.js +135 -0
- package/dist/hooks/session-end/__tests__/openclaw-disabled.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/worker.test.js +3 -1
- package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
- package/dist/hooks/session-end/callbacks.d.ts.map +1 -1
- package/dist/hooks/session-end/callbacks.js +2 -1
- package/dist/hooks/session-end/callbacks.js.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.d.ts +5 -0
- package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.js +34 -5
- package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +3 -2
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/session-end/worker.d.ts.map +1 -1
- package/dist/hooks/session-end/worker.js +5 -1
- package/dist/hooks/session-end/worker.js.map +1 -1
- package/dist/openclaw/config.d.ts +6 -0
- package/dist/openclaw/config.d.ts.map +1 -1
- package/dist/openclaw/config.js +9 -1
- package/dist/openclaw/config.js.map +1 -1
- package/dist/platform/__tests__/process-utils-identity.test.js +23 -0
- package/dist/platform/__tests__/process-utils-identity.test.js.map +1 -1
- package/dist/platform/process-utils.d.ts +5 -2
- package/dist/platform/process-utils.d.ts.map +1 -1
- package/dist/platform/process-utils.js +23 -8
- package/dist/platform/process-utils.js.map +1 -1
- package/dist/ship/__tests__/prepare-merge.test.js +13 -3
- package/dist/ship/__tests__/prepare-merge.test.js.map +1 -1
- package/dist/ship/__tests__/safety-state.test.js +9 -2
- package/dist/ship/__tests__/safety-state.test.js.map +1 -1
- package/dist/ship/config.d.ts +7 -3
- package/dist/ship/config.d.ts.map +1 -1
- package/dist/ship/config.js +23 -11
- package/dist/ship/config.js.map +1 -1
- package/dist/ship/exec.d.ts +12 -1
- package/dist/ship/exec.d.ts.map +1 -1
- package/dist/ship/exec.js +21 -3
- package/dist/ship/exec.js.map +1 -1
- package/dist/ship/merge.d.ts +8 -3
- package/dist/ship/merge.d.ts.map +1 -1
- package/dist/ship/merge.js +14 -7
- package/dist/ship/merge.js.map +1 -1
- package/dist/ship/prepare.d.ts +36 -1
- package/dist/ship/prepare.d.ts.map +1 -1
- package/dist/ship/prepare.js +65 -18
- package/dist/ship/prepare.js.map +1 -1
- package/dist/smoke/copilot-factory-run-scenario.d.ts.map +1 -1
- package/dist/smoke/copilot-factory-run-scenario.js +11 -0
- package/dist/smoke/copilot-factory-run-scenario.js.map +1 -1
- package/dist/team/__tests__/git-worktree.test.js +75 -2
- package/dist/team/__tests__/git-worktree.test.js.map +1 -1
- package/dist/team/__tests__/role-router.paths.test.d.ts +2 -0
- package/dist/team/__tests__/role-router.paths.test.d.ts.map +1 -0
- package/dist/team/__tests__/role-router.paths.test.js +71 -0
- package/dist/team/__tests__/role-router.paths.test.js.map +1 -0
- package/dist/team/git-worktree.d.ts +25 -2
- package/dist/team/git-worktree.d.ts.map +1 -1
- package/dist/team/git-worktree.js +186 -12
- package/dist/team/git-worktree.js.map +1 -1
- package/dist/team/role-router.d.ts +19 -0
- package/dist/team/role-router.d.ts.map +1 -1
- package/dist/team/role-router.js +96 -0
- package/dist/team/role-router.js.map +1 -1
- package/docs/CLAUDE.md +1 -1
- package/docs/FACTORY-OFFLINE.md +21 -8
- package/docs/REFERENCE.md +187 -17
- package/package.json +2 -2
- package/plugin.json +1 -1
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runSandboxed (sandbox-exec.ts) against a fake Copilot SDK: the policy it
|
|
3
|
+
* applies, the env the runtime gets, when a result counts as a verdict, the
|
|
4
|
+
* timeout path, the shell command per platform (run for real in the shells
|
|
5
|
+
* this host has), and gateEnv. No Copilot runtime, no network, no credits.
|
|
6
|
+
*/
|
|
7
|
+
import { spawnSync } from 'node:child_process';
|
|
8
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { tmpdir } from 'node:os';
|
|
10
|
+
import { join, resolve } from 'node:path';
|
|
11
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
12
|
+
import { fakeClientRpc, fakeSessionRpc } from '../../../copilot-run/__tests__/fake-sdk.js';
|
|
13
|
+
import { buildSandboxConfig, DEFAULT_SANDBOX_SETTINGS, resolveGatesSandboxMode, resolveRequireDeniedPaths } from '../../../copilot-run/sandbox.js';
|
|
14
|
+
import { findOnPath } from '../../../utils/windows-search.js';
|
|
15
|
+
import { defaultLocalGateRunner } from '../local-gate.js';
|
|
16
|
+
import { createSandboxRunner, gateEnv, readMarker, redactGateOutput, runSandboxed, sandboxCommandMaxChars, sandboxCommandTooLong, sandboxShellCommand, SHELL_OUTPUT_BYTES, SHELL_OUTPUT_LINES, splitFileListArgs, } from '../sandbox-exec.js';
|
|
17
|
+
import { fileListParts } from '../engine.js';
|
|
18
|
+
import { VITEST_SCRIPT } from '../../../ship/prepare.js';
|
|
19
|
+
/** The marker a command carries (the fake shell substitutes it for MARKER in its answer). */
|
|
20
|
+
const markerOf = (command) => /omg-gate-exit-[0-9a-f]{16}/.exec(command)?.[0] ?? 'none';
|
|
21
|
+
function fakeSdk(script, rec, sandbox = 'supported', deniedPaths = true) {
|
|
22
|
+
class Session {
|
|
23
|
+
cfg;
|
|
24
|
+
sessionId = 'sess-1';
|
|
25
|
+
rpc;
|
|
26
|
+
pending = null;
|
|
27
|
+
constructor(cfg) {
|
|
28
|
+
this.cfg = cfg;
|
|
29
|
+
this.rpc = {
|
|
30
|
+
...fakeSessionRpc(sandbox, rec),
|
|
31
|
+
shell: {
|
|
32
|
+
executeUserRequested: ({ requestId, command }) => {
|
|
33
|
+
rec.commands.push(command);
|
|
34
|
+
const marker = markerOf(command);
|
|
35
|
+
const complete = () => {
|
|
36
|
+
if (script.stray !== undefined)
|
|
37
|
+
this.cfg.onEvent?.({ type: 'tool.execution_complete', data: { toolCallId: 'other', toolName: 'bash', sandboxed: script.stray } });
|
|
38
|
+
if ('sandboxed' in script)
|
|
39
|
+
this.cfg.onEvent?.({ type: 'tool.execution_complete', data: { toolCallId: 'call-1', sandboxed: script.sandboxed } });
|
|
40
|
+
};
|
|
41
|
+
const answer = () => ({ toolCallId: 'call-1', ...script.answer, output: (script.answer?.output ?? '').split('MARKER').join(marker) });
|
|
42
|
+
if (script.reject)
|
|
43
|
+
return Promise.reject(new Error(script.reject));
|
|
44
|
+
return new Promise((resolve) => {
|
|
45
|
+
const done = () => {
|
|
46
|
+
if (!script.late)
|
|
47
|
+
complete();
|
|
48
|
+
resolve(answer());
|
|
49
|
+
if (script.late)
|
|
50
|
+
setTimeout(complete, 1);
|
|
51
|
+
};
|
|
52
|
+
if (!script.answer)
|
|
53
|
+
return;
|
|
54
|
+
if (script.answerOnCancel)
|
|
55
|
+
this.pending = done;
|
|
56
|
+
else
|
|
57
|
+
done();
|
|
58
|
+
void requestId;
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
cancelUserRequested: async ({ requestId }) => {
|
|
62
|
+
rec.cancels.push(requestId);
|
|
63
|
+
this.pending?.();
|
|
64
|
+
return { cancelled: true };
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async send() { throw new Error('a gate session never sends a prompt'); }
|
|
70
|
+
async abort() { }
|
|
71
|
+
async disconnect() { rec.disconnects += 1; }
|
|
72
|
+
}
|
|
73
|
+
class Client {
|
|
74
|
+
o;
|
|
75
|
+
cliProcess = { pid: 4321 };
|
|
76
|
+
rpc = fakeClientRpc(sandbox, deniedPaths);
|
|
77
|
+
constructor(o) {
|
|
78
|
+
this.o = o;
|
|
79
|
+
}
|
|
80
|
+
async start() {
|
|
81
|
+
// The runtime reads its config.json at start: what it trusts.
|
|
82
|
+
const file = this.o.baseDirectory ? join(this.o.baseDirectory, 'config.json') : '';
|
|
83
|
+
rec.clients.push({ ...this.o, ...(file && existsSync(file) ? { config: JSON.parse(readFileSync(file, 'utf8')) } : {}) });
|
|
84
|
+
}
|
|
85
|
+
async stop() { rec.stops += 1; return []; }
|
|
86
|
+
async getStatus() { return { version: '1.0.105' }; }
|
|
87
|
+
async listModels() { return []; }
|
|
88
|
+
async createSession(cfg) { rec.sessions.push(cfg); return new Session(cfg); }
|
|
89
|
+
async deleteSession() { }
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
module: {
|
|
93
|
+
CopilotClient: Client,
|
|
94
|
+
RuntimeConnection: { forStdio: (o) => { rec.connections.push(o); return o; } },
|
|
95
|
+
},
|
|
96
|
+
version: '1.0.16',
|
|
97
|
+
from: 'test',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
let dir;
|
|
101
|
+
let rec;
|
|
102
|
+
let killed;
|
|
103
|
+
let savedOmcHome;
|
|
104
|
+
beforeEach(() => {
|
|
105
|
+
dir = mkdtempSync(join(tmpdir(), 'omg-sandbox-exec-'));
|
|
106
|
+
mkdirSync(join(dir, 'checkout'));
|
|
107
|
+
mkdirSync(join(dir, 'repo', '.git'), { recursive: true });
|
|
108
|
+
mkdirSync(join(dir, 'user-copilot'));
|
|
109
|
+
writeFileSync(join(dir, 'user-copilot', 'config.json'), JSON.stringify({ loggedInUsers: [{ login: 'me' }] }));
|
|
110
|
+
rec = { clients: [], connections: [], sessions: [], optionsUpdates: [], commands: [], cancels: [], disconnects: 0, stops: 0 };
|
|
111
|
+
killed = [];
|
|
112
|
+
// The deny list names the OMC global state root's forge dir and creates it: never the real one.
|
|
113
|
+
savedOmcHome = process.env.OMC_HOME;
|
|
114
|
+
process.env.OMC_HOME = join(dir, 'omc-home');
|
|
115
|
+
});
|
|
116
|
+
afterEach(() => {
|
|
117
|
+
if (savedOmcHome === undefined)
|
|
118
|
+
delete process.env.OMC_HOME;
|
|
119
|
+
else
|
|
120
|
+
process.env.OMC_HOME = savedOmcHome;
|
|
121
|
+
rmSync(dir, { recursive: true, force: true });
|
|
122
|
+
});
|
|
123
|
+
const TOKENS = { GH_TOKEN: 'ghp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', GITHUB_TOKEN: 'ghp_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', AZURE_DEVOPS_EXT_PAT: 'pat-secret', COPILOT_GITHUB_TOKEN: 'gho_cccccccccccccccccccccccccccccccc' };
|
|
124
|
+
function deps(script, sandbox = 'supported', over = {}, deniedPaths = true) {
|
|
125
|
+
return {
|
|
126
|
+
env: { PATH: process.env.PATH ?? '', ...TOKENS },
|
|
127
|
+
platform: 'linux',
|
|
128
|
+
loadSdk: async () => fakeSdk(script, rec, sandbox, deniedPaths),
|
|
129
|
+
resolveBin: () => '/usr/bin/copilot',
|
|
130
|
+
pluginRoot: () => join(dir, 'plugin'),
|
|
131
|
+
userConfigDir: () => join(dir, 'user-copilot'),
|
|
132
|
+
isAlive: (pid) => pid === 4321 && !killed.includes(pid),
|
|
133
|
+
killTree: (pid) => { killed.push(pid); },
|
|
134
|
+
realHome: () => join(dir, 'home'),
|
|
135
|
+
toolPaths: () => [],
|
|
136
|
+
sandboxTrialLaunch: () => null,
|
|
137
|
+
sleep: async () => { },
|
|
138
|
+
...over,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const opts = (over = {}) => ({
|
|
142
|
+
cwd: join(dir, 'checkout'),
|
|
143
|
+
commonGitDir: join(dir, 'repo', '.git'),
|
|
144
|
+
timeoutMs: 60_000,
|
|
145
|
+
network: 'none',
|
|
146
|
+
settings: { ...DEFAULT_SANDBOX_SETTINGS, allowedHosts: [], extraReadonlyPaths: [], extraReadwritePaths: [] },
|
|
147
|
+
jobRoot: join(dir, 'jobs'),
|
|
148
|
+
...over,
|
|
149
|
+
});
|
|
150
|
+
const ok = { answer: { success: true, exitCode: 0, output: 'tests passed\nMARKER 0\n' }, sandboxed: true };
|
|
151
|
+
/** An answer with this output, success and exit, attested. */
|
|
152
|
+
const said = (output, success = true, exitCode = 0) => ({ answer: { success, exitCode, output }, sandboxed: true });
|
|
153
|
+
describe('runSandboxed', () => {
|
|
154
|
+
it('applies the write profile with host commits, on a token-free env, and counts an attested exit code', async () => {
|
|
155
|
+
const r = await runSandboxed(['/usr/bin/node', 'node_modules/vitest/vitest.mjs', 'run'], opts(), deps({ ...ok, answer: { success: true, exitCode: 0, output: 'not ok 1\nMARKER 3\n' } }));
|
|
156
|
+
expect(r).toEqual({ ran: true, status: 3, output: 'not ok 1', timedOut: false });
|
|
157
|
+
// The policy: read-write the checkout (and the job's temp/profile) only; the git dir read-only, no git write grant; no network.
|
|
158
|
+
const config = rec.optionsUpdates[0]?.sandboxConfig;
|
|
159
|
+
expect(config.enabled).toBe(true);
|
|
160
|
+
expect(config.userPolicy.filesystem.readwritePaths[0]).toBe(join(dir, 'checkout'));
|
|
161
|
+
expect(config.userPolicy.filesystem.readwritePaths.some((p) => p.includes(join('repo', '.git')))).toBe(false);
|
|
162
|
+
expect(config.userPolicy.filesystem.readonlyPaths).toContain(join(dir, 'repo', '.git'));
|
|
163
|
+
expect(config.userPolicy.filesystem.deniedPaths).toContain(join(dir, 'home', '.npmrc'));
|
|
164
|
+
expect(config.userPolicy.network.allowOutbound).toBe(false);
|
|
165
|
+
// The runtime env (what the shell inherits) carries no credential.
|
|
166
|
+
const env = rec.connections[0].env;
|
|
167
|
+
for (const k of ['GH_TOKEN', 'GITHUB_TOKEN', 'AZURE_DEVOPS_EXT_PAT', 'COPILOT_GITHUB_TOKEN'])
|
|
168
|
+
expect(env[k]).toBeUndefined();
|
|
169
|
+
expect(JSON.stringify(env)).not.toContain('ghp_');
|
|
170
|
+
// The Copilot credential goes over the session RPC, no plugin (its hooks would run unsandboxed), no prompt.
|
|
171
|
+
expect(rec.sessions[0]).toMatchObject({ gitHubToken: TOKENS.COPILOT_GITHUB_TOKEN, pluginDirectories: [] });
|
|
172
|
+
// Teardown: the session, the runtime tree, the client; the job home is removed.
|
|
173
|
+
expect(rec.disconnects).toBe(1);
|
|
174
|
+
expect(killed).toContain(4321);
|
|
175
|
+
expect(rec.stops).toBe(1);
|
|
176
|
+
expect(existsSync(join(dir, 'jobs')) ? readdirSync(join(dir, 'jobs')) : []).toEqual([]);
|
|
177
|
+
});
|
|
178
|
+
it('H2: the runtime works in and trusts only an empty dir of its own job home, never the checkout', async () => {
|
|
179
|
+
await runSandboxed(['/usr/bin/node', 'x.js'], opts(), deps(ok));
|
|
180
|
+
const checkout = join(dir, 'checkout');
|
|
181
|
+
const work = rec.clients[0].workingDirectory;
|
|
182
|
+
expect(work.startsWith(join(dir, 'jobs'))).toBe(true);
|
|
183
|
+
expect(work).not.toBe(checkout);
|
|
184
|
+
expect(rec.clients[0].config?.trustedFolders).toEqual([work]);
|
|
185
|
+
expect(rec.sessions[0].workingDirectory).toBe(work);
|
|
186
|
+
// A git root search from the working dir stops at the job root (under the root repository's .omg/).
|
|
187
|
+
expect(rec.connections[0].env.GIT_CEILING_DIRECTORIES).toBe(resolve(join(dir, 'jobs')));
|
|
188
|
+
// The checkout stays an explicit read-write path, and the command itself changes into it.
|
|
189
|
+
const config = rec.optionsUpdates[0]?.sandboxConfig;
|
|
190
|
+
expect(config.userPolicy.filesystem.readwritePaths).toContain(checkout);
|
|
191
|
+
expect(Buffer.from(/'([A-Za-z0-9+/=]+)'/.exec(rec.commands[0])[1], 'base64').toString('utf8').split('\0')[0]).toBe(checkout);
|
|
192
|
+
});
|
|
193
|
+
it('network "registry" opens only the registry hosts', async () => {
|
|
194
|
+
await runSandboxed(['/usr/bin/npm', 'ci'], opts({ network: 'registry' }), deps(ok));
|
|
195
|
+
const config = rec.optionsUpdates[0]?.sandboxConfig;
|
|
196
|
+
expect(config.userPolicy.network).toMatchObject({ allowOutbound: true, allowedHosts: ['registry.npmjs.org', '*.npmjs.org'] });
|
|
197
|
+
});
|
|
198
|
+
it('a host without denied_paths runs the command and its verdict counts, marked credential files readable', async () => {
|
|
199
|
+
const r = await runSandboxed(['/bin/false'], opts(), deps(said('not ok\nMARKER 1\n'), 'supported', {}, false));
|
|
200
|
+
expect(r).toEqual({ ran: true, status: 1, output: 'not ok', timedOut: false, credentialFilesReadable: true });
|
|
201
|
+
const config = rec.optionsUpdates[0]?.sandboxConfig;
|
|
202
|
+
expect(config.userPolicy.filesystem.deniedPaths).toBeUndefined();
|
|
203
|
+
// With denied_paths the verdict carries no mark.
|
|
204
|
+
expect(await runSandboxed(['/bin/true'], opts(), deps(ok))).toEqual({ ran: true, status: 0, output: 'tests passed', timedOut: false });
|
|
205
|
+
});
|
|
206
|
+
it('requireDeniedPaths: a host without denied_paths runs nothing (not started: the gates-unsandboxed park), naming the key', async () => {
|
|
207
|
+
const r = await runSandboxed(['/bin/true'], opts({ requireDeniedPaths: true }), deps(ok, 'supported', {}, false));
|
|
208
|
+
expect(r).toEqual({ ran: false, reason: expect.stringContaining('factory.run.sandbox.requireDeniedPaths is true') });
|
|
209
|
+
expect(rec.commands).toEqual([]);
|
|
210
|
+
expect(rec.sessions).toEqual([]);
|
|
211
|
+
// A host that reports denied_paths runs as before.
|
|
212
|
+
expect(await runSandboxed(['/bin/true'], opts({ requireDeniedPaths: true }), deps(ok))).toMatchObject({ ran: true, status: 0 });
|
|
213
|
+
});
|
|
214
|
+
it('redaction applies on a host without denied_paths too', async () => {
|
|
215
|
+
const r = await runSandboxed(['/bin/false'], opts(), deps(said('token ghp_abcdefghijklmnopqrstuvwxyz0123456789\nMARKER 1\n'), 'supported', {}, false));
|
|
216
|
+
expect(r).toMatchObject({ ran: true, credentialFilesReadable: true });
|
|
217
|
+
expect(r.output).not.toContain('ghp_abcdefghijklmnopqrstuvwxyz0123456789');
|
|
218
|
+
});
|
|
219
|
+
it('a call attested sandboxed: false, or not attested at all, gives no verdict after the command started', async () => {
|
|
220
|
+
const no = await runSandboxed(['/bin/true'], opts(), deps({ ...ok, sandboxed: false }));
|
|
221
|
+
expect(no).toMatchObject({ ran: false, started: true, reason: expect.stringContaining('not attested sandboxed') });
|
|
222
|
+
const missing = await runSandboxed(['/bin/true'], opts(), deps({ answer: ok.answer }));
|
|
223
|
+
expect(missing).toMatchObject({ ran: false, started: true, reason: expect.stringContaining('not attested sandboxed') });
|
|
224
|
+
const stray = await runSandboxed(['/bin/true'], opts(), deps({ ...ok, stray: false }));
|
|
225
|
+
expect(stray).toMatchObject({ ran: false, started: true, reason: expect.stringContaining('not attested sandboxed: true') });
|
|
226
|
+
});
|
|
227
|
+
it('a trailing attestation is waited for', async () => {
|
|
228
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, Math.min(ms, 5)));
|
|
229
|
+
expect(await runSandboxed(['/bin/true'], opts(), deps({ ...ok, late: true }, 'supported', { sleep: wait }))).toMatchObject({ ran: true, status: 0 });
|
|
230
|
+
});
|
|
231
|
+
it('M1: after the command started, a missing marker, no success field or a contradiction is no verdict with fixed text only', async () => {
|
|
232
|
+
const leak = 'SECRET-OUTPUT-ghp_dddddddddddddddddddddddddddddddddddd';
|
|
233
|
+
const cases = [
|
|
234
|
+
{ answer: { success: false, exitCode: 1, output: leak, error: `policy_validation ${leak}` }, sandboxed: true },
|
|
235
|
+
{ answer: { exitCode: 0, output: 'MARKER 0' }, sandboxed: true },
|
|
236
|
+
// A shell killed after a forged `<marker> 0`: the runtime's own result says it failed.
|
|
237
|
+
said('MARKER 0\n', false, 137),
|
|
238
|
+
said('MARKER 0\n', true, 1),
|
|
239
|
+
{ reject: `rpc failed: ${leak}`, sandboxed: true },
|
|
240
|
+
];
|
|
241
|
+
for (const script of cases) {
|
|
242
|
+
const r = await runSandboxed(['/bin/true'], opts(), deps(script));
|
|
243
|
+
expect(r, JSON.stringify(script)).toMatchObject({ ran: false, started: true });
|
|
244
|
+
expect(r.reason, JSON.stringify(script)).not.toMatch(/SECRET|ghp_|policy_validation/);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
it('M1: an exit code equal to the marker\'s, or a failed success with a non-zero marker, is consistent', async () => {
|
|
248
|
+
expect(await runSandboxed(['/bin/false'], opts(), deps(said('not ok\nMARKER 3\n', true, 3)))).toEqual({ ran: true, status: 3, output: 'not ok', timedOut: false });
|
|
249
|
+
expect(await runSandboxed(['/bin/false'], opts(), deps(said('not ok\nMARKER 3\n', false, 3)))).toEqual({ ran: true, status: 3, output: 'not ok', timedOut: false });
|
|
250
|
+
expect(await runSandboxed(['/bin/false'], opts(), deps(said('MARKER 1\n', false, undefined)))).toMatchObject({ ran: true, status: 1 });
|
|
251
|
+
// A zero marker with a failed success contradicts.
|
|
252
|
+
expect(await runSandboxed(['/bin/true'], opts(), deps(said('MARKER 0\n', false, undefined)))).toMatchObject({ ran: false, started: true });
|
|
253
|
+
});
|
|
254
|
+
it('M2: a forged early marker, a forged late marker, a duplicate or any other omg-gate-exit- text is no verdict', async () => {
|
|
255
|
+
const forged = 'omg-gate-exit-0000000000000000';
|
|
256
|
+
for (const output of [
|
|
257
|
+
`MARKER 0\nreal failure\nMARKER 1\n`,
|
|
258
|
+
`MARKER 1\nMARKER 0\n`,
|
|
259
|
+
`MARKER 1\n${forged} 0\n`,
|
|
260
|
+
`${forged} 0\nMARKER 0\n`,
|
|
261
|
+
`printed ${forged}\nMARKER 0\n`,
|
|
262
|
+
// A last line without a newline glued to the marker: not at the start of a line.
|
|
263
|
+
`partialMARKER 0\n`,
|
|
264
|
+
]) {
|
|
265
|
+
const r = await runSandboxed(['/bin/true'], opts(), deps(said(output)));
|
|
266
|
+
expect(r, output).toMatchObject({ ran: false, started: true, reason: expect.stringContaining('one exit-code marker line') });
|
|
267
|
+
}
|
|
268
|
+
// Trailing blank lines after the one marker are fine.
|
|
269
|
+
expect(await runSandboxed(['/bin/true'], opts(), deps(said('ok\nMARKER 0\n\n\r\n')))).toMatchObject({ ran: true, status: 0, output: 'ok' });
|
|
270
|
+
});
|
|
271
|
+
it('M3: token-shaped text in the output is redacted before it is kept', async () => {
|
|
272
|
+
const secrets = [
|
|
273
|
+
'ghp_abcdefghijklmnopqrstuvwxyz0123456789', 'gho_abcdefghijklmnopqrstuvwxyz0123456789', 'ghu_abcdefghijklmnopqrstuvwxyz0123456789',
|
|
274
|
+
'ghs_abcdefghijklmnopqrstuvwxyz0123456789', 'github_pat_11ABCDEFG0123456789_abcdefghijklmnopqrstuvwxyz', 'npm_abcdefghijklmnopqrstuvwxyz0123456789',
|
|
275
|
+
'AKIAABCDEFGHIJKLMNOP', 'Bearer abcdefghijklmnopqrstuvwxyz.0123456789',
|
|
276
|
+
];
|
|
277
|
+
const pem = '-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz\n-----END OPENSSH PRIVATE KEY-----';
|
|
278
|
+
const r = await runSandboxed(['/bin/true'], opts(), deps(said(`${secrets.join('\n')}\n${pem}\nMARKER 1\n`)));
|
|
279
|
+
expect(r.ran).toBe(true);
|
|
280
|
+
const out = r.output;
|
|
281
|
+
for (const s of secrets)
|
|
282
|
+
expect(out, s).not.toContain(s.replace(/^Bearer /, ''));
|
|
283
|
+
expect(out).not.toContain('b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQ');
|
|
284
|
+
// A key block whose BEGIN line an output bound cut off.
|
|
285
|
+
expect(redactGateOutput('b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz\n-----END OPENSSH PRIVATE KEY-----')).toBe('[redacted]');
|
|
286
|
+
});
|
|
287
|
+
it('L-d: JWTs, .npmrc credentials and sk- / sk-ant- keys are redacted; shas and base64 test output are not', () => {
|
|
288
|
+
const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4ifQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
289
|
+
// Built at run time: a literal token-shaped value in the source would trip secret scanners.
|
|
290
|
+
const uuid = ['0f1e2d3c', '4b5a', '6978', '8796', 'a5b4c3d2e1f0'].join('-');
|
|
291
|
+
const secrets = [
|
|
292
|
+
[`token ${jwt} end`, jwt],
|
|
293
|
+
[`//registry.npmjs.org/:_authToken=${uuid}`, uuid],
|
|
294
|
+
['_auth = dXNlcjpwYXNzd29yZA==', 'dXNlcjpwYXNzd29yZA'],
|
|
295
|
+
['//npm.pkg.example/:_password=c2VjcmV0LXBhc3N3b3Jk', 'c2VjcmV0LXBhc3N3b3Jk'],
|
|
296
|
+
[`key ${['sk', 'proj', 'AbCdEf0123456789GhIjKlMnOp'].join('-')}`, 'AbCdEf0123456789'],
|
|
297
|
+
[`ANTHROPIC_API_KEY=${['sk', 'ant', 'api03', 'AbCdEf0123456789_GhIjKlMnOpQrStUv', 'wxyz'].join('-')}`, 'api03-AbCdEf0123456789'],
|
|
298
|
+
];
|
|
299
|
+
for (const [text, secret] of secrets) {
|
|
300
|
+
const out = redactGateOutput(text);
|
|
301
|
+
expect(out, text).not.toContain(secret);
|
|
302
|
+
expect(out, text).toContain('[redacted]');
|
|
303
|
+
}
|
|
304
|
+
expect(redactGateOutput('//registry.npmjs.org/:_authToken=abc')).toBe('//registry.npmjs.org/:_authToken=[redacted]');
|
|
305
|
+
// #8: the JSON / colon form, the env forms and any case; the value built at run time.
|
|
306
|
+
const value = ['npm', 'Zx9', 'Qw8', 'Er7'].join('_');
|
|
307
|
+
for (const [text, kept] of [
|
|
308
|
+
[`"//registry.npmjs.org/:_authToken": "${value}",`, '"//registry.npmjs.org/:_authToken": "[redacted]",'],
|
|
309
|
+
[`_authToken: ${value}`, '_authToken: [redacted]'],
|
|
310
|
+
[`NODE_AUTH_TOKEN=${value}`, 'NODE_AUTH_TOKEN=[redacted]'],
|
|
311
|
+
[`NPM_TOKEN=${value}`, 'NPM_TOKEN=[redacted]'],
|
|
312
|
+
[`NPM_CONFIG__AUTHTOKEN=${value}`, 'NPM_CONFIG__AUTHTOKEN=[redacted]'],
|
|
313
|
+
[`npm_config__authtoken=${value}`, 'npm_config__authtoken=[redacted]'],
|
|
314
|
+
[`//npm.example/:_AUTH=${value}`, '//npm.example/:_AUTH=[redacted]'],
|
|
315
|
+
// review-482b C: single-quoted values (YAML, shell).
|
|
316
|
+
[`_password: '${value}'`, "_password: '[redacted]'"],
|
|
317
|
+
[`_authToken='${value}'`, "_authToken='[redacted]'"],
|
|
318
|
+
])
|
|
319
|
+
expect(redactGateOutput(text), text).toBe(kept);
|
|
320
|
+
const ordinary = [
|
|
321
|
+
'config_password=x', 'MY_NPM_TOKEN_NAME is documented', 'db_auth=on',
|
|
322
|
+
'HEAD is 9fb7e347addff4cac28206858ca6f58aec2792cc',
|
|
323
|
+
'sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
324
|
+
'expected "dGhpcyBpcyBhIHRlc3Qgb3V0cHV0IHdpdGggbm8gc2VjcmV0cyBpbiBpdA==" to equal "SGVsbG8gd29ybGQ="',
|
|
325
|
+
'eyJhbGciOiJIUzI1NiJ9 is a header only', 'uses sk-learn-compatible-estimators', 'task-0123456789abcdefghij-done',
|
|
326
|
+
'✓ src/a.test.ts (12 tests) 340ms',
|
|
327
|
+
];
|
|
328
|
+
for (const text of ordinary)
|
|
329
|
+
expect(redactGateOutput(text), text).toBe(text);
|
|
330
|
+
});
|
|
331
|
+
it('an unsupported host, a policy that is not applied or a blocked enforcement runs nothing (not started)', async () => {
|
|
332
|
+
for (const sandbox of ['unsupported', 'update-fails', 'blocked', 'no-rpc']) {
|
|
333
|
+
rec.commands = [];
|
|
334
|
+
const r = await runSandboxed(['/bin/true'], opts(), deps(ok, sandbox));
|
|
335
|
+
expect(r.ran, sandbox).toBe(false);
|
|
336
|
+
expect(r.started, sandbox).toBeUndefined();
|
|
337
|
+
expect(rec.commands, sandbox).toEqual([]);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
it('no SDK, or no copilot binary: not started', async () => {
|
|
341
|
+
expect(await runSandboxed(['/bin/true'], opts(), deps(ok, 'supported', { loadSdk: async () => null }))).toMatchObject({ ran: false, reason: expect.stringContaining('copilot-sdk') });
|
|
342
|
+
expect(await runSandboxed(['/bin/true'], opts(), deps(ok, 'supported', { resolveBin: () => null }))).toMatchObject({ ran: false, reason: expect.stringContaining('copilot CLI not found') });
|
|
343
|
+
});
|
|
344
|
+
it('an argv the shell cannot carry is refused before anything starts, without its text in the reason', async () => {
|
|
345
|
+
const r = await runSandboxed(['/usr/bin/node', 'a\0b'], opts(), deps(ok));
|
|
346
|
+
expect(r).toEqual({ ran: false, refused: true, reason: expect.not.stringContaining('a\0b') });
|
|
347
|
+
expect(rec.connections).toEqual([]);
|
|
348
|
+
});
|
|
349
|
+
it('L-b: a single command too long for the sandbox shell is not started, with a fixed reason that says so', async () => {
|
|
350
|
+
for (const platform of ['linux', 'win32']) {
|
|
351
|
+
rec.connections = [];
|
|
352
|
+
const long = 'x'.repeat(sandboxCommandMaxChars(platform));
|
|
353
|
+
const r = await runSandboxed(['/usr/bin/node', long], opts(), deps(ok, 'supported', { platform }));
|
|
354
|
+
expect(r, platform).toEqual({ ran: false, refused: true, reason: expect.stringContaining('the command is too long for the sandbox shell') });
|
|
355
|
+
expect(r.reason, platform).not.toContain('xxxx');
|
|
356
|
+
expect(rec.connections, platform).toEqual([]);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
it('the kill switch OMG_SANDBOX=off never runs the command unsandboxed here', async () => {
|
|
360
|
+
const r = await runSandboxed(['/bin/true'], opts(), deps(ok, 'supported', { env: { PATH: '', OMG_SANDBOX: 'off' } }));
|
|
361
|
+
expect(r.ran).toBe(false);
|
|
362
|
+
expect(rec.commands).toEqual([]);
|
|
363
|
+
});
|
|
364
|
+
it('M1: a timeout with no answer is no verdict after the start; an attested late answer is a timed-out verdict', async () => {
|
|
365
|
+
// Never answers, not even after the cancel.
|
|
366
|
+
const hung = await runSandboxed(['/bin/sleep', '99'], opts({ timeoutMs: 20 }), deps({ sandboxed: true }));
|
|
367
|
+
expect(hung).toMatchObject({ ran: false, started: true, reason: expect.stringContaining('timed out after 20 ms') });
|
|
368
|
+
expect(rec.cancels).toHaveLength(1);
|
|
369
|
+
expect(rec.disconnects).toBe(1);
|
|
370
|
+
expect(killed).toContain(4321);
|
|
371
|
+
// Answered after the cancel and attested: a timed-out verdict (exit 124).
|
|
372
|
+
rec.cancels = [];
|
|
373
|
+
const late = await runSandboxed(['/bin/sleep', '99'], opts({ timeoutMs: 20 }), deps({ answer: { success: false, exitCode: 130, output: 'partial' }, sandboxed: true, answerOnCancel: true }));
|
|
374
|
+
expect(late).toMatchObject({ ran: true, status: 124, timedOut: true, output: expect.stringContaining('timed out after 20 ms') });
|
|
375
|
+
expect(rec.cancels).toHaveLength(1);
|
|
376
|
+
});
|
|
377
|
+
it('createSandboxRunner: a working-tree omg.jsonc cannot open the network or switch the gates', async () => {
|
|
378
|
+
const root = join(dir, 'root');
|
|
379
|
+
mkdirSync(root);
|
|
380
|
+
const project = { factory: { run: { sandbox: { writeNetwork: 'registry', allowedHosts: ['evil.example'], gates: 'unsandboxed' } } } };
|
|
381
|
+
const run = createSandboxRunner(root, deps(ok), { user: null, project });
|
|
382
|
+
const r = await run({ purpose: 'gate', argv: ['node', 'x'], exe: '/usr/bin/node', args: ['x'], cwd: join(dir, 'checkout'), commonGitDir: join(dir, 'repo', '.git'), timeoutMs: 60_000 });
|
|
383
|
+
expect(r.ran).toBe(true);
|
|
384
|
+
const config = rec.optionsUpdates[0]?.sandboxConfig;
|
|
385
|
+
expect(config.userPolicy.network).toEqual({ allowOutbound: false, allowLocalNetwork: false });
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
describe('createSandboxRunner and requireDeniedPaths', () => {
|
|
389
|
+
it('passes the request\'s requireDeniedPaths to the sandbox: a host without denied_paths then runs nothing', async () => {
|
|
390
|
+
const run = createSandboxRunner(join(dir, 'checkout'), deps(ok, 'supported', {}, false), { user: null, project: undefined });
|
|
391
|
+
const req = { purpose: 'gate', argv: ['node', 'x'], exe: '/usr/bin/node', args: ['x'], cwd: join(dir, 'checkout'), commonGitDir: join(dir, 'repo', '.git'), timeoutMs: 60_000 };
|
|
392
|
+
expect(await run({ ...req, requireDeniedPaths: true })).toMatchObject({ ran: false, reason: expect.stringContaining('requireDeniedPaths') });
|
|
393
|
+
expect(rec.commands).toEqual([]);
|
|
394
|
+
expect(await run(req)).toMatchObject({ ran: true, credentialFilesReadable: true });
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
describe('buildSandboxConfig deny list (Windows)', () => {
|
|
398
|
+
it('adds gh\'s %APPDATA%\\GitHub CLI and the GCM/MSAL %LOCALAPPDATA%\\.IdentityService under the real home', () => {
|
|
399
|
+
const home = 'C:\\Users\\me';
|
|
400
|
+
const config = buildSandboxConfig('write', {
|
|
401
|
+
worktree: 'C:\\w\\checkout', commonGitDir: 'C:\\w\\repo\\.git', pluginRoot: 'C:\\p', jobHome: 'C:\\j\\home', jobDir: 'C:\\j', realHome: home,
|
|
402
|
+
platform: 'win32', settings: { ...DEFAULT_SANDBOX_SETTINGS, allowedHosts: [], extraReadonlyPaths: [], extraReadwritePaths: [] }, hostCommits: true,
|
|
403
|
+
omcStateRoot: join(dir, 'omc-state'),
|
|
404
|
+
}, { supported: true, capabilities: { denied_paths: true } });
|
|
405
|
+
const denied = (config.userPolicy.filesystem.deniedPaths ?? []).map((p) => p.replace(/\//g, '\\'));
|
|
406
|
+
expect(denied).toContain('C:\\Users\\me\\AppData\\Roaming\\GitHub CLI');
|
|
407
|
+
expect(denied).toContain('C:\\Users\\me\\AppData\\Local\\.IdentityService');
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
/** bash: /bin/bash, or on Windows Git for Windows' own (never System32's WSL launcher). */
|
|
411
|
+
function posixShell() {
|
|
412
|
+
if (process.platform !== 'win32')
|
|
413
|
+
return '/bin/bash';
|
|
414
|
+
const git = findOnPath('git.exe', process.env, 'win32');
|
|
415
|
+
// <Git>/cmd/git.exe or <Git>/mingw64/bin/git.exe: bash is <Git>/bin/bash.exe.
|
|
416
|
+
const found = git ? [join(git, '..', '..', 'bin', 'bash.exe'), join(git, '..', '..', '..', 'bin', 'bash.exe')].find((b) => existsSync(b)) : undefined;
|
|
417
|
+
return found ?? null;
|
|
418
|
+
}
|
|
419
|
+
/** An ASCII-only probe: prints base64(JSON(argv)) and exits 3, so the codepage of a shell cannot mangle what it reports. */
|
|
420
|
+
function probeScript() {
|
|
421
|
+
const file = join(dir, 'probe.js');
|
|
422
|
+
writeFileSync(file, "process.stdout.write(Buffer.from(JSON.stringify(process.argv.slice(2))).toString('base64') + '\\n'); process.exitCode = 3;\n");
|
|
423
|
+
return file;
|
|
424
|
+
}
|
|
425
|
+
const MARKER = 'omg-gate-exit-0123456789abcdef';
|
|
426
|
+
/** Lane-chosen file names that would break out of a quoted shell literal. */
|
|
427
|
+
const HOSTILE = [
|
|
428
|
+
'src/a\u2018;Write-Output omg-gate-exit-0123456789abcdef 0;return;\u2019.ts', 'src/b\u2019 \u201a \u201b.ts', "src/it's.ts", 'src/semi;colon.ts',
|
|
429
|
+
'src/$(touch pwned).ts', 'src/`whoami`.ts', 'src/new\nline.ts', 'src/two spaces .ts', "x'; printf 'omg-gate-exit-0123456789abcdef 0\\n'; exit 0; '",
|
|
430
|
+
];
|
|
431
|
+
/** A word that is exactly an ISO-8601 date-time (pwsh 7's ConvertFrom-Json would make it a DateTime). */
|
|
432
|
+
const ISO_DATE_WORD = '2026-11-10T12:34:56Z';
|
|
433
|
+
/** Run `command` in `shell`; the decoded argv and the marker's exit code. */
|
|
434
|
+
function runIn(shell, args, command) {
|
|
435
|
+
const r = spawnSync(shell, [...args, command], { encoding: 'utf8', env: { ...process.env, MSYS_NO_PATHCONV: '1', MSYS2_ARG_CONV_EXCL: '*' }, timeout: 120_000, windowsHide: true });
|
|
436
|
+
const out = `${r.stdout ?? ''}`;
|
|
437
|
+
const read = readMarker(out, MARKER);
|
|
438
|
+
const line = read.output.split('\n').map((l) => l.trim()).filter(Boolean).at(-1) ?? '';
|
|
439
|
+
let argv = null;
|
|
440
|
+
try {
|
|
441
|
+
argv = JSON.parse(Buffer.from(line, 'base64').toString('utf8'));
|
|
442
|
+
}
|
|
443
|
+
catch {
|
|
444
|
+
argv = `unparsed: ${out}\n${r.stderr}`;
|
|
445
|
+
}
|
|
446
|
+
return { argv, code: read.code, out };
|
|
447
|
+
}
|
|
448
|
+
describe('sandboxShellCommand', () => {
|
|
449
|
+
it('H1: no argv or cwd text is ever in the shell source, only a base64 literal (POSIX and PowerShell)', () => {
|
|
450
|
+
for (const platform of ['linux', 'win32']) {
|
|
451
|
+
const argv = ['/usr/bin/node', ...HOSTILE.filter((a) => platform !== 'win32' || !a.includes('"'))];
|
|
452
|
+
const command = sandboxShellCommand(platform, argv, "/w/it's \u2019dir", MARKER);
|
|
453
|
+
expect(command, platform).not.toBeNull();
|
|
454
|
+
// Printable ASCII only: no smart quote, newline or backtick from a name reaches the shell's parser.
|
|
455
|
+
expect(command, platform).toMatch(/^[\x20-\x7e]+$/);
|
|
456
|
+
for (const word of ['touch pwned', 'whoami', 'semi;colon', "it's", 'Write-Output'])
|
|
457
|
+
expect(command, `${platform} ${word}`).not.toContain(word);
|
|
458
|
+
const payload = /'([A-Za-z0-9+/=]+)'\)?/.exec(command.replace(MARKER, ''))[1];
|
|
459
|
+
const decoded = Buffer.from(payload, 'base64').toString('utf8');
|
|
460
|
+
if (platform === 'win32')
|
|
461
|
+
expect(decoded.split('\0')).toEqual(["/w/it's \u2019dir", ...argv]);
|
|
462
|
+
else
|
|
463
|
+
expect(decoded.split('\0').slice(0, -1)).toEqual(["/w/it's \u2019dir", ...argv]);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
it('refuses a NUL anywhere, an empty argv, a bad marker, and on Windows an empty word or a double quote', () => {
|
|
467
|
+
expect(sandboxShellCommand('win32', ['node.exe', 'say "hi"'], 'C:\\w', MARKER)).toBeNull();
|
|
468
|
+
expect(sandboxShellCommand('win32', ['node.exe', ''], 'C:\\w', MARKER)).toBeNull();
|
|
469
|
+
expect(sandboxShellCommand('linux', [], '/w', MARKER)).toBeNull();
|
|
470
|
+
expect(sandboxShellCommand('linux', ['/bin/x', 'a\0b'], '/w', MARKER)).toBeNull();
|
|
471
|
+
expect(sandboxShellCommand('linux', ['/bin/x'], '/w\0', MARKER)).toBeNull();
|
|
472
|
+
expect(sandboxShellCommand('linux', ['/bin/x'], '/w', "m'; x")).toBeNull();
|
|
473
|
+
// POSIX keeps a double quote and an empty word.
|
|
474
|
+
expect(sandboxShellCommand('linux', ['/bin/x', '"', ''], '/w', MARKER)).not.toBeNull();
|
|
475
|
+
});
|
|
476
|
+
it('H1 live: bash hands every hostile word to the command verbatim and reports the command\'s own exit code', () => {
|
|
477
|
+
const bash = posixShell();
|
|
478
|
+
// Git for Windows' bash is on PATH on every Windows CI runner; without it this host has nothing to run.
|
|
479
|
+
if (!bash) {
|
|
480
|
+
// Only a Windows host without Git for Windows has no bash to run it in.
|
|
481
|
+
expect(findOnPath('git.exe', process.env, 'win32')).toBeNull();
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const argv = [process.execPath, probeScript(), ...HOSTILE];
|
|
485
|
+
const r = runIn(bash, ['-c'], sandboxShellCommand('linux', argv, dir, MARKER));
|
|
486
|
+
expect(r.argv, r.out).toEqual(HOSTILE);
|
|
487
|
+
expect(r.code, r.out).toBe(3);
|
|
488
|
+
}, 150_000);
|
|
489
|
+
it('H1 live: PowerShell hands every hostile word (smart quotes included) to the command verbatim', () => {
|
|
490
|
+
const ps = process.platform === 'win32' ? 'powershell.exe' : findOnPath('pwsh', process.env, process.platform);
|
|
491
|
+
if (!ps) {
|
|
492
|
+
// Linux and macOS without pwsh: the static checks above cover the form.
|
|
493
|
+
expect(process.platform).not.toBe('win32');
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
const words = [...HOSTILE.filter((a) => !a.includes('"')), ISO_DATE_WORD];
|
|
497
|
+
const argv = [process.execPath, probeScript(), ...words];
|
|
498
|
+
const r = runIn(ps, ['-NoProfile', '-NonInteractive', '-Command'], sandboxShellCommand('win32', argv, dir, MARKER));
|
|
499
|
+
expect(r.argv, r.out).toEqual(words);
|
|
500
|
+
expect(r.code, r.out).toBe(3);
|
|
501
|
+
}, 150_000);
|
|
502
|
+
// L-a: pwsh 7 (the runtime's likely shell) retypes an ISO-8601 string that passes through ConvertFrom-Json.
|
|
503
|
+
const pwsh7 = process.platform === 'win32' ? findOnPath('pwsh', process.env, 'win32') : null;
|
|
504
|
+
it.runIf(pwsh7 !== null)('H1 live: pwsh 7 hands every hostile word and an ISO-8601 date word to the command verbatim (only where pwsh 7 is on PATH; skipped otherwise)', () => {
|
|
505
|
+
const words = [...HOSTILE.filter((a) => !a.includes('"')), ISO_DATE_WORD];
|
|
506
|
+
const argv = [process.execPath, probeScript(), ...words];
|
|
507
|
+
const r = runIn(pwsh7, ['-NoProfile', '-NonInteractive', '-Command'], sandboxShellCommand('win32', argv, dir, MARKER));
|
|
508
|
+
expect(r.argv, r.out).toEqual(words);
|
|
509
|
+
expect(r.code, r.out).toBe(3);
|
|
510
|
+
}, 150_000);
|
|
511
|
+
it('M2 live: the command\'s output is bounded inside the shell, the marker stays the last line', () => {
|
|
512
|
+
const big = join(dir, 'big.js');
|
|
513
|
+
writeFileSync(big, "for (let i = 0; i < 3000; i++) console.log('line ' + i + ' ' + 'x'.repeat(60));\n");
|
|
514
|
+
const bash = posixShell();
|
|
515
|
+
expect(bash !== null || findOnPath('git.exe', process.env, 'win32') === null).toBe(true);
|
|
516
|
+
if (bash) {
|
|
517
|
+
const r = spawnSync(bash, ['-c', sandboxShellCommand('linux', [process.execPath, big], dir, MARKER)], { encoding: 'utf8', env: { ...process.env, MSYS_NO_PATHCONV: '1' }, timeout: 120_000 });
|
|
518
|
+
const read = readMarker(r.stdout, MARKER);
|
|
519
|
+
expect(read.code, r.stderr).toBe(0);
|
|
520
|
+
const lines = read.output.split('\n');
|
|
521
|
+
expect(Buffer.byteLength(read.output), `${bash}: ${lines.length} lines, first ${JSON.stringify(lines.slice(0, 3))}, stderr ${r.stderr.slice(0, 500)}`).toBeLessThanOrEqual(SHELL_OUTPUT_BYTES + 2);
|
|
522
|
+
expect(read.output).toContain('line 2999');
|
|
523
|
+
}
|
|
524
|
+
const ps = process.platform === 'win32' ? 'powershell.exe' : findOnPath('pwsh', process.env, process.platform);
|
|
525
|
+
if (ps) {
|
|
526
|
+
const r = spawnSync(ps, ['-NoProfile', '-NonInteractive', '-Command', sandboxShellCommand('win32', [process.execPath, big], dir, MARKER)], { encoding: 'utf8', timeout: 120_000, windowsHide: true });
|
|
527
|
+
const read = readMarker(r.stdout, MARKER);
|
|
528
|
+
expect(read.code, r.stderr).toBe(0);
|
|
529
|
+
expect(read.output.split('\n').filter((l) => l.trim()).length).toBeLessThanOrEqual(SHELL_OUTPUT_LINES);
|
|
530
|
+
expect(read.output).toContain('line 2999');
|
|
531
|
+
}
|
|
532
|
+
}, 150_000);
|
|
533
|
+
it('L-b: a built-in file list too long for the Windows command line is split into calls that each fit, in order, none lost', () => {
|
|
534
|
+
const exe = 'C:\\Program Files\\nodejs\\node.exe';
|
|
535
|
+
const cwd = 'C:\\Users\\me\\repo\\.omg\\state\\factory-checkouts\\issue-1';
|
|
536
|
+
const files = Array.from({ length: 900 }, (_, i) => `src/features/some-area/deeply/nested/module-${i}/index.test.ts`);
|
|
537
|
+
for (const [script, fixed] of [['node_modules/vitest/vitest.mjs', 2], ['node_modules/eslint/bin/eslint.js', 1]]) {
|
|
538
|
+
const args = fixed === 2 ? [script, 'run', ...files] : [script, ...files];
|
|
539
|
+
expect(sandboxCommandTooLong('win32', [exe, ...args], cwd)).toBe(true);
|
|
540
|
+
const parts = splitFileListArgs('win32', exe, args, fixed, cwd);
|
|
541
|
+
expect(parts.length, script).toBeGreaterThan(1);
|
|
542
|
+
for (const p of parts) {
|
|
543
|
+
expect(p.slice(0, fixed)).toEqual(args.slice(0, fixed));
|
|
544
|
+
expect(p.length).toBeGreaterThan(fixed);
|
|
545
|
+
expect(sandboxCommandTooLong('win32', [exe, ...p], cwd)).toBe(false);
|
|
546
|
+
}
|
|
547
|
+
expect(parts.flatMap((p) => p.slice(fixed))).toEqual(files);
|
|
548
|
+
// Off Windows the same list fits one shell argument: one call.
|
|
549
|
+
expect(splitFileListArgs('linux', '/usr/bin/node', args, fixed, '/w')).toEqual([args]);
|
|
550
|
+
}
|
|
551
|
+
// A list that fits stays one call; a single file that alone is too long stays a call of its own (refused at run time).
|
|
552
|
+
expect(splitFileListArgs('win32', exe, ['node_modules/eslint/bin/eslint.js', 'src/a.ts'], 1, cwd)).toEqual([['node_modules/eslint/bin/eslint.js', 'src/a.ts']]);
|
|
553
|
+
const huge = `src/${'y'.repeat(30_000)}.ts`;
|
|
554
|
+
expect(splitFileListArgs('win32', exe, ['eslint.js', 'src/a.ts', huge, 'src/b.ts'], 1, cwd)).toEqual([['eslint.js', 'src/a.ts'], ['eslint.js', huge], ['eslint.js', 'src/b.ts']]);
|
|
555
|
+
});
|
|
556
|
+
it('L-b: fileListParts splits only the built-in eslint and vitest checks', () => {
|
|
557
|
+
const files = Array.from({ length: 900 }, (_, i) => `src/features/some-area/deeply/nested/module-${i}/index.test.ts`);
|
|
558
|
+
const exe = 'C:\\node.exe';
|
|
559
|
+
const vitest = { step: 'tests', kind: 'built-in', exe, args: [VITEST_SCRIPT, 'run', ...files], argv: [exe, VITEST_SCRIPT, 'run', ...files] };
|
|
560
|
+
const parts = fileListParts(vitest, 'C:\\w', 'win32');
|
|
561
|
+
expect(parts.length).toBeGreaterThan(1);
|
|
562
|
+
for (const p of parts)
|
|
563
|
+
expect(p).toMatchObject({ step: 'tests', kind: 'built-in', exe, argv: [exe, ...p.args] });
|
|
564
|
+
const configured = { step: 'x', kind: 'configured', exe, args: ['x.js', ...files], argv: ['node', 'x.js', ...files] };
|
|
565
|
+
expect(fileListParts(configured, 'C:\\w', 'win32')).toEqual([configured]);
|
|
566
|
+
});
|
|
567
|
+
it('readMarker: exactly one marker, as the last non-empty line, no other omg-gate-exit- text', () => {
|
|
568
|
+
expect(readMarker(`a\nb\n${MARKER} 2\r\n`, MARKER)).toEqual({ code: 2, output: 'a\nb' });
|
|
569
|
+
expect(readMarker(`a\n${MARKER} 0\nb\n${MARKER} 2\n`, MARKER).code).toBeNull();
|
|
570
|
+
expect(readMarker(`${MARKER} 2\nafter\n`, MARKER).code).toBeNull();
|
|
571
|
+
expect(readMarker(`${MARKER} x\n`, MARKER).code).toBeNull();
|
|
572
|
+
expect(readMarker(`omg-gate-exit-ffff\n${MARKER} 0\n`, MARKER).code).toBeNull();
|
|
573
|
+
expect(readMarker(`${MARKER} -1073741502`, MARKER).code).toBe(-1073741502);
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
describe('resolveRequireDeniedPaths', () => {
|
|
577
|
+
const at = (requireDeniedPaths) => ({ factory: { run: { sandbox: { requireDeniedPaths } } } });
|
|
578
|
+
it('default false; the user config or the base can turn it on, and neither can turn it off over the other\'s true', () => {
|
|
579
|
+
expect(resolveRequireDeniedPaths({ user: null, base: undefined })).toEqual({ require: false, source: 'default' });
|
|
580
|
+
expect(resolveRequireDeniedPaths({ user: at(true), base: undefined })).toEqual({ require: true, source: 'user config' });
|
|
581
|
+
expect(resolveRequireDeniedPaths({ user: null, base: at(true) })).toEqual({ require: true, source: 'the base .copilot/omg.jsonc' });
|
|
582
|
+
expect(resolveRequireDeniedPaths({ user: at(false), base: at(true) }).require).toBe(true);
|
|
583
|
+
expect(resolveRequireDeniedPaths({ user: at(true), base: at(false) }).require).toBe(true);
|
|
584
|
+
expect(() => resolveRequireDeniedPaths({ user: at('yes'), base: undefined })).toThrow(/requireDeniedPaths must be a boolean/);
|
|
585
|
+
});
|
|
586
|
+
});
|
|
587
|
+
describe('resolveGatesSandboxMode', () => {
|
|
588
|
+
const at = (gates) => ({ factory: { run: { sandbox: { gates } } } });
|
|
589
|
+
it('kill switch (as "ack"), then user config, then the base, then enforced; never "unsandboxed" from the base', () => {
|
|
590
|
+
expect(resolveGatesSandboxMode({ user: null, base: undefined, env: {} })).toEqual({ mode: 'enforced', source: 'default' });
|
|
591
|
+
expect(resolveGatesSandboxMode({ user: at('ack'), base: at('enforced'), env: {} })).toEqual({ mode: 'ack', source: 'user config' });
|
|
592
|
+
expect(resolveGatesSandboxMode({ user: null, base: at('ack'), env: {} })).toEqual({ mode: 'ack', source: 'the base .copilot/omg.jsonc' });
|
|
593
|
+
expect(resolveGatesSandboxMode({ user: at('unsandboxed'), base: undefined, env: {} }).mode).toBe('unsandboxed');
|
|
594
|
+
// L1: the kill switch parks per head; it never runs the PR's code unsandboxed by itself.
|
|
595
|
+
expect(resolveGatesSandboxMode({ user: at('unsandboxed'), base: undefined, env: { OMG_SANDBOX: 'off' } })).toEqual({ mode: 'ack', source: 'OMG_SANDBOX=off' });
|
|
596
|
+
expect(() => resolveGatesSandboxMode({ user: at('enforced'), base: at('unsandboxed'), env: {} })).toThrow(/accepted from the user config only/);
|
|
597
|
+
expect(() => resolveGatesSandboxMode({ user: at('off'), base: undefined, env: {} })).toThrow(/must be "enforced" or "ack" or "unsandboxed"/);
|
|
598
|
+
// copilotRun.sandbox has no gates key: only factory.run.sandbox counts.
|
|
599
|
+
expect(resolveGatesSandboxMode({ user: { copilotRun: { sandbox: { gates: 'ack' } } }, base: undefined, env: {} }).mode).toBe('enforced');
|
|
600
|
+
});
|
|
601
|
+
});
|
|
602
|
+
describe('gateEnv', () => {
|
|
603
|
+
it('M4: an allowlist: no token, npm config, cloud or LLM key passes; the home, temp and app dirs are redirected', () => {
|
|
604
|
+
const home = join(dir, 'gate-home');
|
|
605
|
+
const credentials = {
|
|
606
|
+
...TOKENS, gh_config_dir: '/x', SSH_AUTH_SOCK: '/s', GIT_ASKPASS: '/a', SSH_ASKPASS: '/a', GIT_DIR: '/evil',
|
|
607
|
+
NPM_TOKEN: 'npm_x', NODE_AUTH_TOKEN: 'npm_y', npm_config_userconfig: 'C:\\Users\\me\\.npmrc', 'npm_config_//registry.npmjs.org/:_authToken': 'npm_z',
|
|
608
|
+
NPM_CONFIG__AUTH: 'x', GITHUB_PAT: 'ghp_x', SYSTEM_ACCESSTOKEN: 'ado', ACTIONS_RUNTIME_TOKEN: 'a', ACTIONS_ID_TOKEN_REQUEST_TOKEN: 'b',
|
|
609
|
+
AZURE_CLIENT_SECRET: 'c', ARM_CLIENT_SECRET: 'd', AWS_ACCESS_KEY_ID: 'AKIA', AWS_SECRET_ACCESS_KEY: 'e', AWS_SESSION_TOKEN: 'f',
|
|
610
|
+
GOOGLE_APPLICATION_CREDENTIALS: '/g.json', OPENAI_API_KEY: 'sk-x', ANTHROPIC_API_KEY: 'sk-ant-x', NODE_OPTIONS: '--require /evil.js',
|
|
611
|
+
};
|
|
612
|
+
const env = gateEnv({
|
|
613
|
+
Path: '/bin', PATHEXT: '.EXE', SystemRoot: 'C:\\Windows', ComSpec: 'C:\\Windows\\system32\\cmd.exe', LANG: 'C', LC_ALL: 'C', TZ: 'UTC', CI: 'true',
|
|
614
|
+
NODE_ENV: 'test', npm_config_cache: '/cache', HOME: '/real', USERPROFILE: 'C:\\Users\\me', APPDATA: 'C:\\Users\\me\\AppData\\Roaming',
|
|
615
|
+
LOCALAPPDATA: 'C:\\Users\\me\\AppData\\Local', XDG_CONFIG_HOME: '/real/.config', TEMP: 'C:\\Users\\me\\AppData\\Local\\Temp', ...credentials,
|
|
616
|
+
}, home);
|
|
617
|
+
for (const k of Object.keys(credentials))
|
|
618
|
+
expect(env[k], k).toBeUndefined();
|
|
619
|
+
expect(JSON.stringify(env)).not.toMatch(/ghp_|npm_[xyz]|sk-|AKIA|\.npmrc|evil/);
|
|
620
|
+
expect(env).toMatchObject({
|
|
621
|
+
Path: '/bin', PATHEXT: '.EXE', SystemRoot: 'C:\\Windows', ComSpec: 'C:\\Windows\\system32\\cmd.exe', LANG: 'C', LC_ALL: 'C', TZ: 'UTC', CI: 'true',
|
|
622
|
+
NODE_ENV: 'test', npm_config_cache: '/cache',
|
|
623
|
+
HOME: home, USERPROFILE: home, XDG_CONFIG_HOME: join(home, '.config'), APPDATA: join(home, 'AppData', 'Roaming'), LOCALAPPDATA: join(home, 'AppData', 'Local'),
|
|
624
|
+
TEMP: join(home, 'tmp'), TMP: join(home, 'tmp'), TMPDIR: join(home, 'tmp'),
|
|
625
|
+
GIT_CONFIG_NOSYSTEM: '1', GIT_TERMINAL_PROMPT: '0', GCM_INTERACTIVE: 'never', GIT_NO_REPLACE_OBJECTS: '1',
|
|
626
|
+
});
|
|
627
|
+
expect(readFileSync(env.GIT_CONFIG_GLOBAL, 'utf8')).toBe('');
|
|
628
|
+
// No APPDATA in, none out (POSIX).
|
|
629
|
+
expect(gateEnv({ PATH: '/bin' }, home).APPDATA).toBeUndefined();
|
|
630
|
+
});
|
|
631
|
+
it('an unsandboxed `npm test` still runs with the allowlisted env and the empty home, and sees no token', async () => {
|
|
632
|
+
const pkg = join(dir, 'pkg');
|
|
633
|
+
mkdirSync(pkg);
|
|
634
|
+
writeFileSync(join(pkg, 'package.json'), JSON.stringify({ name: 'p', version: '1.0.0', scripts: { test: 'node probe.js' } }));
|
|
635
|
+
writeFileSync(join(pkg, 'probe.js'), "console.log('TOKEN=' + (process.env.GH_TOKEN ?? 'none') + ' NPM=' + (process.env.NPM_TOKEN ?? 'none') + ' HOME=' + process.env.HOME);\n");
|
|
636
|
+
const saved = { GH_TOKEN: process.env.GH_TOKEN, NPM_TOKEN: process.env.NPM_TOKEN };
|
|
637
|
+
process.env.GH_TOKEN = TOKENS.GH_TOKEN;
|
|
638
|
+
process.env.NPM_TOKEN = 'npm_abcdefghijklmnopqrstuvwxyz0123456789';
|
|
639
|
+
try {
|
|
640
|
+
const r = await defaultLocalGateRunner(['npm', 'test'], pkg, 120_000);
|
|
641
|
+
expect(r.startError).toBeUndefined();
|
|
642
|
+
expect(r.status, r.stderr).toBe(0);
|
|
643
|
+
expect(r.stdout).toContain('TOKEN=none NPM=none');
|
|
644
|
+
expect(r.stdout).toMatch(/HOME=\S*omg-gate-home-/);
|
|
645
|
+
}
|
|
646
|
+
finally {
|
|
647
|
+
for (const [k, v] of Object.entries(saved)) {
|
|
648
|
+
if (v === undefined)
|
|
649
|
+
delete process.env[k];
|
|
650
|
+
else
|
|
651
|
+
process.env[k] = v;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}, 150_000);
|
|
655
|
+
});
|
|
656
|
+
//# sourceMappingURL=sandbox-exec.test.js.map
|