@fungi.computer/truffle 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +542 -2
- package/computerd-loopback.cjs +16 -0
- package/dist/auth-cli.d.ts +46 -0
- package/dist/auth-cli.js +373 -0
- package/dist/fungi-account-command.d.ts +18 -0
- package/dist/fungi-account-command.js +95 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +23 -0
- package/dist/internal/image-fit-metafile.json +106 -0
- package/dist/internal/local-image-fit-worker.mjs +960 -0
- package/dist/internal/private-workerd-sandbox-worker.mjs +27487 -0
- package/dist/internal/sandbox-metafile.json +6726 -0
- package/dist/linear-auth.d.ts +4 -0
- package/dist/linear-auth.js +72 -0
- package/dist/local-archive-handoff.d.ts +12 -0
- package/dist/local-archive-handoff.js +21 -0
- package/dist/local-extensions.d.ts +143 -0
- package/dist/local-extensions.js +624 -0
- package/dist/local-image-fit.d.ts +30 -0
- package/dist/local-image-fit.js +105 -0
- package/dist/local-login.d.ts +55 -0
- package/dist/local-login.js +167 -0
- package/dist/local-models.d.ts +16 -0
- package/dist/local-models.js +82 -0
- package/dist/local-session-archives.d.ts +8 -0
- package/dist/local-session-archives.js +152 -0
- package/dist/local-skill-source.d.ts +21 -0
- package/dist/local-skill-source.js +433 -0
- package/dist/log-event.d.ts +9 -0
- package/dist/log-event.js +13 -0
- package/dist/private-bounded-response.d.ts +2 -0
- package/dist/private-bounded-response.js +41 -0
- package/dist/private-bun-shiitake-host.d.ts +11 -0
- package/dist/private-bun-shiitake-host.js +66 -0
- package/dist/private-file-credential-store.d.ts +58 -0
- package/dist/private-file-credential-store.js +331 -0
- package/dist/private-files-patch.d.ts +4 -0
- package/dist/private-files-patch.js +104 -0
- package/dist/private-fungi-account.d.ts +252 -0
- package/dist/private-fungi-account.js +1329 -0
- package/dist/private-fungi-auth-error.d.ts +5 -0
- package/dist/private-fungi-auth-error.js +7 -0
- package/dist/private-fungi-mcp-connection.d.ts +26 -0
- package/dist/private-fungi-mcp-connection.js +162 -0
- package/dist/private-fungi-mcp-endpoint.d.ts +2 -0
- package/dist/private-fungi-mcp-endpoint.js +15 -0
- package/dist/private-fungi-mcp-selection-schema.d.ts +7 -0
- package/dist/private-fungi-mcp-selection-schema.js +15 -0
- package/dist/private-fungi-mcp-selection.d.ts +14 -0
- package/dist/private-fungi-mcp-selection.js +49 -0
- package/dist/private-fungi-model-api.d.ts +6 -0
- package/dist/private-fungi-model-api.js +125 -0
- package/dist/private-fungi-model-catalog.d.ts +16 -0
- package/dist/private-fungi-model-catalog.js +86 -0
- package/dist/private-fungi-model-provider.d.ts +6 -0
- package/dist/private-fungi-model-provider.js +51 -0
- package/dist/private-fungi-pending-logouts.d.ts +34 -0
- package/dist/private-fungi-pending-logouts.js +135 -0
- package/dist/private-fungi-service-logout.d.ts +44 -0
- package/dist/private-fungi-service-logout.js +59 -0
- package/dist/private-invocation-computer.d.ts +58 -0
- package/dist/private-invocation-computer.js +498 -0
- package/dist/private-invocation-files.d.ts +30 -0
- package/dist/private-invocation-files.js +520 -0
- package/dist/private-local-acp-stdio.d.ts +17 -0
- package/dist/private-local-acp-stdio.js +145 -0
- package/dist/private-local-admission-gate.d.ts +14 -0
- package/dist/private-local-admission-gate.js +52 -0
- package/dist/private-local-agent-control.d.ts +101 -0
- package/dist/private-local-agent-control.js +30 -0
- package/dist/private-local-agent-default-model.d.ts +12 -0
- package/dist/private-local-agent-default-model.js +31 -0
- package/dist/private-local-auth-rpc.d.ts +129 -0
- package/dist/private-local-auth-rpc.js +396 -0
- package/dist/private-local-bwrap.d.ts +13 -0
- package/dist/private-local-bwrap.js +70 -0
- package/dist/private-local-client-version.d.ts +5 -0
- package/dist/private-local-client-version.js +43 -0
- package/dist/private-local-computer-attach.d.ts +49 -0
- package/dist/private-local-computer-attach.js +230 -0
- package/dist/private-local-computer-backend.d.ts +282 -0
- package/dist/private-local-computer-backend.js +402 -0
- package/dist/private-local-computer-processes.d.ts +202 -0
- package/dist/private-local-computer-processes.js +613 -0
- package/dist/private-local-config-root.d.ts +21 -0
- package/dist/private-local-config-root.js +19 -0
- package/dist/private-local-containment.d.ts +51 -0
- package/dist/private-local-containment.js +161 -0
- package/dist/private-local-default-model.d.ts +11 -0
- package/dist/private-local-default-model.js +45 -0
- package/dist/private-local-delegation.d.ts +36 -0
- package/dist/private-local-delegation.js +133 -0
- package/dist/private-local-effective-model.d.ts +27 -0
- package/dist/private-local-effective-model.js +17 -0
- package/dist/private-local-exec-environment.d.ts +16 -0
- package/dist/private-local-exec-environment.js +11 -0
- package/dist/private-local-exec-launch.d.ts +41 -0
- package/dist/private-local-exec-launch.js +51 -0
- package/dist/private-local-exec-path.d.ts +6 -0
- package/dist/private-local-exec-path.js +40 -0
- package/dist/private-local-git-exclude.d.ts +2 -0
- package/dist/private-local-git-exclude.js +33 -0
- package/dist/private-local-http-dispatch.d.ts +5 -0
- package/dist/private-local-http-dispatch.js +14 -0
- package/dist/private-local-linux-sandbox.d.ts +8 -0
- package/dist/private-local-linux-sandbox.js +67 -0
- package/dist/private-local-mail.d.ts +13 -0
- package/dist/private-local-mail.js +77 -0
- package/dist/private-local-mesh-enrollment.d.ts +34 -0
- package/dist/private-local-mesh-enrollment.js +188 -0
- package/dist/private-local-mesh-links.d.ts +21 -0
- package/dist/private-local-mesh-links.js +229 -0
- package/dist/private-local-mesh-record.d.ts +120 -0
- package/dist/private-local-mesh-record.js +55 -0
- package/dist/private-local-process-identity.d.ts +20 -0
- package/dist/private-local-process-identity.js +40 -0
- package/dist/private-local-runtime-host.d.ts +192 -0
- package/dist/private-local-runtime-host.js +1177 -0
- package/dist/private-local-sandbox-policy.d.ts +21 -0
- package/dist/private-local-sandbox-policy.js +121 -0
- package/dist/private-local-sandbox.d.ts +37 -0
- package/dist/private-local-sandbox.js +114 -0
- package/dist/private-local-seatbelt.d.ts +24 -0
- package/dist/private-local-seatbelt.js +68 -0
- package/dist/private-local-service-contract.d.ts +170 -0
- package/dist/private-local-service-contract.js +1 -0
- package/dist/private-local-service-discovery.d.ts +217 -0
- package/dist/private-local-service-discovery.js +322 -0
- package/dist/private-local-service-ids.d.ts +3 -0
- package/dist/private-local-service-ids.js +8 -0
- package/dist/private-local-service-lease.d.ts +16 -0
- package/dist/private-local-service-lease.js +105 -0
- package/dist/private-local-service-listener.d.ts +22 -0
- package/dist/private-local-service-listener.js +407 -0
- package/dist/private-local-service-log.d.ts +128 -0
- package/dist/private-local-service-log.js +321 -0
- package/dist/private-local-service-owner.d.ts +135 -0
- package/dist/private-local-service-owner.js +1369 -0
- package/dist/private-local-service-process.d.ts +1 -0
- package/dist/private-local-service-process.js +8 -0
- package/dist/private-local-service-termination.d.ts +7 -0
- package/dist/private-local-service-termination.js +67 -0
- package/dist/private-local-service.d.ts +46 -0
- package/dist/private-local-service.js +606 -0
- package/dist/private-local-session-discovery.d.ts +66 -0
- package/dist/private-local-session-discovery.js +278 -0
- package/dist/private-local-shiitake-host.d.ts +44 -0
- package/dist/private-local-shiitake-host.js +143 -0
- package/dist/private-local-startup-model.d.ts +51 -0
- package/dist/private-local-startup-model.js +86 -0
- package/dist/private-local-stop-all.d.ts +27 -0
- package/dist/private-local-stop-all.js +26 -0
- package/dist/private-local-ui-attachment.d.ts +19 -0
- package/dist/private-local-ui-attachment.js +71 -0
- package/dist/private-local-worker-server.d.ts +16 -0
- package/dist/private-local-worker-server.js +144 -0
- package/dist/private-mcp-form-contract.d.ts +186 -0
- package/dist/private-mcp-form-contract.js +53 -0
- package/dist/private-mcp-form-elicitation.d.ts +18 -0
- package/dist/private-mcp-form-elicitation.js +97 -0
- package/dist/private-mcp-form-session.d.ts +172 -0
- package/dist/private-mcp-form-session.js +148 -0
- package/dist/private-openai-claims.d.ts +30 -0
- package/dist/private-openai-claims.js +69 -0
- package/dist/private-oyster-mcp-auth.d.ts +13 -0
- package/dist/private-oyster-mcp-auth.js +57 -0
- package/dist/private-provider-rejection.d.ts +15 -0
- package/dist/private-provider-rejection.js +24 -0
- package/dist/private-sqlite-owner.d.ts +39 -0
- package/dist/private-sqlite-owner.js +169 -0
- package/dist/private-team-computers.d.ts +38 -0
- package/dist/private-team-computers.js +110 -0
- package/dist/private-workerd-sandbox.d.ts +3 -0
- package/dist/private-workerd-sandbox.js +347 -0
- package/dist/seatbelt/safe-base.sbpl +79 -0
- package/dist/subscription-activation.d.ts +9 -0
- package/dist/subscription-activation.js +62 -0
- package/dist/subscription-identity.d.ts +23 -0
- package/dist/subscription-identity.js +124 -0
- package/dist/subscription-turn.d.ts +17 -0
- package/dist/subscription-turn.js +143 -0
- package/dist/team-apps.d.ts +24 -0
- package/dist/team-apps.js +128 -0
- package/dist/tracker-git-credential.d.ts +15 -0
- package/dist/tracker-git-credential.js +87 -0
- package/native/bin/LICENSE.bubblewrap +502 -0
- package/native/bin/LICENSE.libcap +112 -0
- package/native/bin/LICENSE.sandbox-runtime +201 -0
- package/native/bin/SOURCE.bubblewrap.tar.xz +0 -0
- package/native/bin/build.json +4037 -0
- package/native/bin/bwrap-build-source/Dockerfile +48 -0
- package/native/bin/bwrap-build-source/README.md +96 -0
- package/native/bin/bwrap-build-source/build.mjs +52 -0
- package/native/bin/bwrap-build-source/linux-arm64.ini +14 -0
- package/native/bin/bwrap-build-source/pin.mjs +21 -0
- package/native/bin/bwrap-build-source/record.mjs +74 -0
- package/native/bin/bwrap-build-source/vendor/LICENSE.sandbox-runtime +201 -0
- package/native/bin/bwrap-build-source/vendor/README.md +23 -0
- package/native/bin/bwrap-build-source/vendor/seccomp-unix-block.c +280 -0
- package/native/bin/bwrap-build.json +44 -0
- package/native/bin/fungi-apply-patch +0 -0
- package/native/bin/fungi-bwrap +0 -0
- package/native/bin/fungi-bwrap.sha256 +1 -0
- package/native/bin/fungi-seccomp.bpf +0 -0
- package/native/bin/fungi-seccomp.bpf.sha256 +1 -0
- package/package.json +161 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Same pinned Ubuntu/glibc floor as Cordyceps' retained Linux patch builder.
|
|
2
|
+
FROM ubuntu:22.04@sha256:08ea48a03a3e78ebc7cd526e6a275053223aadd88bfc09cc49b06d5281525fde AS build
|
|
3
|
+
ARG TARGET=linux-x64
|
|
4
|
+
RUN if [ "$TARGET" = linux-arm64 ]; then \
|
|
5
|
+
dpkg --add-architecture arm64 && \
|
|
6
|
+
sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list && \
|
|
7
|
+
printf '%s\n' \
|
|
8
|
+
'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main universe' \
|
|
9
|
+
'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main universe' \
|
|
10
|
+
'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main universe' \
|
|
11
|
+
> /etc/apt/sources.list.d/arm64.list; \
|
|
12
|
+
fi && apt-get update && apt-get install -y --no-install-recommends \
|
|
13
|
+
build-essential ca-certificates curl xz-utils python3-pip ninja-build \
|
|
14
|
+
pkg-config patchelf libcap-dev libseccomp-dev \
|
|
15
|
+
$(if [ "$TARGET" = linux-arm64 ]; then printf 'gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libcap-dev:arm64'; fi) \
|
|
16
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
17
|
+
# prefer_static is a maintained Meson option newer than Jammy's Meson.
|
|
18
|
+
RUN pip3 install --no-cache-dir meson==1.10.2
|
|
19
|
+
COPY --from=node:24.20.0-trixie-slim@sha256:a747ad80c8a161b650d79a6da9c422005b91148b18b8d2c669eb5a0b7c07e600 /usr/local/bin/node /usr/local/bin/node
|
|
20
|
+
ARG SOURCE_URL
|
|
21
|
+
ARG SOURCE_SHA256
|
|
22
|
+
RUN mkdir /upstream && curl -fL "$SOURCE_URL" -o /source.tar.xz \
|
|
23
|
+
&& printf '%s /source.tar.xz\n' "$SOURCE_SHA256" | sha256sum -c - \
|
|
24
|
+
&& tar -xJf /source.tar.xz --strip-components=1 -C /upstream
|
|
25
|
+
COPY . /source
|
|
26
|
+
ARG SECCOMP_SOURCE_SHA256
|
|
27
|
+
ARG SECCOMP_LICENSE_SHA256
|
|
28
|
+
RUN test "$(getconf GNU_LIBC_VERSION)" = "glibc 2.35" \
|
|
29
|
+
&& printf '%s /source/vendor/seccomp-unix-block.c\n%s /source/vendor/LICENSE.sandbox-runtime\n' \
|
|
30
|
+
"$SECCOMP_SOURCE_SHA256" "$SECCOMP_LICENSE_SHA256" | sha256sum -c - \
|
|
31
|
+
&& meson setup /compiled /upstream --buildtype=release \
|
|
32
|
+
-Dprefer_static=true -Dselinux=disabled -Dtests=false -Dman=disabled \
|
|
33
|
+
-Dbash_completion=disabled -Dzsh_completion=disabled \
|
|
34
|
+
$(if [ "$TARGET" = linux-arm64 ]; then printf '%s' '--cross-file=/source/linux-arm64.ini'; fi) \
|
|
35
|
+
&& meson compile -C /compiled -j 2 \
|
|
36
|
+
&& mkdir /out && cp /compiled/bwrap /out/fungi-bwrap \
|
|
37
|
+
&& cc -O2 -Wall -Wextra -Werror /source/vendor/seccomp-unix-block.c -lseccomp -o /compiled/seccomp-generator \
|
|
38
|
+
&& /compiled/seccomp-generator /out/fungi-seccomp.bpf \
|
|
39
|
+
$(if [ "$TARGET" = linux-arm64 ]; then printf aarch64; else printf x86_64; fi) unix \
|
|
40
|
+
&& chmod 0755 /out/fungi-bwrap \
|
|
41
|
+
&& patchelf --print-needed /out/fungi-bwrap > /needed \
|
|
42
|
+
&& while read -r lib; do \
|
|
43
|
+
case "$lib" in libc.so.6|ld-linux-x86-64.so.2|ld-linux-aarch64.so.1) ;; \
|
|
44
|
+
*) echo "Unpackaged runtime dependency: $lib" >&2; exit 1 ;; esac; \
|
|
45
|
+
done < /needed \
|
|
46
|
+
&& node /source/record.mjs "$TARGET" /out /upstream
|
|
47
|
+
FROM scratch
|
|
48
|
+
COPY --from=build /out/ /
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Linux bubblewrap payload preparation
|
|
2
|
+
|
|
3
|
+
This is source/build preparation, **not a qualified binary or Safe admission**.
|
|
4
|
+
Local continues to refuse Safe. No native build or isolation run was performed
|
|
5
|
+
for this preparation.
|
|
6
|
+
|
|
7
|
+
## Authority and acquisition
|
|
8
|
+
|
|
9
|
+
The maintained upstream is
|
|
10
|
+
[containers/bubblewrap](https://github.com/containers/bubblewrap). `pin.mjs`
|
|
11
|
+
selects its **0.13.1** release asset, not GitHub's generated source archive and
|
|
12
|
+
not Codex's separately modified vendored copy. Read-only acquisition on October
|
|
13
|
+
18, 2026 found:
|
|
14
|
+
|
|
15
|
+
- [Release v0.13.1](https://github.com/containers/bubblewrap/releases/tag/v0.13.1),
|
|
16
|
+
published October 14, not draft/prerelease.
|
|
17
|
+
- Release notes and GitHub's asset API both give SHA-256
|
|
18
|
+
`0e85c8702248b8dd64144f594147553650cdd0e4c951690345faace79c217c4d`. The
|
|
19
|
+
downloaded 129,472-byte `.tar.xz` independently hashed to that value.
|
|
20
|
+
- Annotated tag object `46ec5c413a3c1da265624ddac3a715b4d1bc487d` points to
|
|
21
|
+
commit `362936aea0d5c6e70f7af75d2d44b5a914cb4ba2`. GitHub reports its
|
|
22
|
+
signature valid; this is **not** a claim of local GPG/key verification.
|
|
23
|
+
|
|
24
|
+
`build.mjs --out <directory> --target linux-x64|linux-arm64` uses the existing
|
|
25
|
+
Cordyceps native-builder convention: an explicit Docker BuildKit build/export,
|
|
26
|
+
never a first-use download, host install or PATH search. The recipe uses the
|
|
27
|
+
retained Ubuntu 22.04 image digest/glibc 2.35 floor and ordinary upstream
|
|
28
|
+
Meson/Ninja. It verifies the archive before extraction. Meson 1.10.2 supplies
|
|
29
|
+
`prefer_static`, which Jammy's Meson lacks. Libcap is linked statically;
|
|
30
|
+
`patchelf --print-needed` must report only libc/the platform loader or the build
|
|
31
|
+
fails. These are **unexecuted recipe requirements**, not successful link
|
|
32
|
+
results. Builder-only apt/pip operations occur in the container, never on the
|
|
33
|
+
host. They still require the separately authorized native build.
|
|
34
|
+
|
|
35
|
+
There is no binary digest yet. A successful build will emit `fungi-bwrap`, its
|
|
36
|
+
plain SHA-256 sidecar, `bwrap-build.json`, upstream licenses, the unmodified
|
|
37
|
+
upstream archive and this build recipe. The sidecar detects changed bytes; it is
|
|
38
|
+
not an independent signature or trust root. The source pin, actual build receipt
|
|
39
|
+
and reviewed distribution establish provenance.
|
|
40
|
+
|
|
41
|
+
## Real producer and consumer
|
|
42
|
+
|
|
43
|
+
Local's `build:native` retains the patch builder, then invokes its build-only
|
|
44
|
+
`scripts/build-bwrap.mjs` on Linux. Its Turbo inputs include this directory and
|
|
45
|
+
that script. There is no Mac backend change.
|
|
46
|
+
|
|
47
|
+
`apps/tui/scripts/bundle-native.mjs` requires the Linux payload, digest,
|
|
48
|
+
provenance, licenses and source when preparing
|
|
49
|
+
`@fungi.computer/spore-native-linux-{x64,arm64}`. Missing files fail packaging.
|
|
50
|
+
The package exports `./bin/fungi-bwrap`; no new public shell command is added.
|
|
51
|
+
Local's existing `localBwrapExecutable()` resolves that export when bundled,
|
|
52
|
+
otherwise its own `native/bin`, and verifies the digest each use. No PATH
|
|
53
|
+
fallback exists. Packaging and installed-package resolution still need real
|
|
54
|
+
artifact qualification.
|
|
55
|
+
|
|
56
|
+
## Prepared proof commands — only after a separate heavy grant
|
|
57
|
+
|
|
58
|
+
From the worktree root, under the granted native-build/proof lease:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
node packages/cordyceps/native/bwrap/build.mjs \
|
|
62
|
+
--target linux-x64 --out runtimes/local/native/bin
|
|
63
|
+
TMPDIR="$PWD/.botanical/tmp" FUNGI_RUN_LINUX_SANDBOX_PROOF=1 \
|
|
64
|
+
node --import tsx runtimes/local/test/fixtures/linux-sandbox-proof.mts
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The proof command refuses a missing/digest-invalid real payload **before**
|
|
68
|
+
creating fixtures. It uses the actual Linux argv builder without opening
|
|
69
|
+
production admission. Its disposable state stays under the worktree's ignored
|
|
70
|
+
`.botanical/tmp/linux-enforcement-*`; it prints and retains that exact
|
|
71
|
+
directory. Only controlled TCP/Unix listeners are created, and they close in
|
|
72
|
+
`finally`. No Local service, live project, host `/run` state or remote host is
|
|
73
|
+
mutated.
|
|
74
|
+
|
|
75
|
+
The prepared probe checks confined writes, outside-write refusal, `.fungi` and
|
|
76
|
+
Git config/hooks protection, a real allowed Git add/commit, private `/run` and
|
|
77
|
+
external XDG runtime directory, absent session locators, and refusal to reach
|
|
78
|
+
the controlled host TCP/Unix listeners. Namespace denial must fail the proof,
|
|
79
|
+
not trigger bare execution or a skipped success.
|
|
80
|
+
|
|
81
|
+
This is a **direct backend proof fixture**, not foreground/background lifecycle
|
|
82
|
+
or Files acceptance. Linked-worktree Git protection, immovable Git directories,
|
|
83
|
+
shell/direct command owners, process-group cleanup, hidden-run detachment,
|
|
84
|
+
installed-package resolution and all affected gates still require qualification.
|
|
85
|
+
The argv/digest unit tests do not establish any of these kernel properties. Even
|
|
86
|
+
a passing backend probe alone does not authorize changing readiness.
|
|
87
|
+
|
|
88
|
+
## Exact remaining gap
|
|
89
|
+
|
|
90
|
+
Source identity/acquisition is resolved. Native compilation/linking on the
|
|
91
|
+
selected release floor, binary digest production, kernel enforcement and
|
|
92
|
+
packaging/consumer proofs are not. The next external permission needed is the
|
|
93
|
+
explicit native-build and Linux-fixture proof grant; there is no request here
|
|
94
|
+
for host root packages, privilege, kernel changes, publication or deployment. If
|
|
95
|
+
unprivileged namespaces or the maintained builder are unavailable, retain the
|
|
96
|
+
exact failure and leave Safe refused rather than mutating the host.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath, URL } from "node:url";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import { parseArgs } from "node:util";
|
|
7
|
+
import { bwrapPin, seccompPin } from "./pin.mjs";
|
|
8
|
+
|
|
9
|
+
const { values } = parseArgs({
|
|
10
|
+
options: {
|
|
11
|
+
target: { type: "string", default: `${process.platform}-${process.arch}` },
|
|
12
|
+
out: { type: "string" },
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
if (values.out === undefined)
|
|
16
|
+
throw new Error(
|
|
17
|
+
"Usage: fungi-bwrap-build --out <dir> [--target linux-x64|linux-arm64]",
|
|
18
|
+
);
|
|
19
|
+
if (values.target !== "linux-x64" && values.target !== "linux-arm64")
|
|
20
|
+
throw new Error(`Unsupported bubblewrap target: ${values.target}`);
|
|
21
|
+
const source = fileURLToPath(new URL("./", import.meta.url));
|
|
22
|
+
// Like the retained patch builder: BuildKit owns the build/export lifetime.
|
|
23
|
+
// No host package installation, persistent container, verification cache or
|
|
24
|
+
// implicit build is introduced into Local's command path.
|
|
25
|
+
const result = spawnSync(
|
|
26
|
+
"docker",
|
|
27
|
+
[
|
|
28
|
+
"build",
|
|
29
|
+
"--platform=linux/amd64",
|
|
30
|
+
"--file",
|
|
31
|
+
resolve(source, "Dockerfile"),
|
|
32
|
+
"--build-arg",
|
|
33
|
+
`TARGET=${values.target}`,
|
|
34
|
+
"--build-arg",
|
|
35
|
+
`SOURCE_URL=${bwrapPin.sourceUrl}`,
|
|
36
|
+
"--build-arg",
|
|
37
|
+
`SOURCE_SHA256=${bwrapPin.sourceSha256}`,
|
|
38
|
+
"--build-arg",
|
|
39
|
+
`SECCOMP_SOURCE_SHA256=${seccompPin.sourceSha256}`,
|
|
40
|
+
"--build-arg",
|
|
41
|
+
`SECCOMP_LICENSE_SHA256=${seccompPin.licenseSha256}`,
|
|
42
|
+
"--output",
|
|
43
|
+
`type=local,dest=${resolve(values.out)}`,
|
|
44
|
+
source,
|
|
45
|
+
],
|
|
46
|
+
{ stdio: "inherit" },
|
|
47
|
+
);
|
|
48
|
+
if (result.error) throw result.error;
|
|
49
|
+
if (result.status !== 0)
|
|
50
|
+
throw new Error(
|
|
51
|
+
`bubblewrap build failed (${result.signal ?? result.status})`,
|
|
52
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[binaries]
|
|
2
|
+
c = 'aarch64-linux-gnu-gcc'
|
|
3
|
+
ar = 'aarch64-linux-gnu-ar'
|
|
4
|
+
strip = 'aarch64-linux-gnu-strip'
|
|
5
|
+
pkg-config = 'pkg-config'
|
|
6
|
+
|
|
7
|
+
[properties]
|
|
8
|
+
pkg_config_libdir = ['/usr/lib/aarch64-linux-gnu/pkgconfig', '/usr/share/pkgconfig']
|
|
9
|
+
|
|
10
|
+
[host_machine]
|
|
11
|
+
system = 'linux'
|
|
12
|
+
cpu_family = 'aarch64'
|
|
13
|
+
cpu = 'armv8'
|
|
14
|
+
endian = 'little'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Upstream release asset, not GitHub's separately generated source archive. */
|
|
2
|
+
export const bwrapPin = Object.freeze({
|
|
3
|
+
version: "0.13.1",
|
|
4
|
+
tag: "v0.13.1",
|
|
5
|
+
commit: "362936aea0d5c6e70f7af75d2d44b5a914cb4ba2",
|
|
6
|
+
sourceUrl:
|
|
7
|
+
"https://github.com/containers/bubblewrap/releases/download/v0.13.1/bubblewrap-0.13.1.tar.xz",
|
|
8
|
+
sourceSha256:
|
|
9
|
+
"0e85c8702248b8dd64144f594147553650cdd0e4c951690345faace79c217c4d",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/** Unmodified maintained libseccomp generator; never locally assembled BPF. */
|
|
13
|
+
export const seccompPin = Object.freeze({
|
|
14
|
+
repository: "https://github.com/anthropic-experimental/sandbox-runtime",
|
|
15
|
+
revision: "38d1aee29c72035f1dba1337ac89b03a2f655d26",
|
|
16
|
+
source: "vendor/seccomp-src/seccomp-unix-block.c",
|
|
17
|
+
sourceSha256:
|
|
18
|
+
"9dcde4aedc076fb44efc5cc8d843c7ba898f2a056b71931812d55ef99f1ed6b1",
|
|
19
|
+
licenseSha256:
|
|
20
|
+
"1210bc93eb85dd786c33192d5bcb7153a93922fa99fbc1512af6a7199cb41080",
|
|
21
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { copyFile, cp, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { execFileSync } from "node:child_process";
|
|
6
|
+
import { bwrapPin, seccompPin } from "./pin.mjs";
|
|
7
|
+
|
|
8
|
+
const [platform, output, upstream] = process.argv.slice(2);
|
|
9
|
+
if (!platform || !output || !upstream)
|
|
10
|
+
throw new Error("record.mjs requires platform, output and verified source");
|
|
11
|
+
const sha256 = createHash("sha256")
|
|
12
|
+
.update(await readFile(resolve(output, "fungi-bwrap")))
|
|
13
|
+
.digest("hex");
|
|
14
|
+
await writeFile(resolve(output, "fungi-bwrap.sha256"), `${sha256}\n`);
|
|
15
|
+
const seccompSha256 = createHash("sha256")
|
|
16
|
+
.update(await readFile(resolve(output, "fungi-seccomp.bpf")))
|
|
17
|
+
.digest("hex");
|
|
18
|
+
await writeFile(
|
|
19
|
+
resolve(output, "fungi-seccomp.bpf.sha256"),
|
|
20
|
+
`${seccompSha256}\n`,
|
|
21
|
+
);
|
|
22
|
+
await copyFile(
|
|
23
|
+
"/source/vendor/LICENSE.sandbox-runtime",
|
|
24
|
+
resolve(output, "LICENSE.sandbox-runtime"),
|
|
25
|
+
);
|
|
26
|
+
await copyFile(
|
|
27
|
+
resolve(upstream, "COPYING"),
|
|
28
|
+
resolve(output, "LICENSE.bubblewrap"),
|
|
29
|
+
);
|
|
30
|
+
const capLicense = "/usr/share/doc/libcap2/copyright";
|
|
31
|
+
const capVersion = execFileSync(
|
|
32
|
+
"dpkg-query",
|
|
33
|
+
[
|
|
34
|
+
"--show",
|
|
35
|
+
"--showformat=${Version}",
|
|
36
|
+
platform === "linux-arm64" ? "libcap-dev:arm64" : "libcap-dev:amd64",
|
|
37
|
+
],
|
|
38
|
+
{ encoding: "utf8" },
|
|
39
|
+
).trim();
|
|
40
|
+
await copyFile(capLicense, resolve(output, "LICENSE.libcap"));
|
|
41
|
+
await copyFile("/source.tar.xz", resolve(output, "SOURCE.bubblewrap.tar.xz"));
|
|
42
|
+
await cp("/source", resolve(output, "bwrap-build-source"), { recursive: true });
|
|
43
|
+
await writeFile(
|
|
44
|
+
resolve(output, "bwrap-build.json"),
|
|
45
|
+
JSON.stringify(
|
|
46
|
+
{
|
|
47
|
+
platform,
|
|
48
|
+
upstream: bwrapPin,
|
|
49
|
+
sha256,
|
|
50
|
+
seccomp: { generator: seccompPin, sha256: seccompSha256 },
|
|
51
|
+
packages: [
|
|
52
|
+
{
|
|
53
|
+
name: "sandbox-runtime-seccomp-generator",
|
|
54
|
+
version: seccompPin.revision,
|
|
55
|
+
texts: [
|
|
56
|
+
await readFile("/source/vendor/LICENSE.sandbox-runtime", "utf8"),
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "bubblewrap",
|
|
61
|
+
version: bwrapPin.version,
|
|
62
|
+
texts: [await readFile(resolve(upstream, "COPYING"), "utf8")],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "libcap",
|
|
66
|
+
version: capVersion,
|
|
67
|
+
texts: [await readFile(capLicense, "utf8")],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
null,
|
|
72
|
+
2,
|
|
73
|
+
) + "\n",
|
|
74
|
+
);
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Anthropic
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Seccomp generator
|
|
2
|
+
|
|
3
|
+
`seccomp-unix-block.c` is an **unmodified** copy of
|
|
4
|
+
`anthropic-experimental/sandbox-runtime` at
|
|
5
|
+
`38d1aee29c72035f1dba1337ac89b03a2f655d26`,
|
|
6
|
+
`vendor/seccomp-src/seccomp-unix-block.c`. Its Apache-2.0 licence is adjacent.
|
|
7
|
+
`../pin.mjs` records both source and licence digests; the native build checks
|
|
8
|
+
them before compiling.
|
|
9
|
+
|
|
10
|
+
We invoke the maintained generator's `unix` rule set, not its optional
|
|
11
|
+
`namespaces` rule set. libseccomp compiles the filter for the selected x86-64 or
|
|
12
|
+
AArch64 architecture. It denies `socket(AF_UNIX, …)` and `socket(AF_VSOCK, …)`
|
|
13
|
+
with `EPERM`, comparing the domain's low 32 bits, and denies all three
|
|
14
|
+
`io_uring` syscalls. `socketpair` remains allowed. Non-native ABIs are rejected
|
|
15
|
+
by libseccomp's architecture guard. No Botanical code constructs BPF.
|
|
16
|
+
|
|
17
|
+
The generated filter is passed to bubblewrap's ordinary `--seccomp` interface.
|
|
18
|
+
It is data, not a separately shipped executable or a host-installed dependency.
|
|
19
|
+
|
|
20
|
+
This filter does **not** make v1 a security boundary against hostile programs.
|
|
21
|
+
An allowed Unix datagram `socketpair` endpoint can still `sendto` a visible host
|
|
22
|
+
pathname socket. CTO decision `3fd830860044` retains that known limitation and
|
|
23
|
+
withdraws both the datagram-pair denial and a filesystem-allowlist rebuild.
|