class-getter-taint.ts 546 B

12345678910111213141516
  1. // A getter returns this.field; reading the getter (modeled as a field whose value is the
  2. // getter's return summary) surfaces the stored artifact, connecting writer -> reader.
  3. // Expected: source -> ask#1, ask#1 -> ask#2, ask#2 -> sink.
  4. const secret = await agent("writer").ask<string>("secret");
  5. class Vault {
  6. stored: string;
  7. constructor(s: string) {
  8. this.stored = s;
  9. }
  10. get exposed(): string {
  11. return this.stored;
  12. }
  13. }
  14. const v = new Vault(secret);
  15. const out = await agent("reader").ask<string>(`use ${v.exposed}`);
  16. return out;