@landstrip/landstrip-api 0.19.13 → 0.19.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -40
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,60 +1,43 @@
|
|
|
1
1
|
# @landstrip/landstrip-api
|
|
2
2
|
|
|
3
|
-
Node.js wrapper
|
|
4
|
-
|
|
5
|
-
on x64 and arm64.
|
|
3
|
+
Node.js wrapper and types for Landstrip. Requires Node.js ≥18; native binaries
|
|
4
|
+
support Linux, macOS, and Windows on x64/arm64.
|
|
6
5
|
|
|
7
|
-
## Install
|
|
6
|
+
## Install
|
|
8
7
|
|
|
9
8
|
```sh
|
|
10
9
|
npm install --save-dev @landstrip/landstrip-api
|
|
11
|
-
npx landstrip run -p policy.json -- cargo test
|
|
12
10
|
```
|
|
13
11
|
|
|
14
|
-
See the [quick start](../../README.md#quick-start) for
|
|
15
|
-
[landstrip(1)](../landstrip/man/man1/landstrip.1)
|
|
16
|
-
and platform limits.
|
|
12
|
+
See the [quick start](../../README.md#quick-start) for a policy and CLI example;
|
|
13
|
+
[landstrip(1)](../landstrip/man/man1/landstrip.1) covers policy and platform limits.
|
|
17
14
|
|
|
18
15
|
## Node.js API
|
|
19
16
|
|
|
20
17
|
```js
|
|
21
|
-
const { execFileSync } = require(
|
|
22
|
-
const { binaryPath } = require(
|
|
18
|
+
const { execFileSync } = require("node:child_process");
|
|
19
|
+
const { binaryPath } = require("@landstrip/landstrip-api");
|
|
23
20
|
|
|
24
|
-
execFileSync(binaryPath(), [
|
|
25
|
-
stdio:
|
|
21
|
+
execFileSync(binaryPath(), ["run", "-p", "policy.json", "--", "cargo", "test"], {
|
|
22
|
+
stdio: "inherit",
|
|
26
23
|
});
|
|
27
24
|
```
|
|
28
25
|
|
|
29
|
-
`binaryPath()`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`packageName()` returns the platform's binary package name. Both accept optional
|
|
33
|
-
`platform` and `arch` arguments, defaulting to the current process.
|
|
26
|
+
`binaryPath()` resolves an official installed binary or throws; `packageName()`
|
|
27
|
+
returns its package name. Both accept `platform` and `arch`, defaulting to the
|
|
28
|
+
current process.
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
queries are Linux-only; macOS's `--trap` reports setup and launch failures.
|
|
38
|
-
Descriptor lifetimes and the reply protocol are covered in the manual.
|
|
30
|
+
Types: [`LandstripTrap`, `LandstripControlResponse`](lib/index.d.ts).
|
|
31
|
+
Proxy helpers: [`/proxy`](lib/proxy.d.ts). [`/shared`](lib/shared.d.ts) provides:
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`state: 'query'`. The declarations include all five native mechanisms and the
|
|
49
|
-
current Windows error codes; the previously declared `POLICY_TCP_BIND_UNSUPPORTED`
|
|
50
|
-
code remains accepted alongside `POLICY_LOCAL_BINDING_UNSUPPORTED`.
|
|
51
|
-
|
|
52
|
-
`writeLandstripPolicyFile(policy, prefix = 'landstrip-')` from `/shared` writes
|
|
53
|
-
`policy.json` and returns `{ dir, path }`. The caller owns `dir` and must remove it
|
|
54
|
-
with `rmSync(dir, { recursive: true, force: true })` after use. Serialization
|
|
55
|
-
happens before directory creation; failed writes remove partial files and their
|
|
56
|
-
directory. If cleanup also fails, an `AggregateError` reports both errors and the
|
|
57
|
-
directory path.
|
|
33
|
+
- `decodeLandstripTrap(value)` / `parseTrapLine(line)`: validated trap or `null`.
|
|
34
|
+
Extra fields survive; missing/unknown denial states become `info`, never queries.
|
|
35
|
+
- `isQueryTrap(trap)`: narrows validated events to `LandstripQueryTrap`.
|
|
36
|
+
Query IDs are decimal `u64` strings, nonzero for queries.
|
|
37
|
+
- `writeLandstripPolicyFile(policy, prefix = 'landstrip-')`: returns `{ dir, path }`.
|
|
38
|
+
Remove `dir` with `rmSync(dir, { recursive: true, force: true })` after use.
|
|
39
|
+
Failed writes clean up; failed cleanup reports both errors and the directory
|
|
40
|
+
path in an `AggregateError`.
|
|
58
41
|
|
|
59
42
|
## Development
|
|
60
43
|
|
|
@@ -62,5 +45,5 @@ Run `make ci` from the repository root.
|
|
|
62
45
|
|
|
63
46
|
## License
|
|
64
47
|
|
|
65
|
-
[Apache-2.0](LICENSE)
|
|
48
|
+
[Apache-2.0](LICENSE); bundled native binaries are
|
|
66
49
|
[LGPL-3.0-or-later](../landstrip/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@landstrip/landstrip-api",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.14",
|
|
4
4
|
"description": "Sandbox runner using Landlock, Seatbelt, and AppContainer",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/landstrip/landstrip#readme",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"ipaddr.js": "^2.5.0"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@landstrip/landstrip-darwin-arm64": "0.19.
|
|
44
|
-
"@landstrip/landstrip-darwin-x64": "0.19.
|
|
45
|
-
"@landstrip/landstrip-linux-x64": "0.19.
|
|
46
|
-
"@landstrip/landstrip-linux-arm64": "0.19.
|
|
47
|
-
"@landstrip/landstrip-win32-x64": "0.19.
|
|
48
|
-
"@landstrip/landstrip-win32-arm64": "0.19.
|
|
43
|
+
"@landstrip/landstrip-darwin-arm64": "0.19.14",
|
|
44
|
+
"@landstrip/landstrip-darwin-x64": "0.19.14",
|
|
45
|
+
"@landstrip/landstrip-linux-x64": "0.19.14",
|
|
46
|
+
"@landstrip/landstrip-linux-arm64": "0.19.14",
|
|
47
|
+
"@landstrip/landstrip-win32-x64": "0.19.14",
|
|
48
|
+
"@landstrip/landstrip-win32-arm64": "0.19.14"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|