@landstrip/landstrip 0.18.38 → 0.20.11

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 CHANGED
@@ -1,66 +1,21 @@
1
- # landstrip
1
+ # @landstrip/landstrip
2
2
 
3
- `landstrip` runs commands in an OS-level sandbox using Landlock on Linux,
4
- Seatbelt on macOS, and AppContainer or restricted users on Windows.
5
-
6
- ## Install
3
+ The Landstrip command-line executable for Linux, macOS, and Windows on x64/arm64.
4
+ Requires Node.js ≥18. Installs the matching native platform package automatically.
7
5
 
8
6
  ```sh
9
7
  npm install --save-dev @landstrip/landstrip
10
8
  npx landstrip run -p policy.json -- cargo test
9
+ npx landstrip doctor
11
10
  ```
12
11
 
13
- The npm package installs a Node.js wrapper and a native binary for the current
14
- platform.
15
-
16
- ## Usage
17
-
18
- ```sh
19
- landstrip run -p policy.json -- cargo test
20
- landstrip policy validate -p policy.json
21
- landstrip policy resolve -p policy.json
22
- landstrip doctor
23
- ```
24
-
25
- Run `landstrip --help` or see [landstrip(1)](man/man1/landstrip.1) for the full
26
- command reference.
27
-
28
- ## Agent extensions
29
-
30
- | Integration | Package | Documentation |
31
- | ----------- | ---------------------- | -------------------------------------------------------------------- |
32
- | OpenCode | `opencode-landstrip` | [OpenCode](packages/opencode-landstrip/README.md) |
33
- | Pi | `pi-landstrip` | [Pi](packages/pi-landstrip/README.md) |
12
+ See the [quick start](../../README.md#quick-start) for a policy example and
13
+ [landstrip(1)](../landstrip/man/man1/landstrip.1) for CLI options and platform limits.
34
14
 
35
- ## Policy
36
-
37
- ```json
38
- {
39
- "filesystem": {
40
- "allowWrite": ["."],
41
- "denyWrite": ["**/.env", "**/*.pem"],
42
- "denyRead": ["~/.ssh"],
43
- "allowRead": ["~/.ssh/config"]
44
- },
45
- "network": {
46
- "allowNetwork": false,
47
- "allowLocalBinding": false
48
- }
49
- }
50
- ```
51
-
52
- Pass policies with `-p, --policy <FILE>`. Later policies merge over earlier
53
- ones. Platform behavior and limits are documented in the manual.
54
-
55
- ## Development
56
-
57
- ```sh
58
- make ci
59
- ```
15
+ For TypeScript APIs, use [`@landstrip/landstrip-api`](../landstrip-api/README.md),
16
+ which depends on this package. This CLI package does not depend on the API package.
60
17
 
61
- ## Licensing
18
+ ## License
62
19
 
63
- `@landstrip/landstrip` is licensed under the Apache 2.0 license and the GNU
64
- Lesser General Public License version 2.1 or later. See
65
- [LICENSE-APACHE-2.0](LICENSE-APACHE-2.0) and [LICENSE-LGPL-2.1](LICENSE-LGPL-2.1)
66
- for more information.
20
+ [Apache-2.0](LICENSE); native binaries are
21
+ [LGPL-2.1-or-later](../landstrip/LICENSE).
package/bin/landstrip.js CHANGED
@@ -8,7 +8,11 @@ const { binaryPath } = require('../lib');
8
8
  let child;
9
9
 
10
10
  try {
11
- child = spawn(binaryPath(), process.argv.slice(2), { stdio: 'inherit' });
11
+ const options = { stdio: 'inherit' };
12
+ if (process.platform === 'linux') {
13
+ options.env = { ...process.env, APPIMAGE_EXTRACT_AND_RUN: '1' };
14
+ }
15
+ child = spawn(binaryPath(), process.argv.slice(2), options);
12
16
  } catch (error) {
13
17
  console.error(error.message);
14
18
  process.exit(1);
package/lib/index.js CHANGED
@@ -31,6 +31,11 @@ const packages = {
31
31
  },
32
32
  };
33
33
 
34
+ const officialPackageNames = new Set([
35
+ '@landstrip/landstrip',
36
+ ...Object.values(packages).map((value) => value.packageName),
37
+ ]);
38
+
34
39
  function target(platform = process.platform, arch = process.arch) {
35
40
  const key = `${platform}-${arch}`;
36
41
  const value = packages[key];
@@ -65,7 +70,30 @@ function binaryPath(platform = process.platform, arch = process.arch) {
65
70
  throw new Error(`landstrip binary not found at ${resolved}`);
66
71
  }
67
72
 
68
- return resolved;
73
+ const filePath = fs.realpathSync.native(resolved);
74
+ let probe = path.dirname(filePath);
75
+ while (true) {
76
+ let owner;
77
+ try {
78
+ owner = JSON.parse(fs.readFileSync(path.join(probe, 'package.json'), 'utf8'));
79
+ } catch (error) {
80
+ if (error.code !== 'ENOENT' && !(error instanceof SyntaxError)) throw error;
81
+ }
82
+ if (
83
+ owner !== null &&
84
+ typeof owner === 'object' &&
85
+ !Array.isArray(owner) &&
86
+ officialPackageNames.has(owner.name)
87
+ ) {
88
+ return filePath;
89
+ }
90
+ const parent = path.dirname(probe);
91
+ if (parent === probe) break;
92
+ probe = parent;
93
+ }
94
+ throw new Error(
95
+ `Refusing to use landstrip binary outside official @landstrip/landstrip packages: ${filePath}`,
96
+ );
69
97
  }
70
98
 
71
99
  exports.binaryPath = binaryPath;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@landstrip/landstrip",
3
- "version": "0.18.38",
4
- "description": "Sandbox runner using Landlock, Seatbelt, and AppContainer",
5
- "license": "Apache-2.0 AND LGPL-2.1-or-later",
3
+ "version": "0.20.11",
4
+ "description": "Landstrip sandbox command-line executable",
5
+ "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/landstrip/landstrip#readme",
7
7
  "repository": {
8
8
  "type": "git",
@@ -12,21 +12,6 @@
12
12
  "url": "https://github.com/landstrip/landstrip/issues"
13
13
  },
14
14
  "main": "lib/index.js",
15
- "types": "lib/index.d.ts",
16
- "exports": {
17
- ".": {
18
- "types": "./lib/index.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "./shared": {
22
- "types": "./lib/shared.d.ts",
23
- "default": "./lib/shared.js"
24
- },
25
- "./proxy": {
26
- "types": "./lib/proxy.d.ts",
27
- "default": "./lib/proxy.js"
28
- }
29
- },
30
15
  "bin": {
31
16
  "landstrip": "bin/landstrip.js"
32
17
  },
@@ -34,16 +19,15 @@
34
19
  "bin",
35
20
  "lib",
36
21
  "README.md",
37
- "LICENSE-APACHE-2.0",
38
- "LICENSE-LGPL-2.1"
22
+ "LICENSE"
39
23
  ],
40
24
  "optionalDependencies": {
41
- "@landstrip/landstrip-darwin-arm64": "0.18.38",
42
- "@landstrip/landstrip-darwin-x64": "0.18.38",
43
- "@landstrip/landstrip-linux-x64": "0.18.38",
44
- "@landstrip/landstrip-linux-arm64": "0.18.38",
45
- "@landstrip/landstrip-win32-x64": "0.18.38",
46
- "@landstrip/landstrip-win32-arm64": "0.18.38"
25
+ "@landstrip/landstrip-darwin-arm64": "0.20.11",
26
+ "@landstrip/landstrip-darwin-x64": "0.20.11",
27
+ "@landstrip/landstrip-linux-x64": "0.20.11",
28
+ "@landstrip/landstrip-linux-arm64": "0.20.11",
29
+ "@landstrip/landstrip-win32-x64": "0.20.11",
30
+ "@landstrip/landstrip-win32-arm64": "0.20.11"
47
31
  },
48
32
  "publishConfig": {
49
33
  "access": "public"