@capybara-hq/plugin-sdk 0.1.0-rc.41 → 0.1.0-rc.43

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.
@@ -64,5 +64,8 @@ cloud network are set per org by admins.
64
64
 
65
65
  ## What agents may not do
66
66
 
67
- Deciding approvals and requests, confirming extension permissions, managing tokens and secrets,
68
- changing roles. Operations that need credentials refuse and point to the web page.
67
+ Deciding approvals and requests, confirming extension permissions, managing tokens, changing
68
+ roles. A secret an operation writes (an extension's API key in its config, say) is never a param:
69
+ list its field in `askPerson` and the person types it on the confirmation card on the web. Never ask
70
+ for a secret in the conversation; a secret that appeared there counts as leaked, so tell the person
71
+ to rotate it. Operations whose secrets the card cannot take refuse and point to the web page.
@@ -45,4 +45,6 @@ Fields of `template`:
45
45
  `oauth_code` or `oauth_client`, plus `ownership` (`org` or per member).
46
46
  - `defaultToolPolicies`: tool name to `allow`, `ask` or `deny`. When unsure, do not write `allow`.
47
47
 
48
- Credentials and secret config are entered by people on the web page, never through an agent.
48
+ Credentials and secret config are entered by the person on the `Platform` confirmation card (name
49
+ their paths in `askPerson`), never typed by an agent; only what the card cannot take (secret
50
+ records, custom header credentials) is entered on the web page.
@@ -31,14 +31,22 @@ the person's own decision stays with the person on the web.
31
31
  ## What stays with the person
32
32
 
33
33
  - **Secrets.** Bot tokens, app tokens, signing secrets and OAuth client secrets are typed by the
34
- person into their fields on the `webPath` page. Never ask for a secret in the conversation and
35
- never repeat one; if the person pastes one anyway, tell them to rotate it at the third-party
36
- platform. The guide and the check results never contain secret values, and no setup operation
37
- takes one.
38
- - **Connecting a personal account** (OAuth consent) happens in the browser on the `webPath` page
39
- (for a member, their connections page).
34
+ person, never by you. A write that stores one (a connector credential or OAuth client secret, a
35
+ channel secret, an extension config secret) takes it as a person field: name its path in
36
+ `askPerson` and the person types the value on the `Platform` confirmation card. What the card
37
+ cannot take (secret records, custom header credentials) the person enters on the `webPath` page.
38
+ Never ask for a secret in the conversation and never repeat one; if the person pastes one
39
+ anyway, it counts as leaked: tell them to rotate it at the third-party platform. The guide and
40
+ the check results never contain secret values, and no setup operation takes one.
41
+ - **Connecting a personal account** (OAuth consent) happens in the person's browser: call
42
+ `connectors.connect`, which shows the person a Connect button in the conversation, then check
43
+ `connectors.get` for the connection state.
40
44
  - **Confirming the app was updated** after a guide changed (the drift notice) is the person's
41
- click on the target's page: only they know they changed the app at the third party.
45
+ confirmation: only they know they changed the app at the third party. For a connector,
46
+ `connectors.guide-ack` puts that statement on its confirmation card (the hash `connectors.get`
47
+ shows under `setupGuide`); for a channel connection, `channels.guide-ack` does (the `hash` of
48
+ `setup.read` for the connection, audience admin, its inbound mode). A stale hash is refused
49
+ before the card: read the guide again and walk the person through the change.
42
50
  - **Creating the app** at the third-party platform is outside Capybara: explain it, the person
43
51
  does it.
44
52
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "0.1.0-rc.41";
1
+ export declare const SDK_VERSION = "0.1.0-rc.43";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./bootstrap.js";
4
4
  export * from "./cards.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = "0.1.0-rc.41";
1
+ export const SDK_VERSION = "0.1.0-rc.43";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./bootstrap.js";
4
4
  export * from "./cards.js";
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Private Python 3 transport: one JSON request on stdin, one result/error on stdout.
3
3
  * The trusted caller supplies already-authorized canonical root paths and inherited directory
4
- * descriptors in roots.read/roots.write ({path, fd}); this helper never selects a profile.
4
+ * descriptors in roots.read/roots.write ({path, fd}); this helper never selects a profile. A read
5
+ * root may be a single file ({path, fd, file: true}): fd is then its parent directory, and only
6
+ * that one name below it is reachable through the root.
5
7
  * Binary data uses dataB64. Callers own launch, signal handling, admission and error translation.
6
8
  * Descriptor-relative native access alone does not establish an OS execution boundary.
7
9
  */
@@ -3,7 +3,9 @@ import { SANDBOX_WRITE_POLICY_PYTHON } from "./sandbox-write-denies.js";
3
3
  /**
4
4
  * Private Python 3 transport: one JSON request on stdin, one result/error on stdout.
5
5
  * The trusted caller supplies already-authorized canonical root paths and inherited directory
6
- * descriptors in roots.read/roots.write ({path, fd}); this helper never selects a profile.
6
+ * descriptors in roots.read/roots.write ({path, fd}); this helper never selects a profile. A read
7
+ * root may be a single file ({path, fd, file: true}): fd is then its parent directory, and only
8
+ * that one name below it is reachable through the root.
7
9
  * Binary data uses dataB64. Callers own launch, signal handling, admission and error translation.
8
10
  * Descriptor-relative native access alone does not establish an OS execution boundary.
9
11
  */
@@ -129,6 +131,8 @@ class NativeFiles:
129
131
  for root in roots["read"] + roots["write"]:
130
132
  if not valid_path(root["path"]) or os.path.normpath(root["path"]) != root["path"]:
131
133
  raise ValueError("Supply canonical absolute root paths")
134
+ if root.get("file") is True and (root in roots["write"] or root["path"] == "/"):
135
+ raise ValueError("Only a read root may be a single file")
132
136
  if not stat.S_ISDIR(os.fstat(root["fd"]).st_mode):
133
137
  raise ValueError("Supply pinned directory descriptors")
134
138
 
@@ -150,6 +154,11 @@ class NativeFiles:
150
154
  fd = os.dup(root["fd"])
151
155
  current = root["path"]
152
156
  parts = os.path.relpath(path, current).split("/")
157
+ if root.get("file") is True:
158
+ # a single-file root: walked from its parent directory, so the file's own name is
159
+ # the first component (anything below it is no directory, so missing for a reader)
160
+ current = os.path.dirname(root["path"])
161
+ parts = [os.path.basename(root["path"])] + ([] if path == root["path"] else parts)
153
162
  result = self.walk(fd, current, parts, write, create, links, must_exist)
154
163
  if write and self.deny_writes and write_denied(result[2]):
155
164
  os.close(result[0])
@@ -241,6 +250,8 @@ class NativeFiles:
241
250
  return None
242
251
  best = None
243
252
  for root in self.roots["read"] + self.roots["write"]:
253
+ if root.get("file") is True:
254
+ continue # its descriptor is the parent directory, not the root's path
244
255
  try:
245
256
  now = os.readlink("/proc/self/fd/%d" % root["fd"]).rstrip("/")
246
257
  except OSError:
@@ -17,7 +17,7 @@ export const SANDBOX_RUNTIME_SOURCE = Object.freeze({
17
17
  Object.freeze({
18
18
  name: "native-files.py",
19
19
  source: NATIVE_FILES_SOURCE,
20
- sha256: "9bde40a697fd60f2c9073b7fc35e84b4cffd045463e3ab5116a2c3435fd55df0",
20
+ sha256: "c1712198af4ffedc0b48f789c28ed4233dc9008521b897300731c4f903168950",
21
21
  }),
22
22
  Object.freeze({
23
23
  name: "linux-sandbox.py",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.41",
3
+ "version": "0.1.0-rc.43",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {