element-field-write.ts 504 B

123456789
  1. // Element-field write (heap fix): a tainted field written through an element-access
  2. // receiver (`arr[0]!.f = secret`), then read back through the same static index. The
  3. // write resolves arr[0] to its live field object, so the precise read sees the secret.
  4. // Expected: source -> ask#1, ask#1 -> ask#2, ask#2 -> sink.
  5. const secret = await agent("writer").ask<string>("secret");
  6. const arr = [{ f: "" }];
  7. arr[0]!.f = secret;
  8. const out = await agent("reader").ask<string>(`use ${arr[0]!.f}`);
  9. return out;