JS: Add test for class with locally-unused field

This commit is contained in:
Asger Feldthaus
2020-12-12 20:27:03 +00:00
parent cc952bd2a4
commit 6bf9345258
5 changed files with 19 additions and 4 deletions

View File

@@ -0,0 +1 @@
<sink-component [sink6]="field"></sink-component>

View File

@@ -0,0 +1,9 @@
import { Input, Component } from '@angular/core';
@Component({
selector: 'mid-component',
templateUrl: './mid.component.html'
})
export class MidComponent {
@Input() field: string;
}

View File

@@ -11,6 +11,7 @@ export class SinkComponent {
sink3: string;
sink4: string;
sink5: string;
sink6: string;
constructor(private sanitizer: DomSanitizer) {}
@@ -20,5 +21,6 @@ export class SinkComponent {
this.sanitizer.bypassSecurityTrustHtml(this.sink3);
this.sanitizer.bypassSecurityTrustHtml(this.sink4);
this.sanitizer.bypassSecurityTrustHtml(this.sink5);
this.sanitizer.bypassSecurityTrustHtml(this.sink6);
}
}

View File

@@ -13,3 +13,5 @@
<div *ngFor="let element of safeArray">
<sink-component [sink2]="element"></sink-component>
</div>
<mid-component [field]="taint"></mid-component>

View File

@@ -22,7 +22,8 @@ pipeClassRef
| TestPipe.ts:4:8:9:1 | class T ... ;\\n }\\n} | source.component.html:5:22:5:29 | testPipe |
| TestPipe.ts:4:8:9:1 | class T ... ;\\n }\\n} | source.component.html:6:19:6:26 | testPipe |
taintFlow
| source.component.ts:13:22:13:29 | source() | sink.component.ts:18:48:18:57 | this.sink1 |
| source.component.ts:13:22:13:29 | source() | sink.component.ts:21:48:21:57 | this.sink4 |
| source.component.ts:13:22:13:29 | source() | sink.component.ts:22:48:22:57 | this.sink5 |
| source.component.ts:14:33:14:40 | source() | sink.component.ts:18:48:18:57 | this.sink1 |
| source.component.ts:13:22:13:29 | source() | sink.component.ts:19:48:19:57 | this.sink1 |
| source.component.ts:13:22:13:29 | source() | sink.component.ts:22:48:22:57 | this.sink4 |
| source.component.ts:13:22:13:29 | source() | sink.component.ts:23:48:23:57 | this.sink5 |
| source.component.ts:13:22:13:29 | source() | sink.component.ts:24:48:24:57 | this.sink6 |
| source.component.ts:14:33:14:40 | source() | sink.component.ts:19:48:19:57 | this.sink1 |