@stratusagent/permissions 0.10.0 → 0.11.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/dist/index.js CHANGED
@@ -5,8 +5,11 @@
5
5
  */
6
6
  export { atLeastAsRisky } from '@stratusagent/core';
7
7
  import { analyzeCommand, describeCommandScope, findMatchingScope, normalizeCommandScope, SAFE_COMMAND_SCOPES, } from "./commands.js";
8
+ import { describeOriginScope, findMatchingOriginScope, originScopeFor, } from "./origins.js";
9
+ import { WhitelistUnreadableError, } from "./whitelist.js";
8
10
  export { analyzeCommand, describeCommandScope, findMatchingScope, matchesScope, normalizeCommandScope, parseCommandScope, sameScope, SAFE_COMMAND_SCOPES, } from "./commands.js";
9
- export { createFileCommandWhitelist, whitelistPathFor, } from "./whitelist.js";
11
+ export { describeOriginScope, findMatchingOriginScope, matchesOriginScope, originScopeFor, parseOriginScope, sameOriginScope, } from "./origins.js";
12
+ export { createFileCommandWhitelist, whitelistPathFor, WhitelistUnreadableError, } from "./whitelist.js";
10
13
  const YES = new Set(['y', 'yes', 'always', 'a']);
11
14
  const ALWAYS = new Set(['always', 'a']);
12
15
  const ABORTED = Symbol('aborted');
@@ -118,7 +121,13 @@ const summarizeInput = (input) => {
118
121
  * text from a person mid-typing, so it is read leniently and anything that
119
122
  * is not recognisably a yes is a no.
120
123
  */
121
- const awaitPrompt = async (context, ask, command) => {
124
+ const awaitPrompt = async (context, ask, command, origin,
125
+ /**
126
+ * What answering "always" will actually do, decided by the caller — which
127
+ * is the only place that knows. Offering a lifetime the engine will not
128
+ * create is the same defect as hiding one it will.
129
+ */
130
+ alwaysMeans) => {
122
131
  const { call, risk, session } = context;
123
132
  // The command, when there is one: for a shell call the tool name is the
124
133
  // least interesting half of the question, and an approver shown only
@@ -130,13 +139,16 @@ const awaitPrompt = async (context, ask, command) => {
130
139
  // there is no command scope to show, fall back to a compact rendering of
131
140
  // the call's input, exactly as the remote (Slack) prompt already does.
132
141
  const argumentSummary = command === undefined ? summarizeInput(call.input) : undefined;
142
+ // The origin goes in front of the arguments rather than into them: a
143
+ // selector says nothing about where a click lands, and this is the half
144
+ // of the question "always" widens.
145
+ const acting = origin === undefined ? call.toolName : `${call.toolName} on ${origin}`;
133
146
  const what = command !== undefined
134
147
  ? `${call.toolName}: ${command}`
135
148
  : argumentSummary !== undefined
136
- ? `${call.toolName} (${risk}): ${argumentSummary}`
137
- : `${call.toolName} (${risk})`;
138
- const always = command === undefined ? 'always this session' : 'always this scope';
139
- const pending = ask(`Allow ${what} for ${session.agent.name}? [y]es / [a]lways (${always}) / [N]o: `);
149
+ ? `${acting} (${risk}): ${argumentSummary}`
150
+ : `${acting} (${risk})`;
151
+ const pending = ask(`Allow ${what} for ${session.agent.name}? [y]es / [a]lways (${alwaysMeans}) / [N]o: `);
140
152
  // The answer is never read after this point if the turn ends first,
141
153
  // so a late yes cannot execute a tool for work that no longer exists.
142
154
  pending.catch(() => undefined);
@@ -161,12 +173,14 @@ const awaitPrompt = async (context, ask, command) => {
161
173
  * its call was not approved and carry on, not crash on the machinery that
162
174
  * was supposed to ask.
163
175
  */
164
- const awaitRemote = async (context, request) => {
176
+ const awaitRemote = async (context, request, origin, oneShot) => {
165
177
  const pending = request({
166
178
  session: context.session,
167
179
  call: context.call,
168
180
  tool: context.tool,
169
181
  risk: context.risk,
182
+ ...(origin !== undefined ? { origin } : {}),
183
+ ...(oneShot ? { oneShot } : {}),
170
184
  ...(context.parkedAt ? { parkedAt: context.parkedAt } : {}),
171
185
  ...(context.signal ? { signal: context.signal } : {}),
172
186
  }).then((answer) => answer, () => 'deny');
@@ -183,9 +197,14 @@ const awaitRemote = async (context, request) => {
183
197
  * after which there is nothing left but asking. A `dangerous` tool skips
184
198
  * the scope engine entirely: its risk is a statement about the tool, and no
185
199
  * argument shape makes `rm -rf` a read.
200
+ *
201
+ * A tool that names an *origin* (`Tool.originFor`) resolves through the
202
+ * same two grant tiers over a different vocabulary — the site the page is
203
+ * on, rather than the command the call would run. It has no third tier,
204
+ * because there is no origin that is safe to click on out of the box.
186
205
  */
187
206
  export const createPermissionPolicy = (options) => {
188
- const { mode, ask, request, onDecision, commands, destinations } = options;
207
+ const { mode, ask, request, onDecision, commands, destinations, origins } = options;
189
208
  if (mode === 'interactive' && !ask) {
190
209
  throw new Error('interactive permission mode needs an `ask` function to reach a human.');
191
210
  }
@@ -201,7 +220,9 @@ export const createPermissionPolicy = (options) => {
201
220
  // with no whitelist store still has to remember an answer for the rest of
202
221
  // the session, which is what `always` means at a terminal.
203
222
  const sessionScopes = new Map();
204
- const report = (context, allowed, reason, command, destination) => {
223
+ /** The same tier for origins, and for the same reason. */
224
+ const sessionOrigins = new Map();
225
+ const report = (context, allowed, reason, command, destination, origin) => {
205
226
  onDecision?.({
206
227
  allowed,
207
228
  mode,
@@ -212,6 +233,7 @@ export const createPermissionPolicy = (options) => {
212
233
  reason,
213
234
  ...(command === undefined ? {} : { command }),
214
235
  ...(destination === undefined ? {} : { destination }),
236
+ ...(origin === undefined ? {} : { origin }),
215
237
  });
216
238
  return allowed;
217
239
  };
@@ -225,8 +247,78 @@ export const createPermissionPolicy = (options) => {
225
247
  // its arguments. Resolved before anything else so that the tool-wide
226
248
  // "always" below can never apply to it: one yes to `git status` must
227
249
  // not become a standing yes to every command the shell can run.
228
- const command = risk === 'gated' ? context.tool.commandFor?.(call.input) : undefined;
250
+ // A tool that offers more than one scope hook is judged by none of
251
+ // them, and asks like any other gated call.
252
+ //
253
+ // Each hook narrows a call along one axis — what it runs, where it
254
+ // sends, what site it acts on — and each grant answers only its own
255
+ // question. Composing them needs a decision nobody has made: a call
256
+ // with two axes could reasonably need every applicable scope to
257
+ // authorize it, or the narrowest, and picking silently is how a
258
+ // grant on one axis waves through a call unapproved on the other.
259
+ // Falling back to a human is the answer that cannot be wrong while
260
+ // that decision is unmade.
261
+ //
262
+ // Nothing offers two today (`shell.run` a command, `message.send` a
263
+ // destination, `browser.act` an origin), so this changes nothing now
264
+ // — it is here so that adding one cannot quietly open that door. The
265
+ // guard first covered only `commandFor`, and left exactly this hole
266
+ // for `destinationFor`; one rule over all three has no such corner.
267
+ const scopeHooks = [
268
+ context.tool.commandFor,
269
+ context.tool.destinationFor,
270
+ context.tool.originFor,
271
+ ].filter((hook) => hook !== undefined).length;
272
+ const singlyScoped = scopeHooks <= 1;
273
+ // Turning the scope engines off is only half of it. The tool-wide
274
+ // "always" is what a tool with no scope at all falls back to, and
275
+ // letting a multi-hook tool reach it would be worse than the hole
276
+ // this rule closed: one yes, and then a session of unattended calls
277
+ // with neither scope consulted. A tool that asked to be judged by a
278
+ // scope does not get to be judged by nothing instead.
279
+ const multiplyScoped = scopeHooks > 1;
280
+ const command = risk === 'gated' && singlyScoped
281
+ ? context.tool.commandFor?.(call.input)
282
+ : undefined;
229
283
  const analysis = command === undefined ? undefined : analyzeCommand(command);
284
+ // Whether this tool is judged by *where* it acts, and where it is
285
+ // acting right now. `gated` only, for the reason a destination cannot
286
+ // launder a `dangerous` call either: a scope narrows a tool whose
287
+ // risk lives in its arguments, and `dangerous` is a statement about
288
+ // the tool itself.
289
+ //
290
+ // The two are separate on purpose. `scopedByOrigin` is true for any
291
+ // tool that offers the hook, even on a call where it answers nothing
292
+ // — a page that has not loaded, one closed by the idle sweep — and it
293
+ // is what bars the tool-wide "always" below. Without that, a click
294
+ // approved on a page whose origin could not be named would fall back
295
+ // to a standing yes to `browser.act` on every site, which is exactly
296
+ // the grant per-origin scopes exist to replace.
297
+ const scopedByOrigin = risk === 'gated'
298
+ && singlyScoped
299
+ && context.tool.originFor !== undefined;
300
+ // The grants first, and where the page is *after* them. Read the
301
+ // other way round, the store's disk read sits between the two, and a
302
+ // page that redirects inside it has a grant for site A allow a click
303
+ // on site B — the same shape as the approval wait below, with a
304
+ // shorter gap and no bound on it at all when the store is somebody
305
+ // else's. There is no await between this read and the match, so the
306
+ // origin a grant is checked against is where the conversation is when
307
+ // the decision is made, not where it was.
308
+ const grantedOrigins = scopedByOrigin
309
+ ? [
310
+ ...(sessionOrigins.get(session.agent.id) ?? []),
311
+ ...(origins?.whitelist ? await origins.whitelist.originsFor(session.agent.id) : []),
312
+ ]
313
+ : [];
314
+ const reportedOrigin = scopedByOrigin ? context.tool.originFor?.(session) : undefined;
315
+ // Read through the same normalizer a grant file is read through,
316
+ // rather than taken as written. The hook's contract is an origin, but
317
+ // this is what a grant is compared against — a plugin that hands back
318
+ // a whole page URL should get a grant on its origin, not one that
319
+ // silently never matches anything.
320
+ const originScope = reportedOrigin === undefined ? undefined : originScopeFor(reportedOrigin);
321
+ const origin = originScope?.origin;
230
322
  if (analysis) {
231
323
  if (analysis.disqualifiedBy) {
232
324
  // Never auto-approved, whatever the base command is: a safe scope
@@ -248,14 +340,23 @@ export const createPermissionPolicy = (options) => {
248
340
  }
249
341
  }
250
342
  }
251
- else if (alwaysAllowed.has(sessionKey(session.id, call.toolName))) {
343
+ else if (risk !== 'dangerous'
344
+ && !scopedByOrigin
345
+ && !multiplyScoped
346
+ && alwaysAllowed.has(sessionKey(session.id, call.toolName))) {
252
347
  return report(context, true, `${call.toolName} was approved for the rest of this session`);
253
348
  }
349
+ if (origin !== undefined) {
350
+ const granted = findMatchingOriginScope(origin, grantedOrigins);
351
+ if (granted) {
352
+ return report(context, true, `${call.toolName} acted on the approved site ${describeOriginScope(granted)}`, undefined, undefined, origin);
353
+ }
354
+ }
254
355
  // The schedule's destination scope, checked before the headless
255
356
  // refusal because an unattended firing is exactly when it applies.
256
357
  // `gated` only: a destination cannot launder a `dangerous` call, the
257
358
  // same way no argument shape makes `rm -rf` a read.
258
- if (risk === 'gated' && destinations) {
359
+ if (risk === 'gated' && singlyScoped && destinations) {
259
360
  const destination = context.tool.destinationFor?.(call.input);
260
361
  if (destination !== undefined
261
362
  && await destinations.isPreauthorized(session, destination)) {
@@ -263,10 +364,19 @@ export const createPermissionPolicy = (options) => {
263
364
  }
264
365
  }
265
366
  if (mode === 'headless') {
266
- return report(context, false, command === undefined
267
- ? `${call.toolName} is ${risk} and nobody is available to approve it`
268
- : `${call.toolName} was called outside every approved scope`
269
- + `${analysis?.base ? ` (${analysis.base})` : ''} and nobody is available to approve it`, command);
367
+ return report(context, false, command !== undefined
368
+ ? `${call.toolName} was called outside every approved scope`
369
+ + `${analysis?.base ? ` (${analysis.base})` : ''} and nobody is available to approve it`
370
+ : origin !== undefined
371
+ // Named, because it is the actionable half: an operator
372
+ // reading this at 3am needs to know which site to grant, and
373
+ // an origin carries no path or query to leak while saying so.
374
+ ? `${call.toolName} was called on ${origin}, which no approved site covers,`
375
+ + ' and nobody is available to approve it'
376
+ : scopedByOrigin
377
+ ? `${call.toolName} was called on a page with no origin a grant could name,`
378
+ + ' and nobody is available to approve it'
379
+ : `${call.toolName} is ${risk} and nobody is available to approve it`, command, undefined, origin);
270
380
  }
271
381
  // An aborted turn must not sit on a prompt: the human would be
272
382
  // answering for work that no longer exists, and an answer arriving
@@ -279,26 +389,121 @@ export const createPermissionPolicy = (options) => {
279
389
  // refusal is reported — is deliberately shared, so a decision made in
280
390
  // Slack and one typed at a terminal cannot drift into meaning
281
391
  // different things.
392
+ // Whether answering "always" would remember anything at all, decided
393
+ // here because this is where the answer is: a `dangerous` tool never
394
+ // remembers, and an origin-scoped call with no page has nothing to
395
+ // remember. Both are certain before anyone is asked, so both surfaces
396
+ // can stop offering a grant the engine will not create.
397
+ // A command this parser cannot reduce to a scope — a pipe, a
398
+ // subshell, an unbalanced quote, a refspec delete — is the third
399
+ // one-shot shape, and the oldest: the branch below has always run it
400
+ // once and remembered nothing, because widening to the bare tool
401
+ // would hand the agent every command. Resolved here rather than
402
+ // after the answer so the question can say so; it is a pure function
403
+ // of the analysis, and the branch below reuses this exact value.
404
+ const commandScope = analysis ? normalizeCommandScope(analysis) : undefined;
405
+ const oneShot = risk === 'dangerous'
406
+ || multiplyScoped
407
+ || (scopedByOrigin && origin === undefined)
408
+ || (analysis !== undefined && commandScope === undefined);
409
+ const alwaysMeans = oneShot
410
+ ? risk === 'dangerous'
411
+ ? 'not remembered — a dangerous tool asks every time'
412
+ : multiplyScoped
413
+ ? 'not remembered — this tool names more than one kind of scope'
414
+ : analysis !== undefined
415
+ ? 'not remembered — this command cannot be reduced to a scope'
416
+ : 'not remembered — there is no page to grant'
417
+ : command !== undefined
418
+ ? 'always this scope'
419
+ : scopedByOrigin
420
+ ? 'always this site'
421
+ : 'always this session';
282
422
  const answer = mode === 'remote'
283
- ? await awaitRemote(context, request)
284
- : await awaitPrompt(context, ask, command);
423
+ ? await awaitRemote(context, request, origin, oneShot)
424
+ : await awaitPrompt(context, ask, command, origin, alwaysMeans);
285
425
  if (answer === ABORTED) {
286
426
  return report(context, false, `${call.toolName} was cancelled while awaiting approval`);
287
427
  }
288
428
  if (answer === 'deny') {
289
429
  return report(context, false, mode === 'remote'
290
430
  ? `${call.toolName} was not approved`
291
- : `${call.toolName} was refused at the prompt`, command);
431
+ : `${call.toolName} was refused at the prompt`, command, undefined, origin);
292
432
  }
433
+ /**
434
+ * Allow — unless the conversation moved out from under the answer.
435
+ *
436
+ * The origin was read before the wait, and the wait is a human's:
437
+ * fifteen minutes by default, unbounded when the timeout is zero. A
438
+ * page that navigates inside it (a redirect, a meta refresh, a
439
+ * script) would have a yes given for site A land a click on site B,
440
+ * with the prompt still naming A. The approver answered a question
441
+ * about a page; if it is not that page any more, there is no answer
442
+ * to act on, and re-asking is not the fix — that is a second question
443
+ * with the same race behind it.
444
+ *
445
+ * Every path out of the approval goes through this, and it is the
446
+ * *last* thing each of them does, because the answer is not the last
447
+ * yield: persisting a grant is a disk write, and a store somebody
448
+ * else wrote has no bound at all. Checking once when the answer
449
+ * arrives would leave exactly that window open. One chokepoint, so a
450
+ * path added later cannot quietly skip it.
451
+ *
452
+ * A grant persisted before the page moved is kept, and that is not a
453
+ * hole: the approver read that site and said always. What must not
454
+ * happen is the *click* landing somewhere they never saw.
455
+ */
456
+ const allowUnlessMoved = (reason, forCommand) => {
457
+ if (!scopedByOrigin) {
458
+ return report(context, true, reason, forCommand, undefined, origin);
459
+ }
460
+ const settled = originScopeFor(context.tool.originFor?.(session) ?? '')?.origin;
461
+ if (settled === origin) {
462
+ return report(context, true, reason, forCommand, undefined, origin);
463
+ }
464
+ const approvedOn = origin ?? 'a page with no origin';
465
+ return report(context, false, settled === undefined
466
+ ? `${call.toolName} was approved on ${approvedOn}, and that page is no longer open`
467
+ + ' — it did not run'
468
+ : `${call.toolName} was approved on ${approvedOn}, but the conversation is on ${settled} now`
469
+ + ' — it did not run', undefined, undefined, origin);
470
+ };
293
471
  if (answer === 'always') {
294
- const scope = analysis ? normalizeCommandScope(analysis) : undefined;
472
+ if (scopedByOrigin) {
473
+ if (!originScope) {
474
+ // No origin to remember — a page that never loaded, or one
475
+ // whose URL has no origin this engine will name. The call runs;
476
+ // nothing is widened. Falling back to the tool-wide grant here
477
+ // would turn "always on this page" into "always on every page",
478
+ // which is the grant this whole engine replaced.
479
+ return allowUnlessMoved(`${call.toolName} was approved once; there is no page origin to remember, so it will ask again`);
480
+ }
481
+ sessionOrigins.set(session.agent.id, [...(sessionOrigins.get(session.agent.id) ?? []), originScope]);
482
+ if (origins?.whitelist) {
483
+ try {
484
+ await origins.whitelist.rememberOrigin(session.agent.id, originScope);
485
+ }
486
+ catch (error) {
487
+ if (!(error instanceof WhitelistUnreadableError)) {
488
+ throw error;
489
+ }
490
+ // Same bargain the command half makes: the answer holds for
491
+ // this process, and the file that would carry it past a
492
+ // restart is not written over grants nobody can read.
493
+ return allowUnlessMoved(`${call.toolName} was approved, and ${describeOriginScope(originScope)} is acted on without asking for ${session.agent.id} until the daemon restarts — not saved: ${error.message}`);
494
+ }
495
+ origins.onScopeRemembered?.({ agentId: session.agent.id, scope: originScope });
496
+ }
497
+ return allowUnlessMoved(`${call.toolName} was approved, and ${describeOriginScope(originScope)} is now acted on without asking`);
498
+ }
499
+ const scope = commandScope;
295
500
  if (analysis && !scope) {
296
501
  // A command this parser could not reduce to a scope — a pipe, a
297
502
  // subshell, an unbalanced quote. "Always" must not fall back to
298
503
  // the tool-wide grant here: the approver widened one command they
299
504
  // read, and remembering `shell.run` instead would hand the agent
300
505
  // every command for the rest of the session.
301
- return report(context, true, `${call.toolName} was approved once; it cannot be reduced to a scope, so it will ask again`, command);
506
+ return allowUnlessMoved(`${call.toolName} was approved once; it cannot be reduced to a scope, so it will ask again`, command);
302
507
  }
303
508
  if (scope) {
304
509
  // A scope, never the command string (useless next time) and never
@@ -307,15 +512,45 @@ export const createPermissionPolicy = (options) => {
307
512
  // asks again.
308
513
  sessionScopes.set(session.agent.id, [...(sessionScopes.get(session.agent.id) ?? []), scope]);
309
514
  if (commands?.whitelist) {
310
- await commands.whitelist.remember(session.agent.id, scope);
515
+ try {
516
+ await commands.whitelist.remember(session.agent.id, scope);
517
+ }
518
+ catch (error) {
519
+ if (!(error instanceof WhitelistUnreadableError)) {
520
+ throw error;
521
+ }
522
+ // The answer stands for as long as tier one does — this
523
+ // process, for this agent, which is what the person's
524
+ // "always" means without a file — and the file that would
525
+ // carry it past a restart is not written over grants nobody
526
+ // can read. The line says both.
527
+ return allowUnlessMoved(`${call.toolName} was approved, and "${describeCommandScope(scope)}" runs without asking for ${session.agent.id} until the daemon restarts — not saved: ${error.message}`, command);
528
+ }
311
529
  commands.onScopeRemembered?.({ agentId: session.agent.id, scope });
312
530
  }
313
- return report(context, true, `${call.toolName} was approved, and "${describeCommandScope(scope)}" now runs without asking`, command);
531
+ return allowUnlessMoved(`${call.toolName} was approved, and "${describeCommandScope(scope)}" now runs without asking`, command);
532
+ }
533
+ if (risk === 'dangerous') {
534
+ // The tier means "a human every time, whatever scopes exist", and
535
+ // it kept that name in this change on exactly that basis — no
536
+ // first-party tool is in it any more, so what it is *for* is an
537
+ // operator's `toolRisks` or a plugin manifest saying it about
538
+ // somebody else's code. A session-wide grant made that a promise
539
+ // about the first call only (28 names this and calls tightening
540
+ // it deliberate); it is now what it says.
541
+ return allowUnlessMoved(`${call.toolName} was approved once; a dangerous tool is never remembered, so it will ask again`);
542
+ }
543
+ if (multiplyScoped) {
544
+ // The other half of the multi-hook rule. Storing a tool-wide
545
+ // grant here would be the engine answering "how do two scopes
546
+ // compose?" with "they do not apply", which is the one answer
547
+ // nobody would choose deliberately.
548
+ return allowUnlessMoved(`${call.toolName} was approved once; it names more than one kind of scope, so it will ask again`);
314
549
  }
315
550
  alwaysAllowed.add(sessionKey(session.id, call.toolName));
316
- return report(context, true, `${call.toolName} was approved for the rest of this session`);
551
+ return allowUnlessMoved(`${call.toolName} was approved for the rest of this session`);
317
552
  }
318
- return report(context, true, `${call.toolName} was approved once`, command);
553
+ return allowUnlessMoved(`${call.toolName} was approved once`, command);
319
554
  },
320
555
  };
321
556
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GAEpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,GAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GAEjB,MAAM,gBAAgB,CAAC;AA4JxB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AACjD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AAExC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAElC;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,KAAK,EACxB,IAAgB,EAChB,MAA+B,EACF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D,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;oBACzB,kEAAkE;oBAClE,8DAA8D;oBAC9D,gEAAgE;oBAChE,8DAA8D;oBAC9D,iEAAiE;oBACjE,gEAAgE;oBAChE,0CAA0C;oBAC1C,OAAO,gBAAgB,CACrB,GAAG,IAAI,CAAC,QAAQ,gFAAgF,CACjG,CAAC;gBACJ,CAAC;gBACD,IAAI,cAAc,EAAE,CAAC;oBACnB,6DAA6D;oBAC7D,8DAA8D;oBAC9D,8DAA8D;oBAC9D,oCAAoC;oBACpC,OAAO,gBAAgB,CACrB,GAAG,IAAI,CAAC,QAAQ,gFAAgF,CACjG,CAAC;gBACJ,CAAC;gBACD,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACzD,OAAO,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,4CAA4C,CAAC,CAAC;YACxF,CAAC;YAED,OAAO,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,oBAAoB,EAAE,OAAO,CAAC,CAAC;QACzE,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The origin-scope engine: which *sites* a browser action may be taken on
3
+ * unattended.
4
+ *
5
+ * `ToolRisk` classifies a tool, and that was too coarse for `browser.act`
6
+ * in the same way it is too coarse for a shell — but not for the same
7
+ * reason, and the difference is why this is a second engine rather than a
8
+ * second use of the first. A command string *is* a description of its
9
+ * effect, so `analyzeCommand` can tell `git status` from `rm -rf`. A CSS
10
+ * selector is not: `click("#submit")` is equally "load more results" and
11
+ * "confirm purchase", and a scope written over selectors would mean
12
+ * nothing at all.
13
+ *
14
+ * What is left that an operator can read is *where* the click lands. So a
15
+ * scope here is one origin — `https://app.example.com`, exactly, scheme
16
+ * and host and port — taken from the page the conversation is already on
17
+ * rather than from anything the call said about itself.
18
+ *
19
+ * **This narrows the blast radius; it does not eliminate it.** Acting on
20
+ * `app.example.com` still covers "delete the record" alongside "load more".
21
+ * The claim is only that the radius is now nameable, which is what a
22
+ * single `dangerous` tier gave up on — and the docs say it in those words
23
+ * rather than implying a click became safe.
24
+ *
25
+ * There is deliberately no built-in safe list here, which is the other
26
+ * asymmetry with the command engine. `SAFE_COMMAND_SCOPES` can exist
27
+ * because `git status` is read-only wherever it runs; no origin has that
28
+ * property, since whether clicking on a site is harmless is a fact about
29
+ * the operator's account on it rather than about the site. A first-party
30
+ * list would be this project guessing at somebody's permissions, so every
31
+ * origin an agent may act on unattended was granted by a person — at a
32
+ * prompt, in Slack, or by hand in that agent's whitelist file.
33
+ */
34
+ /** One narrow permission to act on a site: an origin, and nothing else. */
35
+ export interface OriginScope {
36
+ /**
37
+ * `https://app.example.com`, or `https://app.example.com:8443` when the
38
+ * port is not the scheme's default — the form `originOf` produces, which
39
+ * is the only form this engine ever compares.
40
+ */
41
+ origin: string;
42
+ }
43
+ /**
44
+ * The scope a page URL grants, or nothing when the URL has no origin this
45
+ * engine will name (`about:blank`, a `file:` path, an unparseable string).
46
+ *
47
+ * Nothing falls back to a looser grant: a page whose origin cannot be
48
+ * named is a page no scope covers, so the call asks a human and an
49
+ * "always" answered on it is remembered for that call only.
50
+ */
51
+ export declare const originScopeFor: (rawUrl: string) => OriginScope | undefined;
52
+ /** Whether an action on `origin` falls inside one scope. */
53
+ export declare const matchesOriginScope: (origin: string, scope: OriginScope) => boolean;
54
+ /** The first scope covering this origin, if any covers it. */
55
+ export declare const findMatchingOriginScope: (origin: string, scopes: readonly OriginScope[]) => OriginScope | undefined;
56
+ /** One line an operator can read in a log or a grant listing. */
57
+ export declare const describeOriginScope: (scope: OriginScope) => string;
58
+ /** Whether two scopes permit the same thing, so a whitelist does not grow duplicates. */
59
+ export declare const sameOriginScope: (left: OriginScope, right: OriginScope) => boolean;
60
+ /**
61
+ * Read one scope out of a whitelist file, or refuse it.
62
+ *
63
+ * Re-normalized through `originScopeFor` rather than trusted as written,
64
+ * because this file is hand-editable and a grant is only as good as the
65
+ * comparison it will lose or win. `https://APP.example.com/reports` in the
66
+ * file becomes `https://app.example.com` or it is dropped — a trailing
67
+ * path that silently never matched would read as a grant and behave as
68
+ * none, and a second spelling of an approved host is a second grant nobody
69
+ * wrote.
70
+ */
71
+ export declare const parseOriginScope: (raw: unknown) => OriginScope | undefined;
72
+ //# sourceMappingURL=origins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../src/origins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,WAAW,GAAG,SAG7D,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,OAAO,WAAW,KAAG,OAC/C,CAAC;AAE1B,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,EACd,QAAQ,SAAS,WAAW,EAAE,KAC7B,WAAW,GAAG,SAAsE,CAAC;AAExF,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,GAAI,OAAO,WAAW,KAAG,MAAsB,CAAC;AAEhF,yFAAyF;AACzF,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,EAAE,OAAO,WAAW,KAAG,OAC1C,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,OAAO,KAAG,WAAW,GAAG,SAM7D,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The origin-scope engine: which *sites* a browser action may be taken on
3
+ * unattended.
4
+ *
5
+ * `ToolRisk` classifies a tool, and that was too coarse for `browser.act`
6
+ * in the same way it is too coarse for a shell — but not for the same
7
+ * reason, and the difference is why this is a second engine rather than a
8
+ * second use of the first. A command string *is* a description of its
9
+ * effect, so `analyzeCommand` can tell `git status` from `rm -rf`. A CSS
10
+ * selector is not: `click("#submit")` is equally "load more results" and
11
+ * "confirm purchase", and a scope written over selectors would mean
12
+ * nothing at all.
13
+ *
14
+ * What is left that an operator can read is *where* the click lands. So a
15
+ * scope here is one origin — `https://app.example.com`, exactly, scheme
16
+ * and host and port — taken from the page the conversation is already on
17
+ * rather than from anything the call said about itself.
18
+ *
19
+ * **This narrows the blast radius; it does not eliminate it.** Acting on
20
+ * `app.example.com` still covers "delete the record" alongside "load more".
21
+ * The claim is only that the radius is now nameable, which is what a
22
+ * single `dangerous` tier gave up on — and the docs say it in those words
23
+ * rather than implying a click became safe.
24
+ *
25
+ * There is deliberately no built-in safe list here, which is the other
26
+ * asymmetry with the command engine. `SAFE_COMMAND_SCOPES` can exist
27
+ * because `git status` is read-only wherever it runs; no origin has that
28
+ * property, since whether clicking on a site is harmless is a fact about
29
+ * the operator's account on it rather than about the site. A first-party
30
+ * list would be this project guessing at somebody's permissions, so every
31
+ * origin an agent may act on unattended was granted by a person — at a
32
+ * prompt, in Slack, or by hand in that agent's whitelist file.
33
+ */
34
+ import { originOf } from '@stratusagent/core';
35
+ /**
36
+ * The scope a page URL grants, or nothing when the URL has no origin this
37
+ * engine will name (`about:blank`, a `file:` path, an unparseable string).
38
+ *
39
+ * Nothing falls back to a looser grant: a page whose origin cannot be
40
+ * named is a page no scope covers, so the call asks a human and an
41
+ * "always" answered on it is remembered for that call only.
42
+ */
43
+ export const originScopeFor = (rawUrl) => {
44
+ const origin = originOf(rawUrl);
45
+ return origin === undefined ? undefined : { origin };
46
+ };
47
+ /** Whether an action on `origin` falls inside one scope. */
48
+ export const matchesOriginScope = (origin, scope) => scope.origin === origin;
49
+ /** The first scope covering this origin, if any covers it. */
50
+ export const findMatchingOriginScope = (origin, scopes) => scopes.find((scope) => matchesOriginScope(origin, scope));
51
+ /** One line an operator can read in a log or a grant listing. */
52
+ export const describeOriginScope = (scope) => scope.origin;
53
+ /** Whether two scopes permit the same thing, so a whitelist does not grow duplicates. */
54
+ export const sameOriginScope = (left, right) => left.origin === right.origin;
55
+ /**
56
+ * Read one scope out of a whitelist file, or refuse it.
57
+ *
58
+ * Re-normalized through `originScopeFor` rather than trusted as written,
59
+ * because this file is hand-editable and a grant is only as good as the
60
+ * comparison it will lose or win. `https://APP.example.com/reports` in the
61
+ * file becomes `https://app.example.com` or it is dropped — a trailing
62
+ * path that silently never matched would read as a grant and behave as
63
+ * none, and a second spelling of an approved host is a second grant nobody
64
+ * wrote.
65
+ */
66
+ export const parseOriginScope = (raw) => {
67
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
68
+ return undefined;
69
+ }
70
+ const origin = raw.origin;
71
+ return typeof origin === 'string' ? originScopeFor(origin) : undefined;
72
+ };
73
+ //# sourceMappingURL=origins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origins.js","sourceRoot":"","sources":["../src/origins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAY9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAA2B,EAAE;IACxE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAE,KAAkB,EAAW,EAAE,CAChF,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;AAE1B,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,MAAc,EACd,MAA8B,EACL,EAAE,CAAC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