Repository navigation
Commit b8977b4
committed
🔐 Take selection out of the document's reach
`ActiveReturn` is a named context, and a named context is reachable by name from
a document's own eval block: `createContext("expand.return")` names the slot the
engine publishes on. The frame it carried was a plain mutable object, so a
document could write a value onto it and publish something the engine never
validated:
---
returns: { type: number }
---
```js eval
import { createContext } from "effection";
const frame = yield* createContext("expand.return").get();
frame.selected = { value: "schema-bypassed" };
```
<If condition={false}><Return value={1} /></If>
That printed "schema-bypassed" and exited 0 — a string through a number schema,
from a document whose only authored return was unselected.
What travels contextually is now a frozen carrier holding no facts, only an
accessor that answers nothing without a `Symbol()` this module never exports.
The owner, schema, claim and selected value live in that carrier's closure, so
the state's lifetime is one execution of one body rather than a table's, and a
document that reads, enumerates, calls, copies or replaces the carrier reaches
none of it. A carrier the engine did not mint cannot supply the token, and state
it fabricates lacks the mark the engine puts on its own — so a `<Return>` that
finds one is reserved instead of selecting through it. Both settlement sites
read the carrier their own body minted and has held since, never one read back
from the context.
RV10e covers both consumers: the value-root exploit exits 1 with empty stdout
and the existing missing-return diagnostic, and the same attack inside a
Markdown value component with an unselected authored return reports that
component's own missing-return diagnostic and binds nothing. Restoring state to
the carrier makes both fail and the exploit publish again.
No suppression: the first attempt kept the state in a module-scoped WeakMap,
which `local/no-module-scoped-registry` reports. The closure carries the same
guarantee with the lifetime the rule asks for.
Refs #6401 parent 4bc7454 commit b8977b4
7 files changed
Lines changed: 296 additions & 50 deletions
File tree
- packages
- cli/tests
- core
- src
- tests
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
2377 | 2377 | | |
2378 | 2378 | | |
2379 | 2379 | | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
2380 | 2394 | | |
2381 | 2395 | | |
2382 | 2396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
123 | 158 | | |
124 | 159 | | |
125 | 160 | | |
| |||
244 | 279 | | |
245 | 280 | | |
246 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
247 | 295 | | |
248 | 296 | | |
249 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| |||
1595 | 1600 | | |
1596 | 1601 | | |
1597 | 1602 | | |
1598 | | - | |
| 1603 | + | |
1599 | 1604 | | |
1600 | 1605 | | |
1601 | 1606 | | |
| |||
1610 | 1615 | | |
1611 | 1616 | | |
1612 | 1617 | | |
1613 | | - | |
| 1618 | + | |
1614 | 1619 | | |
1615 | 1620 | | |
1616 | 1621 | | |
| |||
1637 | 1642 | | |
1638 | 1643 | | |
1639 | 1644 | | |
1640 | | - | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
1641 | 1648 | | |
1642 | 1649 | | |
1643 | 1650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
257 | | - | |
| 259 | + | |
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
| |||
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
364 | | - | |
| 366 | + | |
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| |||
842 | 844 | | |
843 | 845 | | |
844 | 846 | | |
845 | | - | |
846 | | - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
847 | 855 | | |
848 | 856 | | |
849 | 857 | | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
857 | 861 | | |
858 | 862 | | |
859 | 863 | | |
| |||
4217 | 4221 | | |
4218 | 4222 | | |
4219 | 4223 | | |
4220 | | - | |
4221 | | - | |
| 4224 | + | |
| 4225 | + | |
4222 | 4226 | | |
4223 | 4227 | | |
4224 | 4228 | | |
| |||
4236 | 4240 | | |
4237 | 4241 | | |
4238 | 4242 | | |
4239 | | - | |
4240 | | - | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
4241 | 4247 | | |
4242 | 4248 | | |
4243 | 4249 | | |
| |||
0 commit comments