shadok-ai 0.17.28 → 0.17.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -168,7 +168,9 @@ Enter to skip; you can add it later from the web UI).
168
168
  model*: prints nothing → nothing to report, the agent is never woken and the
169
169
  run costs **zero tokens**; prints something → that output is prepended to the
170
170
  prompt and the agent runs. A watcher that is quiet most of the day costs
171
- nothing most of the day.
171
+ nothing most of the day. The guard runs with the target agent's profile
172
+ secrets, so an agent may put one only on itself (a person may guard any agent
173
+ they can drive).
172
174
  - **Agents that report back** — an agent that launches other agents is told when
173
175
  each one finishes, blocks on a question, or dies. It hears about **its own**
174
176
  children and nothing else, so a busy channel never wakes it. What arrives is
@@ -48,6 +48,9 @@ password, no cookie. A credential the check needs goes in the profile.
48
48
 
49
49
  You can only schedule on an agent you may drive: on a multi-tenant instance,
50
50
  yourself, a sibling of your own group, or a shared (public) agent.
51
+ A cron with a `check`, though, may only target YOURSELF (the check runs with the
52
+ target's secrets, so a guard on a sibling would hand you its credentials): the
53
+ server answers 403. A check-less cron on a sibling is fine.
51
54
 
52
55
  So reference a secret by name (`$MY_API_KEY`) and trust it: never hardcode a
53
56
  value into a check script, and never try to source a shell profile to get one.
package/dist/csp.d.ts CHANGED
@@ -39,6 +39,12 @@ export declare const NONCE_PLACEHOLDER = "__CSP_NONCE__";
39
39
  * `ws://` on the same host and port.
40
40
  * - `base-uri`/`object-src`/`frame-ancestors` at `none`: nothing to rewrite,
41
41
  * nothing to embed, and no clickjacking on a UI that drives agents.
42
+ * - `form-action 'none'`: no form on any page we serve submits natively — the
43
+ * login page and the cockpit both handle `submit` in script and `fetch`. So a
44
+ * `<form action="https://evil/…">` smuggled into agent Markdown (a fake
45
+ * "session expired, re-enter your password") cannot send what was typed off
46
+ * the origin, even if the sanitiser ever lets one through. Not `'self'`: an
47
+ * injected form posting to our own routes would be a CSRF from inside.
42
48
  */
43
49
  export declare function cspHeader(nonce: string): string;
44
50
  /** Replace every marker with this request's nonce. */
package/dist/csp.js CHANGED
@@ -39,6 +39,12 @@ export const NONCE_PLACEHOLDER = "__CSP_NONCE__";
39
39
  * `ws://` on the same host and port.
40
40
  * - `base-uri`/`object-src`/`frame-ancestors` at `none`: nothing to rewrite,
41
41
  * nothing to embed, and no clickjacking on a UI that drives agents.
42
+ * - `form-action 'none'`: no form on any page we serve submits natively — the
43
+ * login page and the cockpit both handle `submit` in script and `fetch`. So a
44
+ * `<form action="https://evil/…">` smuggled into agent Markdown (a fake
45
+ * "session expired, re-enter your password") cannot send what was typed off
46
+ * the origin, even if the sanitiser ever lets one through. Not `'self'`: an
47
+ * injected form posting to our own routes would be a CSRF from inside.
42
48
  */
43
49
  export function cspHeader(nonce) {
44
50
  return [
@@ -51,6 +57,7 @@ export function cspHeader(nonce) {
51
57
  "base-uri 'none'",
52
58
  "object-src 'none'",
53
59
  "frame-ancestors 'none'",
60
+ "form-action 'none'",
54
61
  ].join("; ");
55
62
  }
56
63
  /** Replace every marker with this request's nonce. */
package/dist/csp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"csp.js","sourceRoot":"","sources":["../src/csp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO;QACL,oBAAoB;QACpB,4BAA4B,KAAK,GAAG;QACpC,kCAAkC;QAClC,sBAAsB;QACtB,iBAAiB;QACjB,oBAAoB;QACpB,iBAAiB;QACjB,mBAAmB;QACnB,wBAAwB;KACzB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAa;IACrD,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CA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IAAI,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAEvD,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,OAAe;IAC9D,8EAA8E;IAC9E,0EAA0E;IAC1E,OAAO,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,gFAAgF;AAChF,iFAAiF;AACjF,iFAAiF;AACjF,4EAA4E;AAC5E,gFAAgF;AAChF,8CAA8C;AAC9C,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,GAAW;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAC;AACtF,CAAC"}
@@ -9,7 +9,7 @@ import type { DeploymentMode } from "./capability.js";
9
9
  * named. Pure, so every decision here is tested without a server, a root
10
10
  * account or a provisioned OS user (none of which a test machine has).
11
11
  *
12
- * Invariant 58.
12
+ * Invariant 60.
13
13
  */
14
14
  /**
15
15
  * May this caller schedule / edit / delete a cron on (or otherwise act for)
@@ -40,6 +40,30 @@ export declare function mayActOnSession(input: {
40
40
  }[];
41
41
  groups: readonly Group[];
42
42
  }): boolean;
43
+ /**
44
+ * May this caller give the cron it is writing this `check`? A guard runs with
45
+ * the TARGET agent's profile secrets in its env, so an agent that could put a
46
+ * guard on a SIBLING would read the sibling's secrets (`env | curl …`) — in
47
+ * mono-tenant every agent is commons, so `mayActOnSession` lets it aim at any
48
+ * of them. An agent therefore guards only ITSELF; a person (no agent key) may
49
+ * guard any agent they may drive, which `mayActOnSession` already decided.
50
+ *
51
+ * Only a check the agent SETS or MOVES is refused: a cron that already carried
52
+ * this exact check on this exact target (written by a person) can still have
53
+ * its prompt or schedule edited by the agent, since that hands it nothing new.
54
+ * Repointing a guarded cron at a sibling, or changing the guard, is a new grant.
55
+ * Pure; invariant 60.
56
+ */
57
+ export declare function cronCheckAllowed(input: {
58
+ /** The calling agent's session id (per-session key), null for a person. */
59
+ agentId: string | null;
60
+ targetId: string;
61
+ check: string | undefined;
62
+ existing?: {
63
+ sessionId: string;
64
+ check?: string;
65
+ };
66
+ }): boolean;
43
67
  /**
44
68
  * The group-level half of `mayActOnSession`, reused where the thing asked for
45
69
  * is a GROUP's rather than a session's (a media subdirectory).
@@ -9,7 +9,7 @@ import { canSeeGroup } from "./groups.js";
9
9
  * named. Pure, so every decision here is tested without a server, a root
10
10
  * account or a provisioned OS user (none of which a test machine has).
11
11
  *
12
- * Invariant 58.
12
+ * Invariant 60.
13
13
  */
14
14
  // ── Who may act on a session ────────────────────────────────────────────────
15
15
  /**
@@ -36,6 +36,30 @@ export function mayActOnSession(input) {
36
36
  return false;
37
37
  return mayReachGroup({ ...input, group: ch.group ?? null, self: input.agent?.id === input.targetId });
38
38
  }
39
+ /**
40
+ * May this caller give the cron it is writing this `check`? A guard runs with
41
+ * the TARGET agent's profile secrets in its env, so an agent that could put a
42
+ * guard on a SIBLING would read the sibling's secrets (`env | curl …`) — in
43
+ * mono-tenant every agent is commons, so `mayActOnSession` lets it aim at any
44
+ * of them. An agent therefore guards only ITSELF; a person (no agent key) may
45
+ * guard any agent they may drive, which `mayActOnSession` already decided.
46
+ *
47
+ * Only a check the agent SETS or MOVES is refused: a cron that already carried
48
+ * this exact check on this exact target (written by a person) can still have
49
+ * its prompt or schedule edited by the agent, since that hands it nothing new.
50
+ * Repointing a guarded cron at a sibling, or changing the guard, is a new grant.
51
+ * Pure; invariant 60.
52
+ */
53
+ export function cronCheckAllowed(input) {
54
+ if (!input.agentId)
55
+ return true;
56
+ if (!input.check)
57
+ return true;
58
+ if (input.targetId === input.agentId)
59
+ return true;
60
+ const e = input.existing;
61
+ return !!e && e.sessionId === input.targetId && e.check === input.check;
62
+ }
39
63
  /**
40
64
  * The group-level half of `mayActOnSession`, reused where the thing asked for
41
65
  * is a GROUP's rather than a session's (a media subdirectory).
@@ -1 +1 @@
1
- {"version":3,"file":"group-exec.js","sourceRoot":"","sources":["../src/group-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,WAAW,EAA2B,MAAM,aAAa,CAAC;AAGnE;;;;;;;;;;GAUG;AAEH,+EAA+E;AAE/E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,KAQ/B;IACC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClC,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC;IACtB,OAAO,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AACxG,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAO7B;IACC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,C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;IACtE,OAAO,EAAE,MAAM,EAAE,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnG,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,CAAS,EACT,KAA6C;IAE7C,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IACnD,IAAI,KAAK;QAAE,GAAG,CAAC,IAAI,CAAC,wCAAwC,EAAE,QAAQ,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7H,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAmD,EACnD,GAAiC;IAEjC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpF,OAAO,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC;AAC5D,CAAC"}
@@ -14,7 +14,7 @@
14
14
  * group's OS user's group>, mode 2750. Only root writes there; only that
15
15
  * group's user (and root) reads. Mono-tenant keeps its single flat directory.
16
16
  *
17
- * Invariant 58.
17
+ * Invariant 60.
18
18
  */
19
19
  /** Prefix of a group media subdirectory; a flat (legacy / mono) file never
20
20
  * sits in a directory with this shape, so the two cannot be confused. */
@@ -17,7 +17,7 @@ import { MAIN_GROUP_ID } from "./groups.js";
17
17
  * group's OS user's group>, mode 2750. Only root writes there; only that
18
18
  * group's user (and root) reads. Mono-tenant keeps its single flat directory.
19
19
  *
20
- * Invariant 58.
20
+ * Invariant 60.
21
21
  */
22
22
  /** Prefix of a group media subdirectory; a flat (legacy / mono) file never
23
23
  * sits in a directory with this shape, so the two cannot be confused. */
package/dist/server.js CHANGED
@@ -51,7 +51,7 @@ import { cancelPairingCode, issuePairingCode, pairingStatus } from "./tg-pairing
51
51
  import { migrateTgBindings } from "./channels.js";
52
52
  import { viewerFor, canResumeAs, canRestartInto, canSeeGroup, membershipVerdict, canSeeSession, spawnGroupFor, listableGroups, visibleChannels, secretOwnGroupIds, ledgerGroupsFor, groupsPutFlow, privateGroupFor, newPrivateGroup, accountDeleteGroups, MAIN_GROUP_ID, } from "./groups.js";
53
53
  import { resolveSpawnIsolation, osUserFor, homeForUser, runAsUser, provisionGroupUser, teardownGroupUser, reconcileGroupProvisioning, DEFAULT_HOME_BASE, createGroupFlow, deleteGroupFlow, SHARED_POT_GROUP, DEFAULT_SHARED_POT_PATH, } from "./osusers.js";
54
- import { mayActOnSession, mayReachGroup, osUserForChannelGroup, cronCheckEnv, cronCheckCommand, statAsUserArgv, parseStatOutput, readAsUserArgv, sameOfferedFile, } from "./group-exec.js";
54
+ import { mayActOnSession, cronCheckAllowed, mayReachGroup, osUserForChannelGroup, cronCheckEnv, cronCheckCommand, statAsUserArgv, parseStatOutput, readAsUserArgv, sameOfferedFile, } from "./group-exec.js";
55
55
  import { mediaDirForGroup, mediaFileMode, parseMediaRequest, groupForMediaKey, passwdGid, mediaDirSpec, mediaDirTrusted, mediaServable, } from "./media-scope.js";
56
56
  import { runPrivileged, TREE_OP_TIMEOUT_MS } from "./privileged.js";
57
57
  import { HOME_SKILLS_BASE, rewriteSkillsBase } from "./skill-paths.js";
@@ -2258,6 +2258,10 @@ app.post("/crons", (req, res) => {
2258
2258
  ? true // re-arm: a spent one-shot being re-edited is enabled:false
2259
2259
  : (existing?.enabled ?? true);
2260
2260
  const check = typeof b.check === "string" && b.check.trim() ? String(b.check).trim() : undefined;
2261
+ // The guard runs with the TARGET's profile secrets: an agent may only guard
2262
+ // itself, or it could read a sibling's secrets through `env` (invariant 60).
2263
+ if (!cronCheckAllowed({ agentId: callerOf(req).id, targetId: sessionId, check, existing }))
2264
+ return res.status(403).json({ error: "an agent may set a cron check only on its own session (the check runs with that agent's secrets)" });
2261
2265
  const cron = {
2262
2266
  id: existing?.id ?? randomUUID(),
2263
2267
  sessionId,