functions-summaries-call-shift.ts 520 B

1234567891011
  1. // f.call(null, secret): at runtime f's param x IS secret and flows into ask#2.
  2. // The analyzer treats `f.call` as a call of f with the thisArg occupying actual
  3. // index 0, so param 0 receives null's (empty) taint — probing whether the
  4. // positional misalignment drops the ask#1 -> ask#2 edge.
  5. const judge = agent("judge");
  6. const secret = await agent("s").ask<string>("make secret");
  7. function f(x: string): Node<string> {
  8. return judge.ask<string>(`judge ${x}`);
  9. }
  10. const out = await f.call(null, secret);
  11. return out;