@stratusagent/permissions 0.11.2 → 0.11.4
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/grants.d.ts +67 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +70 -0
- package/dist/grants.js.map +1 -0
- package/dist/index.d.ts +68 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -18
- package/dist/index.js.map +1 -1
- package/dist/whitelist.d.ts +69 -4
- package/dist/whitelist.d.ts.map +1 -1
- package/dist/whitelist.js +90 -10
- package/dist/whitelist.js.map +1 -1
- package/package.json +2 -2
package/dist/grants.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standing-grant engine: which *tools* an agent may run unattended,
|
|
3
|
+
* by name, until an operator says otherwise.
|
|
4
|
+
*
|
|
5
|
+
* The third vocabulary the whitelist file speaks, beside command scopes
|
|
6
|
+
* and origins, and the coarsest: a grant here is the whole tool. That is
|
|
7
|
+
* only safe for a tool whose risk lives in its identity rather than its
|
|
8
|
+
* arguments — which is exactly what a tool with no scope hook is saying
|
|
9
|
+
* about itself. A tool that offers `commandFor` or `originFor` has said
|
|
10
|
+
* the opposite, and never receives one of these; the engine keeps that
|
|
11
|
+
* structural rather than remembered, by resolving scopes first.
|
|
12
|
+
*
|
|
13
|
+
* A grant is scoped to the tool *as it was when granted*, so it records the
|
|
14
|
+
* package that contributed it and stops applying when that changes: a
|
|
15
|
+
* different package claiming a granted name — one plugin swapped for
|
|
16
|
+
* another, a bridged server's tool taken over — asks again, and the listing
|
|
17
|
+
* says why. A kernel tool records no package, and matches only a kernel one.
|
|
18
|
+
*
|
|
19
|
+
* The same package upgraded **in place** keeps its grants, and that is a
|
|
20
|
+
* decision rather than a gap. Pinning identity to a version would revoke
|
|
21
|
+
* every grant on every routine upgrade, which trains an operator to
|
|
22
|
+
* re-approve without reading and buys nothing against the case that
|
|
23
|
+
* actually worries anyone — a package whose new version is hostile is one
|
|
24
|
+
* whose next version is too. 28 scoped this to recording the package,
|
|
25
|
+
* "the only thing that makes the question answerable later"; answering it
|
|
26
|
+
* properly wants an integrity identifier the plugin host does not have
|
|
27
|
+
* yet, and belongs with whatever introduces one. Until then the operator's
|
|
28
|
+
* remedy is `stratus grants revoke` after an upgrade they distrust, which
|
|
29
|
+
* is why the listing shows the package it was granted from.
|
|
30
|
+
*/
|
|
31
|
+
/** One standing permission to run a tool: the tool, and its provenance. */
|
|
32
|
+
export interface ToolGrant {
|
|
33
|
+
/** `namespace.verb`, as the tool registered. */
|
|
34
|
+
tool: string;
|
|
35
|
+
/** The plugin package that contributed it when granted; absent for a kernel tool. */
|
|
36
|
+
package?: string;
|
|
37
|
+
/** When the operator answered, ISO-8601. */
|
|
38
|
+
grantedAt: string;
|
|
39
|
+
/** Who answered, in the ids of the channel that asked; absent at a terminal. */
|
|
40
|
+
grantedBy?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Whether a grant covers a call to `tool` as contributed by `contributor`
|
|
44
|
+
* right now. Both halves must agree: the same name from a different
|
|
45
|
+
* package is a different tool, and so is the same name from no package.
|
|
46
|
+
*/
|
|
47
|
+
export declare const matchesToolGrant: (tool: string, contributor: string | undefined, grant: ToolGrant) => boolean;
|
|
48
|
+
/** The first grant covering this call, if any covers it. */
|
|
49
|
+
export declare const findMatchingToolGrant: (tool: string, contributor: string | undefined, grants: readonly ToolGrant[]) => ToolGrant | undefined;
|
|
50
|
+
/** One line an operator can read in a log or a grant listing. */
|
|
51
|
+
export declare const describeToolGrant: (grant: ToolGrant) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether two grants are the same permission. One per tool per agent: a
|
|
54
|
+
* second "always" on a tool already granted from another package replaces
|
|
55
|
+
* the first rather than sitting beside it, because the operator answered
|
|
56
|
+
* about the tool they were shown, and two rows for one name would leave a
|
|
57
|
+
* listing that cannot say which one applies.
|
|
58
|
+
*/
|
|
59
|
+
export declare const sameToolGrant: (left: ToolGrant, right: ToolGrant) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Read one grant out of a whitelist file, or refuse it. A row with no
|
|
62
|
+
* tool name grants nothing; a row with no timestamp is kept, dated to
|
|
63
|
+
* the epoch rather than invented, so a hand-written grant is still a grant
|
|
64
|
+
* and still visibly one nobody answered at a prompt.
|
|
65
|
+
*/
|
|
66
|
+
export declare const parseToolGrant: (raw: unknown) => ToolGrant | undefined;
|
|
67
|
+
//# sourceMappingURL=grants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../src/grants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,aAAa,MAAM,GAAG,SAAS,EAAE,OAAO,SAAS,KAAG,OAC7C,CAAC;AAEvD,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EACZ,aAAa,MAAM,GAAG,SAAS,EAC/B,QAAQ,SAAS,SAAS,EAAE,KAC3B,SAAS,GAAG,SAA+E,CAAC;AAE/F,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,GAAI,OAAO,SAAS,KAAG,MAC0B,CAAC;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,SAAS,EAAE,OAAO,SAAS,KAAG,OACxC,CAAC;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,KAAG,SAAS,GAAG,SAczD,CAAC"}
|
package/dist/grants.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standing-grant engine: which *tools* an agent may run unattended,
|
|
3
|
+
* by name, until an operator says otherwise.
|
|
4
|
+
*
|
|
5
|
+
* The third vocabulary the whitelist file speaks, beside command scopes
|
|
6
|
+
* and origins, and the coarsest: a grant here is the whole tool. That is
|
|
7
|
+
* only safe for a tool whose risk lives in its identity rather than its
|
|
8
|
+
* arguments — which is exactly what a tool with no scope hook is saying
|
|
9
|
+
* about itself. A tool that offers `commandFor` or `originFor` has said
|
|
10
|
+
* the opposite, and never receives one of these; the engine keeps that
|
|
11
|
+
* structural rather than remembered, by resolving scopes first.
|
|
12
|
+
*
|
|
13
|
+
* A grant is scoped to the tool *as it was when granted*, so it records the
|
|
14
|
+
* package that contributed it and stops applying when that changes: a
|
|
15
|
+
* different package claiming a granted name — one plugin swapped for
|
|
16
|
+
* another, a bridged server's tool taken over — asks again, and the listing
|
|
17
|
+
* says why. A kernel tool records no package, and matches only a kernel one.
|
|
18
|
+
*
|
|
19
|
+
* The same package upgraded **in place** keeps its grants, and that is a
|
|
20
|
+
* decision rather than a gap. Pinning identity to a version would revoke
|
|
21
|
+
* every grant on every routine upgrade, which trains an operator to
|
|
22
|
+
* re-approve without reading and buys nothing against the case that
|
|
23
|
+
* actually worries anyone — a package whose new version is hostile is one
|
|
24
|
+
* whose next version is too. 28 scoped this to recording the package,
|
|
25
|
+
* "the only thing that makes the question answerable later"; answering it
|
|
26
|
+
* properly wants an integrity identifier the plugin host does not have
|
|
27
|
+
* yet, and belongs with whatever introduces one. Until then the operator's
|
|
28
|
+
* remedy is `stratus grants revoke` after an upgrade they distrust, which
|
|
29
|
+
* is why the listing shows the package it was granted from.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Whether a grant covers a call to `tool` as contributed by `contributor`
|
|
33
|
+
* right now. Both halves must agree: the same name from a different
|
|
34
|
+
* package is a different tool, and so is the same name from no package.
|
|
35
|
+
*/
|
|
36
|
+
export const matchesToolGrant = (tool, contributor, grant) => grant.tool === tool && grant.package === contributor;
|
|
37
|
+
/** The first grant covering this call, if any covers it. */
|
|
38
|
+
export const findMatchingToolGrant = (tool, contributor, grants) => grants.find((grant) => matchesToolGrant(tool, contributor, grant));
|
|
39
|
+
/** One line an operator can read in a log or a grant listing. */
|
|
40
|
+
export const describeToolGrant = (grant) => grant.package === undefined ? grant.tool : `${grant.tool} (${grant.package})`;
|
|
41
|
+
/**
|
|
42
|
+
* Whether two grants are the same permission. One per tool per agent: a
|
|
43
|
+
* second "always" on a tool already granted from another package replaces
|
|
44
|
+
* the first rather than sitting beside it, because the operator answered
|
|
45
|
+
* about the tool they were shown, and two rows for one name would leave a
|
|
46
|
+
* listing that cannot say which one applies.
|
|
47
|
+
*/
|
|
48
|
+
export const sameToolGrant = (left, right) => left.tool === right.tool;
|
|
49
|
+
/**
|
|
50
|
+
* Read one grant out of a whitelist file, or refuse it. A row with no
|
|
51
|
+
* tool name grants nothing; a row with no timestamp is kept, dated to
|
|
52
|
+
* the epoch rather than invented, so a hand-written grant is still a grant
|
|
53
|
+
* and still visibly one nobody answered at a prompt.
|
|
54
|
+
*/
|
|
55
|
+
export const parseToolGrant = (raw) => {
|
|
56
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const source = raw;
|
|
60
|
+
if (typeof source.tool !== 'string' || source.tool.length === 0) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
tool: source.tool,
|
|
65
|
+
...(typeof source.package === 'string' && source.package.length > 0 ? { package: source.package } : {}),
|
|
66
|
+
grantedAt: typeof source.grantedAt === 'string' ? source.grantedAt : new Date(0).toISOString(),
|
|
67
|
+
...(typeof source.grantedBy === 'string' && source.grantedBy.length > 0 ? { grantedBy: source.grantedBy } : {}),
|
|
68
|
+
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G,GAA8B,CAAC;IAC9C,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,CAAC,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvG,SAAS,EAAE,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;QAC9F,GAAG,CAAC,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChH,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalAnswer, ApprovalPolicy, Session, Tool, ToolCall, ToolRisk } from '@stratusagent/core';
|
|
1
|
+
import type { AlwaysMeans, ApprovalAnswer, ApprovalOutcome, ApprovalPolicy, Session, Tool, ToolCall, ToolRisk } from '@stratusagent/core';
|
|
2
2
|
/**
|
|
3
3
|
* Re-exported, not re-implemented: the risk ordering moved to the kernel
|
|
4
4
|
* when the plugin loader became its second consumer, and this package
|
|
@@ -7,10 +7,12 @@ import type { ApprovalAnswer, ApprovalPolicy, Session, Tool, ToolCall, ToolRisk
|
|
|
7
7
|
export { atLeastAsRisky } from '@stratusagent/core';
|
|
8
8
|
import { type CommandScope } from './commands.ts';
|
|
9
9
|
import { type OriginScope } from './origins.ts';
|
|
10
|
-
import { type
|
|
10
|
+
import { type ToolGrant } from './grants.ts';
|
|
11
|
+
import { type CommandWhitelistStore, type OriginWhitelistStore, type ToolGrantStore } from './whitelist.ts';
|
|
11
12
|
export { analyzeCommand, describeCommandScope, findMatchingScope, matchesScope, normalizeCommandScope, parseCommandScope, sameScope, SAFE_COMMAND_SCOPES, type CommandAnalysis, type CommandScope, } from './commands.ts';
|
|
12
13
|
export { describeOriginScope, findMatchingOriginScope, matchesOriginScope, originScopeFor, parseOriginScope, sameOriginScope, type OriginScope, } from './origins.ts';
|
|
13
|
-
export {
|
|
14
|
+
export { describeToolGrant, findMatchingToolGrant, matchesToolGrant, parseToolGrant, sameToolGrant, type ToolGrant, } from './grants.ts';
|
|
15
|
+
export { createFileCommandWhitelist, describeAgentGrants, whitelistPathFor, WhitelistUnreadableError, type AgentGrants, type AgentGrantsListing, type AgentGrantStore, type CommandWhitelistStore, type OriginWhitelistStore, type ToolGrantStore, } from './whitelist.ts';
|
|
14
16
|
/**
|
|
15
17
|
* How a policy reaches a human — or admits that it cannot.
|
|
16
18
|
*
|
|
@@ -57,10 +59,19 @@ export interface ApprovalRequest {
|
|
|
57
59
|
* create is the same defect as a record understating one it did.
|
|
58
60
|
*
|
|
59
61
|
* Absent is the ordinary case, where `always` remembers *something* —
|
|
60
|
-
*
|
|
61
|
-
* wording for that case has to cover both.
|
|
62
|
+
* and `always` below says what.
|
|
62
63
|
*/
|
|
63
64
|
oneShot?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* What `always` would remember, when it would remember something. The
|
|
67
|
+
* other half of `oneShot`: that one says a grant will not be created,
|
|
68
|
+
* this one says which kind will — so a transport can tell an approver in
|
|
69
|
+
* advance whether they are widening this session or this agent, and
|
|
70
|
+
* report afterwards what was actually granted rather than hedging
|
|
71
|
+
* between lifetimes it could not distinguish. Absent exactly when
|
|
72
|
+
* `oneShot` is true.
|
|
73
|
+
*/
|
|
74
|
+
always?: AlwaysMeans;
|
|
64
75
|
/**
|
|
65
76
|
* When this call first parked, if it is being re-asked after a restart.
|
|
66
77
|
* A transport that imposes a deadline measures from here rather than
|
|
@@ -80,8 +91,12 @@ export interface ApprovalRequest {
|
|
|
80
91
|
* whatever is carrying it gives up. It never rejects for a timeout: an
|
|
81
92
|
* expired request is a `deny`, which is a decision the turn can continue
|
|
82
93
|
* from, not an error that fails it.
|
|
94
|
+
*
|
|
95
|
+
* A transport that knows who answered settles with an `ApprovalOutcome`
|
|
96
|
+
* so a standing grant can record them; one that does not settles with the
|
|
97
|
+
* bare answer, and both mean the same thing to the policy.
|
|
83
98
|
*/
|
|
84
|
-
export type ApprovalRequester = (request: ApprovalRequest) => Promise<ApprovalAnswer>;
|
|
99
|
+
export type ApprovalRequester = (request: ApprovalRequest) => Promise<ApprovalAnswer | ApprovalOutcome>;
|
|
85
100
|
/** Why a call was allowed or refused, for logs and events. */
|
|
86
101
|
export interface PermissionDecision {
|
|
87
102
|
allowed: boolean;
|
|
@@ -126,6 +141,15 @@ export interface PermissionDecision {
|
|
|
126
141
|
* the origin and not at a URL.
|
|
127
142
|
*/
|
|
128
143
|
origin?: string;
|
|
144
|
+
/**
|
|
145
|
+
* The standing grant this call ran under, when one did. The daemon logs
|
|
146
|
+
* it: a call that ran because an operator once said "always" for this
|
|
147
|
+
* agent is exactly what someone reconstructing an unattended run needs
|
|
148
|
+
* to tell apart from one that ran because the tool was `safe`, and
|
|
149
|
+
* `reason` alone is prose. Absent on every other decision, including
|
|
150
|
+
* the one that created the grant — that one ran on a human's answer.
|
|
151
|
+
*/
|
|
152
|
+
grant?: ToolGrant;
|
|
129
153
|
}
|
|
130
154
|
export interface PermissionPolicyOptions {
|
|
131
155
|
mode: PermissionMode;
|
|
@@ -164,6 +188,37 @@ export interface PermissionPolicyOptions {
|
|
|
164
188
|
* host with nowhere to keep a grant.
|
|
165
189
|
*/
|
|
166
190
|
origins?: OriginScopeOptions;
|
|
191
|
+
/**
|
|
192
|
+
* The standing-grant engine, for a gated tool that names no scope at
|
|
193
|
+
* all (no `commandFor`, `destinationFor`, or `originFor`). Omitted, an
|
|
194
|
+
* "always" on such a tool still holds for this process, per agent — the
|
|
195
|
+
* same bargain a policy with no whitelist store makes — and nothing
|
|
196
|
+
* survives a restart, which is what a host with nowhere to keep a grant
|
|
197
|
+
* is honestly offering.
|
|
198
|
+
*/
|
|
199
|
+
grants?: ToolGrantOptions;
|
|
200
|
+
}
|
|
201
|
+
export interface ToolGrantOptions {
|
|
202
|
+
/** Where "always allow" persists a tool grant, and where one is read back. */
|
|
203
|
+
store?: ToolGrantStore;
|
|
204
|
+
/**
|
|
205
|
+
* Which plugin package contributes a tool right now, or undefined for
|
|
206
|
+
* a kernel tool. Recorded on the grant when it is made and compared
|
|
207
|
+
* when it is used, so a grant follows the tool the operator was shown
|
|
208
|
+
* and not a later tool of the same name (`grants.ts` says why). Omitted,
|
|
209
|
+
* every tool reads as the kernel's, which matches every grant recorded
|
|
210
|
+
* the same way — the honest answer for a host with no plugin loader.
|
|
211
|
+
*/
|
|
212
|
+
contributorOf?: (toolName: string) => string | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Called when a grant is persisted, for the same reason the scope
|
|
215
|
+
* engines report theirs: this is the decision that widens what runs
|
|
216
|
+
* unattended for every future session.
|
|
217
|
+
*/
|
|
218
|
+
onGranted?: (event: {
|
|
219
|
+
agentId: string;
|
|
220
|
+
grant: ToolGrant;
|
|
221
|
+
}) => void;
|
|
167
222
|
}
|
|
168
223
|
export interface DestinationScopeOptions {
|
|
169
224
|
/**
|
|
@@ -232,6 +287,13 @@ export interface OriginScopeOptions {
|
|
|
232
287
|
* same two grant tiers over a different vocabulary — the site the page is
|
|
233
288
|
* on, rather than the command the call would run. It has no third tier,
|
|
234
289
|
* because there is no origin that is safe to click on out of the box.
|
|
290
|
+
*
|
|
291
|
+
* A gated tool that names no scope at all resolves through a *standing
|
|
292
|
+
* grant*: the tool itself, per agent, durable until revoked, over the same
|
|
293
|
+
* two tiers again (this process, then the file). It is what "always allow"
|
|
294
|
+
* creates for such a tool on every surface, so one word has one lifetime —
|
|
295
|
+
* and it is the only path a scope-less gated tool has to running in
|
|
296
|
+
* `headless`, which is the mode every installed service runs in.
|
|
235
297
|
*/
|
|
236
298
|
export declare const createPermissionPolicy: (options: PermissionPolicyOptions) => ApprovalPolicy;
|
|
237
299
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,cAAc,EAGd,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EAEd,eAAe,EACf,cAAc,EAGd,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,qBAAqB,EAC1B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;OAOG;IACH,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACzD;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACrC,yEAAyE;IACzE,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/E;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9E;AAyND;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,uBAAuB,KAAG,cAihBzE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
export { atLeastAsRisky } from '@stratusagent/core';
|
|
7
7
|
import { analyzeCommand, describeCommandScope, findMatchingScope, normalizeCommandScope, SAFE_COMMAND_SCOPES, } from "./commands.js";
|
|
8
8
|
import { describeOriginScope, findMatchingOriginScope, originScopeFor, } from "./origins.js";
|
|
9
|
+
import { describeToolGrant, findMatchingToolGrant, } from "./grants.js";
|
|
9
10
|
import { WhitelistUnreadableError, } from "./whitelist.js";
|
|
10
11
|
export { analyzeCommand, describeCommandScope, findMatchingScope, matchesScope, normalizeCommandScope, parseCommandScope, sameScope, SAFE_COMMAND_SCOPES, } from "./commands.js";
|
|
11
12
|
export { describeOriginScope, findMatchingOriginScope, matchesOriginScope, originScopeFor, parseOriginScope, sameOriginScope, } from "./origins.js";
|
|
12
|
-
export {
|
|
13
|
+
export { describeToolGrant, findMatchingToolGrant, matchesToolGrant, parseToolGrant, sameToolGrant, } from "./grants.js";
|
|
14
|
+
export { createFileCommandWhitelist, describeAgentGrants, whitelistPathFor, WhitelistUnreadableError, } from "./whitelist.js";
|
|
13
15
|
const YES = new Set(['y', 'yes', 'always', 'a']);
|
|
14
16
|
const ALWAYS = new Set(['always', 'a']);
|
|
15
17
|
const ABORTED = Symbol('aborted');
|
|
@@ -53,6 +55,13 @@ const untilAborted = async (work, signal) => {
|
|
|
53
55
|
* answer useless on the next one, and remembering it fleet-wide would make
|
|
54
56
|
* one impatient yes permanent.
|
|
55
57
|
*
|
|
58
|
+
* Since standing grants landed this tier serves one shape only: a tool
|
|
59
|
+
* judged by destination (`message.send`) answered outside a schedule. A
|
|
60
|
+
* durable tool grant there would be a standing yes to every destination,
|
|
61
|
+
* and no per-destination grant exists yet, so the session is the widest
|
|
62
|
+
* honest lifetime. Every other unscoped gated tool goes to the standing
|
|
63
|
+
* grant below.
|
|
64
|
+
*
|
|
56
65
|
* Joined on an escaped NUL rather than a space or a colon, because both of
|
|
57
66
|
* those occur in real ids — a channel session id is
|
|
58
67
|
* `slack:ava:T01ABCDEF:C07GHIJKL:…` — and a separator that can appear in
|
|
@@ -158,9 +167,9 @@ alwaysMeans) => {
|
|
|
158
167
|
}
|
|
159
168
|
const answer = response.trim().toLowerCase();
|
|
160
169
|
if (!YES.has(answer)) {
|
|
161
|
-
return 'deny';
|
|
170
|
+
return { answer: 'deny' };
|
|
162
171
|
}
|
|
163
|
-
return ALWAYS.has(answer) ? 'always' : 'once';
|
|
172
|
+
return { answer: ALWAYS.has(answer) ? 'always' : 'once' };
|
|
164
173
|
};
|
|
165
174
|
/**
|
|
166
175
|
* Puts the question to someone reachable through a channel. Unlike the
|
|
@@ -173,7 +182,7 @@ alwaysMeans) => {
|
|
|
173
182
|
* its call was not approved and carry on, not crash on the machinery that
|
|
174
183
|
* was supposed to ask.
|
|
175
184
|
*/
|
|
176
|
-
const awaitRemote = async (context, request, origin, oneShot) => {
|
|
185
|
+
const awaitRemote = async (context, request, origin, oneShot, always) => {
|
|
177
186
|
const pending = request({
|
|
178
187
|
session: context.session,
|
|
179
188
|
call: context.call,
|
|
@@ -181,9 +190,10 @@ const awaitRemote = async (context, request, origin, oneShot) => {
|
|
|
181
190
|
risk: context.risk,
|
|
182
191
|
...(origin !== undefined ? { origin } : {}),
|
|
183
192
|
...(oneShot ? { oneShot } : {}),
|
|
193
|
+
...(always !== undefined ? { always } : {}),
|
|
184
194
|
...(context.parkedAt ? { parkedAt: context.parkedAt } : {}),
|
|
185
195
|
...(context.signal ? { signal: context.signal } : {}),
|
|
186
|
-
}).then((
|
|
196
|
+
}).then((outcome) => (typeof outcome === 'string' ? { answer: outcome } : outcome), () => ({ answer: 'deny' }));
|
|
187
197
|
return untilAborted(pending, context.signal);
|
|
188
198
|
};
|
|
189
199
|
/**
|
|
@@ -202,9 +212,16 @@ const awaitRemote = async (context, request, origin, oneShot) => {
|
|
|
202
212
|
* same two grant tiers over a different vocabulary — the site the page is
|
|
203
213
|
* on, rather than the command the call would run. It has no third tier,
|
|
204
214
|
* because there is no origin that is safe to click on out of the box.
|
|
215
|
+
*
|
|
216
|
+
* A gated tool that names no scope at all resolves through a *standing
|
|
217
|
+
* grant*: the tool itself, per agent, durable until revoked, over the same
|
|
218
|
+
* two tiers again (this process, then the file). It is what "always allow"
|
|
219
|
+
* creates for such a tool on every surface, so one word has one lifetime —
|
|
220
|
+
* and it is the only path a scope-less gated tool has to running in
|
|
221
|
+
* `headless`, which is the mode every installed service runs in.
|
|
205
222
|
*/
|
|
206
223
|
export const createPermissionPolicy = (options) => {
|
|
207
|
-
const { mode, ask, request, onDecision, commands, destinations, origins } = options;
|
|
224
|
+
const { mode, ask, request, onDecision, commands, destinations, origins, grants } = options;
|
|
208
225
|
if (mode === 'interactive' && !ask) {
|
|
209
226
|
throw new Error('interactive permission mode needs an `ask` function to reach a human.');
|
|
210
227
|
}
|
|
@@ -216,13 +233,22 @@ export const createPermissionPolicy = (options) => {
|
|
|
216
233
|
}
|
|
217
234
|
const alwaysAllowed = new Set();
|
|
218
235
|
// Tier one of the three: scopes granted with "always" during this
|
|
219
|
-
// process's life
|
|
220
|
-
// with no whitelist store still has to remember an answer
|
|
221
|
-
// the session, which is what `always` means at a
|
|
236
|
+
// process's life, for a policy that has nowhere else to put them. A
|
|
237
|
+
// policy built with no whitelist store still has to remember an answer
|
|
238
|
+
// for the rest of the session, which is what `always` means at a
|
|
239
|
+
// terminal; so does one whose store refused the write. A grant the store
|
|
240
|
+
// *took* is not kept here as well: the store is then the one place a
|
|
241
|
+
// grant lives, so revoking it there is the next call's answer, rather
|
|
242
|
+
// than a promise the daemon keeps only until its next restart.
|
|
222
243
|
const sessionScopes = new Map();
|
|
223
244
|
/** The same tier for origins, and for the same reason. */
|
|
224
245
|
const sessionOrigins = new Map();
|
|
225
|
-
|
|
246
|
+
/** And for standing tool grants. */
|
|
247
|
+
const processGrants = new Map();
|
|
248
|
+
const rememberForProcess = (tier, agentId, grant) => {
|
|
249
|
+
tier.set(agentId, [...(tier.get(agentId) ?? []), grant]);
|
|
250
|
+
};
|
|
251
|
+
const report = (context, allowed, reason, command, destination, origin, grant) => {
|
|
226
252
|
onDecision?.({
|
|
227
253
|
allowed,
|
|
228
254
|
mode,
|
|
@@ -234,6 +260,7 @@ export const createPermissionPolicy = (options) => {
|
|
|
234
260
|
...(command === undefined ? {} : { command }),
|
|
235
261
|
...(destination === undefined ? {} : { destination }),
|
|
236
262
|
...(origin === undefined ? {} : { origin }),
|
|
263
|
+
...(grant === undefined ? {} : { grant }),
|
|
237
264
|
});
|
|
238
265
|
return allowed;
|
|
239
266
|
};
|
|
@@ -277,6 +304,16 @@ export const createPermissionPolicy = (options) => {
|
|
|
277
304
|
// with neither scope consulted. A tool that asked to be judged by a
|
|
278
305
|
// scope does not get to be judged by nothing instead.
|
|
279
306
|
const multiplyScoped = scopeHooks > 1;
|
|
307
|
+
// No scope hook at all: the tool's risk lives in its identity, which
|
|
308
|
+
// is the one shape a grant on the whole tool is honest for. This is
|
|
309
|
+
// what makes the `commandFor` / `originFor` exclusion structural —
|
|
310
|
+
// a tool that offers a scope is never `unscoped`, so it can never
|
|
311
|
+
// reach the standing grant below, whatever a refactor does to the
|
|
312
|
+
// order of the checks after this line.
|
|
313
|
+
const unscoped = scopeHooks === 0;
|
|
314
|
+
// Who contributes this tool right now, for matching a grant and for
|
|
315
|
+
// recording one. Resolved once so both halves see the same answer.
|
|
316
|
+
const contributor = grants?.contributorOf?.(call.toolName);
|
|
280
317
|
const command = risk === 'gated' && singlyScoped
|
|
281
318
|
? context.tool.commandFor?.(call.input)
|
|
282
319
|
: undefined;
|
|
@@ -340,6 +377,19 @@ export const createPermissionPolicy = (options) => {
|
|
|
340
377
|
}
|
|
341
378
|
}
|
|
342
379
|
}
|
|
380
|
+
else if (risk === 'gated' && unscoped) {
|
|
381
|
+
// The standing grant: this process's answers first, then the file.
|
|
382
|
+
// Read per call, never cached here, so a revocation through the
|
|
383
|
+
// store is the next call's answer — the reason a revoke needs no
|
|
384
|
+
// restart.
|
|
385
|
+
const standing = findMatchingToolGrant(call.toolName, contributor, [
|
|
386
|
+
...(processGrants.get(session.agent.id) ?? []),
|
|
387
|
+
...(grants?.store ? await grants.store.toolGrantsFor(session.agent.id) : []),
|
|
388
|
+
]);
|
|
389
|
+
if (standing) {
|
|
390
|
+
return report(context, true, `${call.toolName} ran under a standing grant for ${session.agent.id}`, undefined, undefined, undefined, standing);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
343
393
|
else if (risk !== 'dangerous'
|
|
344
394
|
&& !scopedByOrigin
|
|
345
395
|
&& !multiplyScoped
|
|
@@ -406,6 +456,18 @@ export const createPermissionPolicy = (options) => {
|
|
|
406
456
|
|| multiplyScoped
|
|
407
457
|
|| (scopedByOrigin && origin === undefined)
|
|
408
458
|
|| (analysis !== undefined && commandScope === undefined);
|
|
459
|
+
// Which kind of grant `always` creates, as data for the transport and
|
|
460
|
+
// as words for the prompt — the same decision, made once, so the two
|
|
461
|
+
// surfaces cannot promise different lifetimes for the same answer.
|
|
462
|
+
const always = oneShot
|
|
463
|
+
? undefined
|
|
464
|
+
: command !== undefined
|
|
465
|
+
? 'scope'
|
|
466
|
+
: scopedByOrigin
|
|
467
|
+
? 'origin'
|
|
468
|
+
: unscoped
|
|
469
|
+
? 'tool'
|
|
470
|
+
: 'session';
|
|
409
471
|
const alwaysMeans = oneShot
|
|
410
472
|
? risk === 'dangerous'
|
|
411
473
|
? 'not remembered — a dangerous tool asks every time'
|
|
@@ -414,17 +476,20 @@ export const createPermissionPolicy = (options) => {
|
|
|
414
476
|
: analysis !== undefined
|
|
415
477
|
? 'not remembered — this command cannot be reduced to a scope'
|
|
416
478
|
: 'not remembered — there is no page to grant'
|
|
417
|
-
:
|
|
479
|
+
: always === 'scope'
|
|
418
480
|
? 'always this scope'
|
|
419
|
-
:
|
|
481
|
+
: always === 'origin'
|
|
420
482
|
? 'always this site'
|
|
421
|
-
:
|
|
422
|
-
|
|
423
|
-
|
|
483
|
+
: always === 'tool'
|
|
484
|
+
? `always for ${session.agent.name}, until revoked`
|
|
485
|
+
: 'always this session';
|
|
486
|
+
const outcome = mode === 'remote'
|
|
487
|
+
? await awaitRemote(context, request, origin, oneShot, always)
|
|
424
488
|
: await awaitPrompt(context, ask, command, origin, alwaysMeans);
|
|
425
|
-
if (
|
|
489
|
+
if (outcome === ABORTED) {
|
|
426
490
|
return report(context, false, `${call.toolName} was cancelled while awaiting approval`);
|
|
427
491
|
}
|
|
492
|
+
const { answer, actor } = outcome;
|
|
428
493
|
if (answer === 'deny') {
|
|
429
494
|
return report(context, false, mode === 'remote'
|
|
430
495
|
? `${call.toolName} was not approved`
|
|
@@ -478,7 +543,6 @@ export const createPermissionPolicy = (options) => {
|
|
|
478
543
|
// which is the grant this whole engine replaced.
|
|
479
544
|
return allowUnlessMoved(`${call.toolName} was approved once; there is no page origin to remember, so it will ask again`);
|
|
480
545
|
}
|
|
481
|
-
sessionOrigins.set(session.agent.id, [...(sessionOrigins.get(session.agent.id) ?? []), originScope]);
|
|
482
546
|
if (origins?.whitelist) {
|
|
483
547
|
try {
|
|
484
548
|
await origins.whitelist.rememberOrigin(session.agent.id, originScope);
|
|
@@ -490,10 +554,14 @@ export const createPermissionPolicy = (options) => {
|
|
|
490
554
|
// Same bargain the command half makes: the answer holds for
|
|
491
555
|
// this process, and the file that would carry it past a
|
|
492
556
|
// restart is not written over grants nobody can read.
|
|
557
|
+
rememberForProcess(sessionOrigins, session.agent.id, originScope);
|
|
493
558
|
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
559
|
}
|
|
495
560
|
origins.onScopeRemembered?.({ agentId: session.agent.id, scope: originScope });
|
|
496
561
|
}
|
|
562
|
+
else {
|
|
563
|
+
rememberForProcess(sessionOrigins, session.agent.id, originScope);
|
|
564
|
+
}
|
|
497
565
|
return allowUnlessMoved(`${call.toolName} was approved, and ${describeOriginScope(originScope)} is now acted on without asking`);
|
|
498
566
|
}
|
|
499
567
|
const scope = commandScope;
|
|
@@ -510,7 +578,6 @@ export const createPermissionPolicy = (options) => {
|
|
|
510
578
|
// the bare executable (a shell). `git push origin main` persists
|
|
511
579
|
// `git push` minus its destructive forms, so `git push --force`
|
|
512
580
|
// asks again.
|
|
513
|
-
sessionScopes.set(session.agent.id, [...(sessionScopes.get(session.agent.id) ?? []), scope]);
|
|
514
581
|
if (commands?.whitelist) {
|
|
515
582
|
try {
|
|
516
583
|
await commands.whitelist.remember(session.agent.id, scope);
|
|
@@ -524,10 +591,14 @@ export const createPermissionPolicy = (options) => {
|
|
|
524
591
|
// "always" means without a file — and the file that would
|
|
525
592
|
// carry it past a restart is not written over grants nobody
|
|
526
593
|
// can read. The line says both.
|
|
594
|
+
rememberForProcess(sessionScopes, session.agent.id, scope);
|
|
527
595
|
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
596
|
}
|
|
529
597
|
commands.onScopeRemembered?.({ agentId: session.agent.id, scope });
|
|
530
598
|
}
|
|
599
|
+
else {
|
|
600
|
+
rememberForProcess(sessionScopes, session.agent.id, scope);
|
|
601
|
+
}
|
|
531
602
|
return allowUnlessMoved(`${call.toolName} was approved, and "${describeCommandScope(scope)}" now runs without asking`, command);
|
|
532
603
|
}
|
|
533
604
|
if (risk === 'dangerous') {
|
|
@@ -547,6 +618,39 @@ export const createPermissionPolicy = (options) => {
|
|
|
547
618
|
// nobody would choose deliberately.
|
|
548
619
|
return allowUnlessMoved(`${call.toolName} was approved once; it names more than one kind of scope, so it will ask again`);
|
|
549
620
|
}
|
|
621
|
+
if (unscoped) {
|
|
622
|
+
// The standing grant. Recorded with the tool's contributor and
|
|
623
|
+
// with who answered, because both are unanswerable afterwards from
|
|
624
|
+
// anything else: a listing has to say which package's `web.fetch`
|
|
625
|
+
// was granted, and by whom. Kept for this process whatever the
|
|
626
|
+
// store does, which is what "always" means without a file.
|
|
627
|
+
const grant = {
|
|
628
|
+
tool: call.toolName,
|
|
629
|
+
...(contributor !== undefined ? { package: contributor } : {}),
|
|
630
|
+
grantedAt: new Date().toISOString(),
|
|
631
|
+
...(actor !== undefined ? { grantedBy: actor } : {}),
|
|
632
|
+
};
|
|
633
|
+
if (grants?.store) {
|
|
634
|
+
try {
|
|
635
|
+
await grants.store.rememberTool(session.agent.id, grant);
|
|
636
|
+
}
|
|
637
|
+
catch (error) {
|
|
638
|
+
if (!(error instanceof WhitelistUnreadableError)) {
|
|
639
|
+
throw error;
|
|
640
|
+
}
|
|
641
|
+
// The same bargain as the two scope kinds: the answer holds
|
|
642
|
+
// for this process, and the file is not written over grants
|
|
643
|
+
// nobody can read.
|
|
644
|
+
rememberForProcess(processGrants, session.agent.id, grant);
|
|
645
|
+
return allowUnlessMoved(`${call.toolName} was approved, and runs without asking for ${session.agent.id} until the daemon restarts — not saved: ${error.message}`);
|
|
646
|
+
}
|
|
647
|
+
grants.onGranted?.({ agentId: session.agent.id, grant });
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
rememberForProcess(processGrants, session.agent.id, grant);
|
|
651
|
+
}
|
|
652
|
+
return allowUnlessMoved(`${call.toolName} was approved, and ${describeToolGrant(grant)} now runs without asking for ${session.agent.id} until revoked`);
|
|
653
|
+
}
|
|
550
654
|
alwaysAllowed.add(sessionKey(session.id, call.toolName));
|
|
551
655
|
return allowUnlessMoved(`${call.toolName} was approved for the rest of this session`);
|
|
552
656
|
}
|
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;AACvB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,GAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,GAGzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,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kB,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;4BAC3D,OAAO,gBAAgB,CACrB,GAAG,IAAI,CAAC,QAAQ,8CAA8C,OAAO,CAAC,KAAK,CAAC,EAAE,2CAA2C,KAAK,CAAC,OAAO,EAAE,CACzI,CAAC;wBACJ,CAAC;wBACD,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;oBAC3D,CAAC;yBAAM,CAAC;wBACN,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;oBAC7D,CAAC;oBACD,OAAO,gBAAgB,CACrB,GAAG,IAAI,CAAC,QAAQ,sBAAsB,iBAAiB,CAAC,KAAK,CAAC,gCAAgC,OAAO,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAC/H,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"}
|
package/dist/whitelist.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CommandScope } from './commands.ts';
|
|
2
|
+
import { type ToolGrant } from './grants.ts';
|
|
2
3
|
import { type OriginScope } from './origins.ts';
|
|
3
4
|
/**
|
|
4
5
|
* What one agent may run unattended, beyond the built-in safe list.
|
|
@@ -25,6 +26,66 @@ export interface OriginWhitelistStore {
|
|
|
25
26
|
originsFor(agentId: string): Promise<OriginScope[]>;
|
|
26
27
|
rememberOrigin(agentId: string, scope: OriginScope): Promise<void>;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Which tools one agent may run unattended by name — the third answer in
|
|
31
|
+
* the same file, for a gated tool that names no scope at all.
|
|
32
|
+
*
|
|
33
|
+
* Its own interface for the same reason the origin half is: a host that
|
|
34
|
+
* judges commands need not keep standing grants, and the engine treats a
|
|
35
|
+
* policy built without this the way it treats one built without a
|
|
36
|
+
* whitelist — the answer holds for the process, and `headless` cannot use
|
|
37
|
+
* it, because `headless` never asks anyone.
|
|
38
|
+
*/
|
|
39
|
+
export interface ToolGrantStore {
|
|
40
|
+
toolGrantsFor(agentId: string): Promise<ToolGrant[]>;
|
|
41
|
+
rememberTool(agentId: string, grant: ToolGrant): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/** Everything one agent may do unattended beyond the built-in safe list, as one read. */
|
|
44
|
+
export interface AgentGrants {
|
|
45
|
+
scopes: CommandScope[];
|
|
46
|
+
origins: OriginScope[];
|
|
47
|
+
tools: ToolGrant[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One agent's grants as an operator reads them — every kind, each with the
|
|
51
|
+
* line a listing shows. The one renderer for `stratus grants` and for
|
|
52
|
+
* `GET /agents/:id/grants`, so a scope revokes by exactly the string both
|
|
53
|
+
* of them print (`forgetScope` takes it).
|
|
54
|
+
*/
|
|
55
|
+
export interface AgentGrantsListing {
|
|
56
|
+
scopes: Array<{
|
|
57
|
+
description: string;
|
|
58
|
+
scope: CommandScope;
|
|
59
|
+
}>;
|
|
60
|
+
origins: Array<{
|
|
61
|
+
origin: string;
|
|
62
|
+
}>;
|
|
63
|
+
tools: ToolGrant[];
|
|
64
|
+
}
|
|
65
|
+
export declare const describeAgentGrants: (grants: AgentGrants) => AgentGrantsListing;
|
|
66
|
+
/**
|
|
67
|
+
* The operator's view of one agent's file: all three kinds together, and
|
|
68
|
+
* the way to take one back.
|
|
69
|
+
*
|
|
70
|
+
* Revocation lives here and not on the three engine-facing interfaces
|
|
71
|
+
* above, because the engine never revokes — an operator does, through
|
|
72
|
+
* `stratus grants revoke` or the control API — and a host implementing
|
|
73
|
+
* only the half the engine reads should not have to implement the half it
|
|
74
|
+
* does not. Each `forget` answers whether anything was removed, and a
|
|
75
|
+
* removal is visible to the next call on this store at once: a revoked
|
|
76
|
+
* grant that kept working until a restart would be a ratchet with a delay.
|
|
77
|
+
*/
|
|
78
|
+
export interface AgentGrantStore extends CommandWhitelistStore, OriginWhitelistStore, ToolGrantStore {
|
|
79
|
+
grantsFor(agentId: string): Promise<AgentGrants>;
|
|
80
|
+
/**
|
|
81
|
+
* By the line the listing shows (`describeCommandScope`), since that is
|
|
82
|
+
* what an operator has in front of them. Two stored scopes reading the
|
|
83
|
+
* same are the same permission to a person, and both go.
|
|
84
|
+
*/
|
|
85
|
+
forgetScope(agentId: string, description: string): Promise<boolean>;
|
|
86
|
+
forgetOrigin(agentId: string, origin: string): Promise<boolean>;
|
|
87
|
+
forgetTool(agentId: string, tool: string): Promise<boolean>;
|
|
88
|
+
}
|
|
28
89
|
/** `<id>.whitelist.json`, beside the agent's soul in ~/.stratus/agents. */
|
|
29
90
|
export declare const whitelistPathFor: (directory: string, agentId: string) => string;
|
|
30
91
|
/**
|
|
@@ -36,8 +97,9 @@ export declare class WhitelistUnreadableError extends Error {
|
|
|
36
97
|
constructor(file: string, reason: string);
|
|
37
98
|
}
|
|
38
99
|
/**
|
|
39
|
-
* The persistent tier of the scope resolution, on disk —
|
|
40
|
-
* grant, in one file per agent
|
|
100
|
+
* The persistent tier of the scope resolution, on disk — every kind of
|
|
101
|
+
* grant, in one file per agent: command scopes, origins, and the standing
|
|
102
|
+
* tool grants an operator's "always allow" answers with.
|
|
41
103
|
*
|
|
42
104
|
* Written `0600` with an explicit `chmod`, like every other file in
|
|
43
105
|
* `~/.stratus` that decides something: this one lists commands that run,
|
|
@@ -50,7 +112,10 @@ export declare class WhitelistUnreadableError extends Error {
|
|
|
50
112
|
* Scopes are cached in memory once read. A daemon therefore does not notice
|
|
51
113
|
* a hand-edited file until it restarts — which is the right way round for a
|
|
52
114
|
* file whose edits grant permissions, and the same bargain the credential
|
|
53
|
-
* store makes.
|
|
115
|
+
* store makes. It is also why revocation is a method here rather than a
|
|
116
|
+
* file edit: a `forget` through the daemon's own instance is the next
|
|
117
|
+
* decision's answer, and the control API and `stratus grants` reach it that
|
|
118
|
+
* way.
|
|
54
119
|
*/
|
|
55
120
|
export declare const createFileCommandWhitelist: (options: {
|
|
56
121
|
directory: string;
|
|
@@ -60,5 +125,5 @@ export declare const createFileCommandWhitelist: (options: {
|
|
|
60
125
|
* no line about it.
|
|
61
126
|
*/
|
|
62
127
|
warn?: (line: string) => void;
|
|
63
|
-
}) =>
|
|
128
|
+
}) => AgentGrantStore;
|
|
64
129
|
//# sourceMappingURL=whitelist.d.ts.map
|
package/dist/whitelist.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whitelist.d.ts","sourceRoot":"","sources":["../src/whitelist.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"whitelist.d.ts","sourceRoot":"","sources":["../src/whitelist.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsD,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,OAAO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,CAAC;IAChE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7D;AAoCD,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,EAAE,SAAS,MAAM,KAAG,MACnB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAIzC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,KAAG,eAyNH,CAAC"}
|
package/dist/whitelist.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { chmod, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { parseCommandScope, sameScope } from "./commands.js";
|
|
3
|
+
import { describeCommandScope, parseCommandScope, sameScope } from "./commands.js";
|
|
4
|
+
import { parseToolGrant, sameToolGrant } from "./grants.js";
|
|
4
5
|
import { parseOriginScope, sameOriginScope } from "./origins.js";
|
|
6
|
+
export const describeAgentGrants = (grants) => ({
|
|
7
|
+
scopes: grants.scopes.map((scope) => ({ description: describeCommandScope(scope), scope })),
|
|
8
|
+
origins: grants.origins.map((scope) => ({ origin: scope.origin })),
|
|
9
|
+
tools: [...grants.tools],
|
|
10
|
+
});
|
|
5
11
|
const WHITELIST_VERSION = 1;
|
|
6
12
|
/** `<id>.whitelist.json`, beside the agent's soul in ~/.stratus/agents. */
|
|
7
13
|
export const whitelistPathFor = (directory, agentId) => path.join(directory, `${agentId}.whitelist.json`);
|
|
@@ -17,8 +23,9 @@ export class WhitelistUnreadableError extends Error {
|
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
|
-
* The persistent tier of the scope resolution, on disk —
|
|
21
|
-
* grant, in one file per agent
|
|
26
|
+
* The persistent tier of the scope resolution, on disk — every kind of
|
|
27
|
+
* grant, in one file per agent: command scopes, origins, and the standing
|
|
28
|
+
* tool grants an operator's "always allow" answers with.
|
|
22
29
|
*
|
|
23
30
|
* Written `0600` with an explicit `chmod`, like every other file in
|
|
24
31
|
* `~/.stratus` that decides something: this one lists commands that run,
|
|
@@ -31,7 +38,10 @@ export class WhitelistUnreadableError extends Error {
|
|
|
31
38
|
* Scopes are cached in memory once read. A daemon therefore does not notice
|
|
32
39
|
* a hand-edited file until it restarts — which is the right way round for a
|
|
33
40
|
* file whose edits grant permissions, and the same bargain the credential
|
|
34
|
-
* store makes.
|
|
41
|
+
* store makes. It is also why revocation is a method here rather than a
|
|
42
|
+
* file edit: a `forget` through the daemon's own instance is the next
|
|
43
|
+
* decision's answer, and the control API and `stratus grants` reach it that
|
|
44
|
+
* way.
|
|
35
45
|
*/
|
|
36
46
|
export const createFileCommandWhitelist = (options) => {
|
|
37
47
|
/**
|
|
@@ -59,6 +69,7 @@ export const createFileCommandWhitelist = (options) => {
|
|
|
59
69
|
const readFresh = async (agentId) => {
|
|
60
70
|
let scopes = [];
|
|
61
71
|
let origins = [];
|
|
72
|
+
let tools = [];
|
|
62
73
|
// The agent id is a validated invariant by the time it reaches any
|
|
63
74
|
// path join (see 03) — it is a single path segment or it was refused
|
|
64
75
|
// at the parse boundary, so this does not re-check it.
|
|
@@ -72,6 +83,9 @@ export const createFileCommandWhitelist = (options) => {
|
|
|
72
83
|
origins = Array.isArray(parsed.origins)
|
|
73
84
|
? parsed.origins.map(parseOriginScope).filter((scope) => scope !== undefined)
|
|
74
85
|
: [];
|
|
86
|
+
tools = Array.isArray(parsed.tools)
|
|
87
|
+
? parsed.tools.map(parseToolGrant).filter((grant) => grant !== undefined)
|
|
88
|
+
: [];
|
|
75
89
|
}
|
|
76
90
|
catch (error) {
|
|
77
91
|
// No whitelist means no stored scopes, and is not worth failing a
|
|
@@ -83,6 +97,7 @@ export const createFileCommandWhitelist = (options) => {
|
|
|
83
97
|
// every grant it held. So it is said once, and `remember` refuses.
|
|
84
98
|
scopes = [];
|
|
85
99
|
origins = [];
|
|
100
|
+
tools = [];
|
|
86
101
|
if (error.code !== 'ENOENT') {
|
|
87
102
|
const reason = error instanceof Error ? error.message : String(error);
|
|
88
103
|
unreadable.set(agentId, reason);
|
|
@@ -90,25 +105,36 @@ export const createFileCommandWhitelist = (options) => {
|
|
|
90
105
|
+ 'are not saved over it until it is fixed and the daemon restarted.');
|
|
91
106
|
}
|
|
92
107
|
}
|
|
93
|
-
return { scopes, origins };
|
|
108
|
+
return { scopes, origins, tools };
|
|
94
109
|
};
|
|
95
110
|
/**
|
|
96
|
-
*
|
|
97
|
-
* untouched. Persisting only the
|
|
98
|
-
*
|
|
99
|
-
*
|
|
111
|
+
* Every list, always — a write of one carries the others through
|
|
112
|
+
* untouched. Persisting only the kind that changed would drop the rest
|
|
113
|
+
* of a file this daemon had read and understood, which is the same data
|
|
114
|
+
* loss the unreadable-file guard above exists to prevent.
|
|
100
115
|
*/
|
|
101
116
|
const save = async (agentId, grants) => {
|
|
102
|
-
cache.set(agentId, Promise.resolve(grants));
|
|
103
117
|
await mkdir(options.directory, { recursive: true });
|
|
104
118
|
const file = {
|
|
105
119
|
version: WHITELIST_VERSION,
|
|
106
120
|
scopes: grants.scopes,
|
|
107
121
|
...(grants.origins.length > 0 ? { origins: grants.origins } : {}),
|
|
122
|
+
...(grants.tools.length > 0 ? { tools: grants.tools } : {}),
|
|
108
123
|
};
|
|
109
124
|
const target = whitelistPathFor(options.directory, agentId);
|
|
110
125
|
await writeFile(target, `${JSON.stringify(file, null, 2)}\n`, { mode: 0o600 });
|
|
111
126
|
await chmod(target, 0o600);
|
|
127
|
+
// The cache is updated only once the file holds the same thing, and the
|
|
128
|
+
// direction that matters is revocation. Updating it first meant a write
|
|
129
|
+
// that failed — a read-only mount, a full disk — still dropped the grant
|
|
130
|
+
// from the daemon's live view while leaving it in the file: the operator
|
|
131
|
+
// is told the revoke failed, the agent stops being able to act anyway,
|
|
132
|
+
// and the grant they thought they had removed comes back at the next
|
|
133
|
+
// restart. A grant that returns from the dead is the ratchet this whole
|
|
134
|
+
// step exists to prevent, so the cache follows the file rather than
|
|
135
|
+
// leading it. Writes are serialized per agent, so a reader mid-write
|
|
136
|
+
// sees the old grants, which is what the file still says.
|
|
137
|
+
cache.set(agentId, Promise.resolve(grants));
|
|
112
138
|
};
|
|
113
139
|
/**
|
|
114
140
|
* Read-modify-write runs one at a time per agent.
|
|
@@ -171,6 +197,60 @@ export const createFileCommandWhitelist = (options) => {
|
|
|
171
197
|
await save(agentId, { ...grants, origins: [...grants.origins, scope] });
|
|
172
198
|
});
|
|
173
199
|
},
|
|
200
|
+
async toolGrantsFor(agentId) {
|
|
201
|
+
return [...(await read(agentId)).tools];
|
|
202
|
+
},
|
|
203
|
+
async rememberTool(agentId, grant) {
|
|
204
|
+
return serialized(agentId, async () => {
|
|
205
|
+
const grants = await read(agentId);
|
|
206
|
+
refuseIfUnreadable(agentId);
|
|
207
|
+
// Replaces rather than skips: the new row carries the package the
|
|
208
|
+
// operator was just shown, and a stale row for the same name would
|
|
209
|
+
// otherwise shadow it in the listing. See `sameToolGrant`.
|
|
210
|
+
const kept = grants.tools.filter((existing) => !sameToolGrant(existing, grant));
|
|
211
|
+
await save(agentId, { ...grants, tools: [...kept, grant] });
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
async grantsFor(agentId) {
|
|
215
|
+
const grants = await read(agentId);
|
|
216
|
+
return { scopes: [...grants.scopes], origins: [...grants.origins], tools: [...grants.tools] };
|
|
217
|
+
},
|
|
218
|
+
async forgetScope(agentId, description) {
|
|
219
|
+
return serialized(agentId, async () => {
|
|
220
|
+
const grants = await read(agentId);
|
|
221
|
+
refuseIfUnreadable(agentId);
|
|
222
|
+
const kept = grants.scopes.filter((scope) => describeCommandScope(scope) !== description);
|
|
223
|
+
if (kept.length === grants.scopes.length) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
await save(agentId, { ...grants, scopes: kept });
|
|
227
|
+
return true;
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
async forgetOrigin(agentId, origin) {
|
|
231
|
+
return serialized(agentId, async () => {
|
|
232
|
+
const grants = await read(agentId);
|
|
233
|
+
refuseIfUnreadable(agentId);
|
|
234
|
+
const kept = grants.origins.filter((scope) => scope.origin !== origin);
|
|
235
|
+
if (kept.length === grants.origins.length) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
await save(agentId, { ...grants, origins: kept });
|
|
239
|
+
return true;
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
async forgetTool(agentId, tool) {
|
|
243
|
+
return serialized(agentId, async () => {
|
|
244
|
+
const grants = await read(agentId);
|
|
245
|
+
refuseIfUnreadable(agentId);
|
|
246
|
+
const kept = grants.tools.filter((grant) => grant.tool !== tool);
|
|
247
|
+
if (kept.length === grants.tools.length) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
await save(agentId, { ...grants, tools: kept });
|
|
251
|
+
return true;
|
|
252
|
+
});
|
|
253
|
+
},
|
|
174
254
|
};
|
|
175
255
|
};
|
|
176
256
|
//# sourceMappingURL=whitelist.js.map
|
package/dist/whitelist.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whitelist.js","sourceRoot":"","sources":["../src/whitelist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"whitelist.js","sourceRoot":"","sources":["../src/whitelist.ts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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratusagent/permissions",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"node": ">=22.13 <23 || >=23.4"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@stratusagent/core": "0.11.
|
|
20
|
+
"@stratusagent/core": "0.11.4"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^24.6.0",
|