heap-aliasing-map-roundtrip.ts 447 B

123456789
  1. // Map.get after Map.set of a tracked box, with the taint written AFTER the set:
  2. // the unknown `get` call's receiver collapse must carry the box's (later) taint.
  3. // Expected: ask#1 -> ask#2 data; ask#2 -> sink.
  4. const box: { f: string } = { f: "" };
  5. const m = new Map<string, { f: string }>();
  6. m.set("k", box);
  7. box.f = await agent("writer").ask<string>("secret");
  8. const got = m.get("k");
  9. return agent("reader").ask<string>(`use ${got?.f ?? ""}`);