feat: Fir-429 Sandbox shim injection and firma-secret-shim binary - #629
Closed
nappa85 wants to merge 6 commits into
Closed
feat: Fir-429 Sandbox shim injection and firma-secret-shim binary#629nappa85 wants to merge 6 commits into
firma-secret-shim binary#629nappa85 wants to merge 6 commits into
Conversation
nappa85
marked this pull request as draft
September 2, 2026 09:39
nappa85
force-pushed
the
fir-429-v2/10-run-dispatch-config
branch
from
September 3, 2026 08:14
0614c53 to
2ba7945
Compare
nappa85
force-pushed
the
fir-429-v2/11-run-shim-injection
branch
7 times, most recently
from
September 3, 2026 13:49
c10e99c to
abaf068
Compare
nappa85
marked this pull request as ready for review
September 3, 2026 14:31
nappa85
force-pushed
the
fir-429-v2/11-run-shim-injection
branch
from
September 4, 2026 14:41
d8cf952 to
6759640
Compare
nappa85
force-pushed
the
fir-429-v2/11-run-shim-injection
branch
3 times, most recently
from
September 7, 2026 07:42
cfdd09d to
30b19a6
Compare
nappa85
force-pushed
the
fir-429-v2/11-run-shim-injection
branch
from
September 7, 2026 08:47
99bb423 to
cc3a22d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Final piece of the CLI-vault path: actually mount the shim into the
sandbox in place of the real vault CLI, and ship the shim binary itself.
Everything from PR08–10 (dictionary, broker, gateway, dispatch, config) is
inert without this — a profile listing
secret_providershas had noeffect on an actual sandboxed launch until now.
What Changed
crates/firma-run/src/runtime/secret_shims.rs(new):pre_bind_gateway: binds theSecretGatewayListenersocket beforethe Sidecar starts (so
FIRMA_SECRET_GATEWAY_ADDRcan be set on theSidecar's environment at spawn time), returning
Nonewhen theprofile lists no
secret_providers. Returns aBoundGatewayholdingthe socket open and its formatted address.
prepare: computes aShimPlan(bind mounts — one shim overlay perconfigured tool — plus
FIRMA_BROKER_ADDRenv), starts theout-of-sandbox broker (
BrokerListener+serve_forever), and startsserving the pre-bound gateway. Bind-mounts the shipped
firma-secret-shimbinary over each shimmed executable's path insidethe sandbox.
plan) is pure and unit-tested in isolationfrom actual sandbox syscalls; broker/gateway startup and mount
application are thin glue exercised end-to-end on bwrap.
crates/firma/src/bin/firma-secret-shim.rs(new): the in-sandbox shimbinary itself. Reads
FIRMA_BROKER_ADDR, sends{"bin":"<basename>","args":"<space-joined argv[1..]>"}to the broker,writes the broker's decoded stdout back out, exits 0/1. Holds no
credentials or plaintext — the real tool runs in the broker outside the
sandbox. Fails closed: any error exits non-zero without running
anything.
crates/firma-run/src/runtime.rs: wirespre_bind_gateway/prepareinto
execute_run; relocatesresolve_host_executable/require_file/executable_search_candidatesout ofruntime::vscode(previouslyprivate there) so
secret_shimscan reuse them for locating the shippedshim binary.
crates/firma-run/src/runtime/vscode.rs: updated call sites for therelocated helpers.
crates/firma/Cargo.toml: registers the newfirma-secret-shimbinarytarget.
Risks / Notes
CLI vaults — worth close review of the bind-mount ordering (shim must be
mounted over the real binary before the sandboxed process can resolve
it) and of the shim's fail-closed behavior on broker connection errors.
vscode.rsis a pure move, not a rewrite —verify via diff that behavior for existing VS Code launch resolution is
unchanged.
AI Assistance
Generated with AI (Claude Code); human-reviewed for correctness and scope.