@blockrun/franklin 3.29.13 → 3.29.14

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.
@@ -147,16 +147,22 @@ function isSegmentSafe(segment) {
147
147
  // quoting arrangement of a wallet/secret path can reach 'safe'. (Over-matching
148
148
  // here only ever prompts — it never blocks.)
149
149
  const norm = segment.replace(/\\(.)/g, '$1').replace(/['"]/g, '');
150
+ // Brace expansion (`.bloc{k,}run`, `{~,}/...`, `.bloc{j..l}run`) is a 4th
151
+ // obfuscation primitive — the shell rewrites it to other words before opening
152
+ // the path, so `.blockrun`/basename literals read as non-contiguous text. Drop
153
+ // the brace metachars so the deny regexes below see the collapsed first word.
154
+ const debraced = norm.replace(/[{},]/g, '');
150
155
  // Never auto-approve a command that touches the wallet key store. Matching the
151
156
  // FILENAME is hopeless — it's trivially obfuscated. So match the DIRECTORY: any
152
157
  // reference to ~/.blockrun forces a prompt. (The file Read/Write/Edit tools
153
158
  // have a separate canonicalized guard; this is the best-effort net for the shell.)
154
- if (/\.blockrun/i.test(norm)) {
159
+ if (/\.blockrun/i.test(norm) || /\.blockrun/i.test(debraced)) {
155
160
  return false;
156
161
  }
157
162
  // Relative reads with no `.blockrun` in the text (e.g. the cwd is the wallet
158
163
  // dir): match the known key/secret basenames broadly (any *wallet*.json/.key).
159
- if (/(?<![\w-])(?:\.solana-session(?:-key2)?|\.session|[\w-]*wallet[\w-]*\.(?:json|key))(?![\w-])/i.test(norm)) {
164
+ const keyBasename = /(?<![\w-])(?:\.solana-session(?:-key2)?|\.session|[\w-]*wallet[\w-]*\.(?:json|key))(?![\w-])/i;
165
+ if (keyBasename.test(norm) || keyBasename.test(debraced)) {
160
166
  return false;
161
167
  }
162
168
  // Command/process substitution runs an arbitrary INNER command the classifier
@@ -181,6 +187,14 @@ function isSegmentSafe(segment) {
181
187
  if (/\$\{?[A-Za-z_]/.test(segment)) {
182
188
  return false;
183
189
  }
190
+ // Brace expansion with a comma list (`{a,b}`) or `..` range (`{0..9}`) fabricates
191
+ // words/paths the classifier can't statically follow — `cat {~,}/.bloc{k,}run/...`
192
+ // reaches the wallet store while every char-literal guard misses. Treat any such
193
+ // group as opaque, like `$VAR`/`$(...)`. (A brace with NO comma/`..` — `{x}`, or
194
+ // an fd-dup `2>&1` — does not expand, so it stays safe.)
195
+ if (/\{[^{}]*(?:,|\.\.)[^{}]*\}/.test(segment)) {
196
+ return false;
197
+ }
184
198
  // A glob/brace in an explicit PATH (a token rooted at ~, ., or /) expands AFTER
185
199
  // this guard and can reach the wallet store (`cat ~/.b*/.s*`) or a sensitive
186
200
  // file. Bare cwd globs (`*.md`, `src/*.ts`) have no such prefix and stay safe.
@@ -35,6 +35,14 @@ export function isBlockedSsrfHost(hostname) {
35
35
  return true; // loopback / unspecified
36
36
  if (h.startsWith('fe80:') || h.startsWith('fc') || h.startsWith('fd'))
37
37
  return true; // link-local / ULA
38
+ // 6to4 (`2002:WWXX:YYZZ::/16`) embeds an IPv4 (W.X.Y.Z) in the first two
39
+ // hextets; a 6to4 relay routes to it (e.g. 2002:7f00:1:: → 127.0.0.1,
40
+ // 2002:a9fe:a9fe:: → 169.254.169.254). Decode and recheck the embedded v4.
41
+ const sixToFour = h.match(/^2002:([0-9a-f]{1,4}):([0-9a-f]{1,4}):/);
42
+ if (sixToFour) {
43
+ const hi = parseInt(sixToFour[1], 16), lo = parseInt(sixToFour[2], 16);
44
+ return isBlockedSsrfHost(`${(hi >>> 8) & 255}.${hi & 255}.${(lo >>> 8) & 255}.${lo & 255}`);
45
+ }
38
46
  // NAT64 (`64:ff9b::a.b.c.d` / `64:ff9b::hhhh:hhhh`) embeds an IPv4 that a NAT64
39
47
  // gateway routes to — decode and recheck it like the IPv4-mapped form below.
40
48
  const nat64 = h.match(/^64:ff9b::(.+)$/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.29.13",
3
+ "version": "3.29.14",
4
4
  "description": "Franklin Agent — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {