@landstrip/landstrip 0.15.17 → 0.16.1
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 +33 -121
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -107,158 +107,70 @@ For a filesystem-only sandbox with unrestricted direct network access, set:
|
|
|
107
107
|
policy enforcement in place. On Windows this grants the AppContainer its network
|
|
108
108
|
capabilities; without it the container denies all network access.
|
|
109
109
|
|
|
110
|
-
##
|
|
110
|
+
## Denial Traps
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
Sandbox denials are reported as JSON objects, one per line, each with a fixed
|
|
113
|
+
`kind` discriminant and a stable `code`. Consumers route on `kind` for coarse
|
|
114
|
+
grouping and on `code` for the policy denial class. Traps go to standard error
|
|
115
|
+
by default; `--trap-fd FD` writes them to an already-open descriptor instead.
|
|
116
116
|
|
|
117
|
-
```
|
|
118
|
-
|
|
117
|
+
```sh
|
|
118
|
+
landstrip --trap-fd 3 -p policy.json cargo test 3>landstrip-traps.txt
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
The two trap kinds are:
|
|
122
|
+
|
|
123
|
+
- `filesystem` (`code` `FILESYSTEM_DENIED`): `operation` is `read` or `write`,
|
|
124
|
+
`path` is the resolved path, `requested_path` is the tool's original path when
|
|
125
|
+
available, and `syscall`, `errno`, `flags`, `reason`, `suggested_grant`, and
|
|
126
|
+
`process` carry routing context.
|
|
127
|
+
- `network` (`code` `NETWORK_DENIED`): `operation` is `connect` or `bind` and
|
|
128
|
+
`target` is `address:port`, with `syscall`, `errno`, and `process` context.
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
- `filesystem`: a filesystem access denial. The stable `code` is
|
|
128
|
-
`FS_READ_DENIED` or `FS_WRITE_DENIED`; `operation` is `read` or `write`;
|
|
129
|
-
`path` is the resolved path; `requested_path` is the original path supplied by
|
|
130
|
-
the tool when available; `syscall`, `errno`, `flags`, `reason`,
|
|
131
|
-
`suggested_grant`, and `process` provide machine-readable routing context.
|
|
132
|
-
- `network`: a denied TCP connect or bind. The stable `code` is
|
|
133
|
-
`NET_CONNECT_DENIED` or `NET_BIND_DENIED`; `operation` is `connect` or `bind`;
|
|
134
|
-
`target` is `address:port`; `syscall`, `errno`, and `process` provide routing
|
|
135
|
-
context.
|
|
136
|
-
- `launch`: the tool could not be started. The stable `code` is `LAUNCH_FAILED`;
|
|
137
|
-
`program` and `message` give the program and the failure detail.
|
|
138
|
-
- `internal`: any other policy, platform, or system error. The stable `code` is
|
|
139
|
-
`INTERNAL_ERROR`; `detail` is an object of diagnostic key/value pairs (for
|
|
140
|
-
example `source`, `file`, or platform API details).
|
|
141
|
-
|
|
142
|
-
Usage errors are printed as plain text and exit with status 2.
|
|
143
|
-
|
|
144
|
-
The `reason` field is a platform-independent classification of the policy
|
|
145
|
-
decision, derived from the policy and the requested path rather than from the
|
|
146
|
-
enforcement mechanism. Its stable values are:
|
|
130
|
+
`reason` is a platform-independent classification of the decision, derived from
|
|
131
|
+
the policy and the requested path:
|
|
147
132
|
|
|
148
133
|
- `allow_miss`: the path matched no allow root and was denied by default.
|
|
149
134
|
- `deny_match`: the path matched an explicit deny root that overrides an allow.
|
|
150
|
-
- `unclassified`: a denial occurred but landstrip could not attribute it to a
|
|
151
|
-
specific rule.
|
|
152
|
-
|
|
153
|
-
Example of a filesystem denial:
|
|
154
|
-
|
|
155
|
-
```json
|
|
156
|
-
{
|
|
157
|
-
"kind": "filesystem",
|
|
158
|
-
"code": "FS_WRITE_DENIED",
|
|
159
|
-
"operation": "write",
|
|
160
|
-
"path": "/repo/out",
|
|
161
|
-
"requested_path": "out",
|
|
162
|
-
"syscall": "openat",
|
|
163
|
-
"errno": "EACCES",
|
|
164
|
-
"flags": [
|
|
165
|
-
"O_WRONLY",
|
|
166
|
-
"O_CREAT",
|
|
167
|
-
"O_TRUNC"
|
|
168
|
-
],
|
|
169
|
-
"reason": "allow_miss",
|
|
170
|
-
"suggested_grant": {
|
|
171
|
-
"allowWrite": "/repo/out"
|
|
172
|
-
},
|
|
173
|
-
"mechanism": "seccomp",
|
|
174
|
-
"process": {
|
|
175
|
-
"pid": 1234,
|
|
176
|
-
"exe": "/usr/bin/sh",
|
|
177
|
-
"cwd": "/repo"
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Logs and sandboxed tool output are not part of the response. Normal successful
|
|
183
|
-
tool execution does not print a landstrip response unless a write denial was
|
|
184
|
-
observed, because standard error belongs to landstrip; standard output belongs
|
|
185
|
-
to the sandboxed tool.
|
|
186
|
-
|
|
187
|
-
## Trap FD
|
|
188
135
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
```sh
|
|
194
|
-
landstrip --trap-fd 3 -p policy.json cargo test 3>landstrip-traps.txt
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Linux filesystem and network denials observed by the seccomp broker are
|
|
198
|
-
emitted with the same object shapes as standard error:
|
|
136
|
+
`mechanism` records the kernel layer that detected the denial. Per-denial traps
|
|
137
|
+
are always `seccomp`, the only layer with a per-denial callback; Landlock
|
|
138
|
+
enforces in-kernel without one.
|
|
199
139
|
|
|
200
140
|
```json
|
|
201
141
|
{
|
|
202
142
|
"kind": "filesystem",
|
|
203
|
-
"code": "
|
|
143
|
+
"code": "FILESYSTEM_DENIED",
|
|
204
144
|
"operation": "write",
|
|
205
145
|
"path": "/repo/out",
|
|
206
146
|
"requested_path": "out",
|
|
207
147
|
"syscall": "openat",
|
|
208
148
|
"errno": "EACCES",
|
|
209
|
-
"flags": [
|
|
210
|
-
"O_WRONLY",
|
|
211
|
-
"O_CREAT",
|
|
212
|
-
"O_TRUNC"
|
|
213
|
-
],
|
|
149
|
+
"flags": ["O_WRONLY", "O_CREAT", "O_TRUNC"],
|
|
214
150
|
"reason": "allow_miss",
|
|
215
|
-
"suggested_grant": {
|
|
216
|
-
"allowWrite": "/repo/out"
|
|
217
|
-
},
|
|
151
|
+
"suggested_grant": { "allowWrite": "/repo/out" },
|
|
218
152
|
"mechanism": "seccomp",
|
|
219
|
-
"process": {
|
|
220
|
-
"pid": 1234,
|
|
221
|
-
"exe": "/usr/bin/sh",
|
|
222
|
-
"cwd": "/repo"
|
|
223
|
-
}
|
|
153
|
+
"process": { "pid": 1234, "exe": "/usr/bin/sh", "cwd": "/repo" }
|
|
224
154
|
}
|
|
225
155
|
{
|
|
226
156
|
"kind": "network",
|
|
227
|
-
"code": "
|
|
157
|
+
"code": "NETWORK_DENIED",
|
|
228
158
|
"operation": "connect",
|
|
229
159
|
"target": "127.0.0.1:9999",
|
|
230
160
|
"syscall": "connect",
|
|
231
161
|
"errno": "EACCES",
|
|
232
162
|
"mechanism": "seccomp",
|
|
233
|
-
"process": {
|
|
234
|
-
"pid": 1234,
|
|
235
|
-
"exe": "/usr/bin/nc",
|
|
236
|
-
"cwd": "/repo"
|
|
237
|
-
}
|
|
163
|
+
"process": { "pid": 1234, "exe": "/usr/bin/nc", "cwd": "/repo" }
|
|
238
164
|
}
|
|
239
165
|
```
|
|
240
166
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
This stream is separate from the sandboxed tool's output. If the option is
|
|
249
|
-
omitted, landstrip is quiet unless it has to report a policy, launch, or
|
|
250
|
-
platform error. These long-lived error messages remain on standard error
|
|
251
|
-
and are not duplicated in the trap stream.
|
|
252
|
-
|
|
253
|
-
Trap responses are informational. The configured sandbox policy always
|
|
254
|
-
applies. However, writing trap responses requires an already-open file
|
|
255
|
-
descriptor and a readable file path. If the sandbox blocks writing to the
|
|
256
|
-
descriptor, or if writing fails, the denial is quietly dropped and the
|
|
257
|
-
policy remains in effect. On backends without per-denial callbacks the
|
|
258
|
-
option is best-effort.
|
|
259
|
-
|
|
260
|
-
The descriptor must be 3 or greater (standard I/O descriptors 0-2 are
|
|
261
|
-
reserved).
|
|
167
|
+
Traps are informational; the configured policy always applies. landstrip is
|
|
168
|
+
otherwise quiet on success — standard error belongs to landstrip, standard
|
|
169
|
+
output to the sandboxed tool. Usage, policy, launch, and platform errors are
|
|
170
|
+
printed as plain text; usage errors exit with status 2. Writing to `--trap-fd`
|
|
171
|
+
is best-effort: it needs an already-open descriptor (3 or greater; 0-2 are
|
|
172
|
+
reserved), and if the write fails the denial is dropped while the policy stays
|
|
173
|
+
in effect.
|
|
262
174
|
|
|
263
175
|
## Development
|
|
264
176
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@landstrip/landstrip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Sandbox runner using Landlock, Seatbelt, and AppContainer",
|
|
5
5
|
"license": "Apache-2.0 AND LGPL-2.1-or-later",
|
|
6
6
|
"homepage": "https://github.com/landstrip/landstrip#readme",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"LICENSE-LGPL-2.1"
|
|
25
25
|
],
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@landstrip/landstrip-darwin-arm64": "0.
|
|
28
|
-
"@landstrip/landstrip-darwin-x64": "0.
|
|
29
|
-
"@landstrip/landstrip-linux-x64": "0.
|
|
30
|
-
"@landstrip/landstrip-win32-x64": "0.
|
|
27
|
+
"@landstrip/landstrip-darwin-arm64": "0.16.1",
|
|
28
|
+
"@landstrip/landstrip-darwin-x64": "0.16.1",
|
|
29
|
+
"@landstrip/landstrip-linux-x64": "0.16.1",
|
|
30
|
+
"@landstrip/landstrip-win32-x64": "0.16.1"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|