Skip to content

Commit e08f819

Browse files
committed
chore: update progress for US-119-B
1 parent d7bb76f commit e08f819

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

scripts/ralph/prd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,7 @@
20712071
"Tests pass"
20722072
],
20732073
"priority": 123,
2074-
"passes": false,
2074+
"passes": true,
20752075
"notes": "Audit M3 — MEDIUM (partial gap from US-132). US-132 isolates caches across warm executions but does not prevent poisoning within a single execution. bridge-initial-globals.ts:22 exposes mutable _moduleCache and require.cache."
20762076
},
20772077
{

scripts/ralph/progress.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,3 +1566,21 @@ PRD: ralph/kernel-hardening (46 stories)
15661566
- BUFFER_CONSTANTS/BUFFER_MAX_LENGTH are still used elsewhere in process.ts (global Buffer setup) — don't remove them
15671567
- Multiple sandbox escape tests reference process.binding() as a sentinel for "real bindings" — when changing binding behavior, grep all test files for `process.binding` calls
15681568
---
1569+
1570+
## 2026-03-18 - US-119-B
1571+
- What was implemented: Blocked module cache poisoning within a single execution by wrapping the internal `_moduleCache` object in a read-only Proxy
1572+
- Changes:
1573+
- `require-setup.ts`: Captured internal cache reference, replaced all internal `_moduleCache[` writes with `__internalModuleCache[`, created read-only Proxy (rejects set/delete/defineProperty), assigned to `require.cache` and `_moduleCache` global, updated `Module._cache` references
1574+
- `global-exposure.ts`: Changed `_moduleCache` classification from `mutable-runtime-state` to `hardened` so `applyCustomGlobalExposurePolicy` locks the property as non-writable/non-configurable after bridge setup
1575+
- `bridge-hardening.test.ts`: Added 5 tests covering require.cache set/delete rejection, normal require caching, `_moduleCache` global protection, and `Module._cache` protection
1576+
- Files changed:
1577+
- packages/secure-exec-core/isolate-runtime/src/inject/require-setup.ts
1578+
- packages/secure-exec-core/src/shared/global-exposure.ts
1579+
- packages/secure-exec-core/src/generated/isolate-runtime.ts (auto-generated)
1580+
- packages/secure-exec/tests/runtime-driver/node/bridge-hardening.test.ts
1581+
- **Learnings for future iterations:**
1582+
- `applyCustomGlobalExposurePolicy` runs AFTER `setupRequire` — any property made `configurable: false` in require-setup.ts will cause the policy to fail when it tries to re-apply. Use `configurable: true` and let the policy finalize it.
1583+
- The bridge setup order is: globalExposureHelpers → bridge-initial-globals → bridge bundle (module.ts) → bridge attach → timing mitigation → require-setup. Module.ts evaluates BEFORE require-setup, so Module._cache captures the raw cache object and must be explicitly updated.
1584+
- Internal require system writes need a captured local reference (`__internalModuleCache`) since the globalThis property gets replaced with a Proxy that rejects writes.
1585+
- `proc.run()` returns `{ code, exports }` not just exports — test assertions must use `result.exports`.
1586+
---

0 commit comments

Comments
 (0)