@landstrip/landstrip 0.15.0 → 0.15.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.
Files changed (2) hide show
  1. package/README.md +84 -72
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -110,61 +110,71 @@ capabilities; without it the container denies all network access.
110
110
  ## Error Output
111
111
 
112
112
  Failures reported by `landstrip` are printed as JSON objects on standard
113
- error, one object per line. Each object is tagged by the trap kind, with the
114
- kind name as the single top-level key.
113
+ error, one object per line. Each object is a flat record with a fixed `kind`
114
+ discriminant and a stable `code`, so consumers can route on `kind` for the
115
+ coarse grouping and on `code` for the specific case.
115
116
 
116
117
  ```json
117
- {"Internal":{"file":"policy.json","source":"expected value at line 1 column 1"}}
118
+ {"kind":"internal","code":"INTERNAL_ERROR","detail":{"file":"policy.json","source":"expected value at line 1 column 1"}}
118
119
  ```
119
120
 
120
121
  ```json
121
- {"Launch":["cargo","No such file or directory"]}
122
+ {"kind":"launch","code":"LAUNCH_FAILED","program":"cargo","message":"No such file or directory"}
122
123
  ```
123
124
 
124
125
  The trap kinds are:
125
126
 
126
- - `Filesystem`: a filesystem access denial object. The stable `code` is
127
+ - `filesystem`: a filesystem access denial. The stable `code` is
127
128
  `FS_READ_DENIED` or `FS_WRITE_DENIED`; `operation` is `read` or `write`;
128
129
  `path` is the resolved path; `requested_path` is the original path supplied by
129
130
  the tool when available; `syscall`, `errno`, `flags`, `reason`,
130
131
  `suggested_grant`, and `process` provide machine-readable routing context.
131
- - `Network`: a denied TCP connect or bind object. The stable `code` is
132
- `NET_CONNECT_DENIED`, `NET_BIND_DENIED`, or `NET_DENIED`; `operation` is
133
- `connect` or `bind`; `target` is `address:port`; `syscall`, `errno`, and
134
- `process` provide routing context.
135
- - `Launch`: the tool could not be started, as `[program, message]`.
136
- - `Usage`: a command-line usage error, as a message string. Usage errors exit
137
- with status 2.
138
- - `Internal`: any other policy, platform, or system error, as an object of
139
- diagnostic key/value pairs (for example `source`, `file`, or platform API
140
- details).
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
+ - `usage`: a command-line usage error. The stable `code` is `USAGE_ERROR`;
139
+ `message` is the error text. Usage errors exit with status 2.
140
+ - `internal`: any other policy, platform, or system error. The stable `code` is
141
+ `INTERNAL_ERROR`; `detail` is an object of diagnostic key/value pairs (for
142
+ example `source`, `file`, or platform API details).
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:
147
+
148
+ - `allow_miss`: the path matched no allow root and was denied by default.
149
+ - `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.
141
152
 
142
153
  Example of a filesystem denial:
143
154
 
144
155
  ```json
145
156
  {
146
- "Filesystem": {
147
- "code": "FS_WRITE_DENIED",
148
- "operation": "write",
149
- "path": "/repo/out",
150
- "requested_path": "out",
151
- "syscall": "openat",
152
- "errno": "EACCES",
153
- "flags": [
154
- "O_WRONLY",
155
- "O_CREAT",
156
- "O_TRUNC"
157
- ],
158
- "reason": "not_in_allow_write",
159
- "suggested_grant": {
160
- "allowWrite": "/repo/out"
161
- },
162
- "mechanism": "seccomp",
163
- "process": {
164
- "pid": 1234,
165
- "exe": "/usr/bin/sh",
166
- "cwd": "/repo"
167
- }
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"
168
178
  }
169
179
  }
170
180
  ```
@@ -189,49 +199,51 @@ emitted with the same object shapes as standard error:
189
199
 
190
200
  ```json
191
201
  {
192
- "Filesystem": {
193
- "code": "FS_WRITE_DENIED",
194
- "operation": "write",
195
- "path": "/repo/out",
196
- "requested_path": "out",
197
- "syscall": "openat",
198
- "errno": "EACCES",
199
- "flags": [
200
- "O_WRONLY",
201
- "O_CREAT",
202
- "O_TRUNC"
203
- ],
204
- "reason": "not_in_allow_write",
205
- "suggested_grant": {
206
- "allowWrite": "/repo/out"
207
- },
208
- "mechanism": "seccomp",
209
- "process": {
210
- "pid": 1234,
211
- "exe": "/usr/bin/sh",
212
- "cwd": "/repo"
213
- }
202
+ "kind": "filesystem",
203
+ "code": "FS_WRITE_DENIED",
204
+ "operation": "write",
205
+ "path": "/repo/out",
206
+ "requested_path": "out",
207
+ "syscall": "openat",
208
+ "errno": "EACCES",
209
+ "flags": [
210
+ "O_WRONLY",
211
+ "O_CREAT",
212
+ "O_TRUNC"
213
+ ],
214
+ "reason": "allow_miss",
215
+ "suggested_grant": {
216
+ "allowWrite": "/repo/out"
217
+ },
218
+ "mechanism": "seccomp",
219
+ "process": {
220
+ "pid": 1234,
221
+ "exe": "/usr/bin/sh",
222
+ "cwd": "/repo"
214
223
  }
215
224
  }
216
225
  {
217
- "Network": {
218
- "code": "NET_CONNECT_DENIED",
219
- "operation": "connect",
220
- "target": "127.0.0.1:9999",
221
- "syscall": "connect",
222
- "errno": "EACCES",
223
- "mechanism": "seccomp",
224
- "process": {
225
- "pid": 1234,
226
- "exe": "/usr/bin/nc",
227
- "cwd": "/repo"
228
- }
226
+ "kind": "network",
227
+ "code": "NET_CONNECT_DENIED",
228
+ "operation": "connect",
229
+ "target": "127.0.0.1:9999",
230
+ "syscall": "connect",
231
+ "errno": "EACCES",
232
+ "mechanism": "seccomp",
233
+ "process": {
234
+ "pid": 1234,
235
+ "exe": "/usr/bin/nc",
236
+ "cwd": "/repo"
229
237
  }
230
238
  }
231
239
  ```
232
240
 
233
241
  The `mechanism` field records the kernel enforcement layer that detected the
234
- denial (e.g. `seccomp` or `landlock`).
242
+ denial. Per-denial `Filesystem` and `Network` traps are always `seccomp`,
243
+ because the user-notification broker is the only layer with a per-denial
244
+ callback; Landlock enforces in-kernel without one. The `landlock` value
245
+ appears only as a `mechanism` detail in an `Internal` trap when Landlock
246
+ ruleset setup fails.
235
247
 
236
248
  This stream is separate from the sandboxed tool's output. If the option is
237
249
  omitted, landstrip is quiet unless it has to report a policy, launch, or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@landstrip/landstrip",
3
- "version": "0.15.0",
3
+ "version": "0.15.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.15.0",
28
- "@landstrip/landstrip-darwin-x64": "0.15.0",
29
- "@landstrip/landstrip-linux-x64": "0.15.0",
30
- "@landstrip/landstrip-win32-x64": "0.15.0"
27
+ "@landstrip/landstrip-darwin-arm64": "0.15.1",
28
+ "@landstrip/landstrip-darwin-x64": "0.15.1",
29
+ "@landstrip/landstrip-linux-x64": "0.15.1",
30
+ "@landstrip/landstrip-win32-x64": "0.15.1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"