diff --git a/pw/pw-xss/client/src/app/home/home.html b/pw/pw-xss/client/src/app/home/home.html index 08d6cdbe..5190b8de 100644 --- a/pw/pw-xss/client/src/app/home/home.html +++ b/pw/pw-xss/client/src/app/home/home.html @@ -1,5 +1,5 @@
-

{{message}}

+

{{message}}

@@ -22,9 +22,9 @@

{{message}}

- - - + + > + @@ -41,7 +41,7 @@

{{message}}

And the news of the day is...

-

{{newsOfTheDay.content}} from {{newsOfTheDay.author}}

+

from {{newsOfTheDay.author}}

\ No newline at end of file diff --git a/pw/pw-xss/client/src/app/home/home.ts b/pw/pw-xss/client/src/app/home/home.ts index 189f38e3..19806b63 100644 --- a/pw/pw-xss/client/src/app/home/home.ts +++ b/pw/pw-xss/client/src/app/home/home.ts @@ -3,7 +3,7 @@ import { Observable } from 'rxjs'; import { NewsService } from '../services/newsService'; import { News } from '../beans/news'; -// import {DomSanitizer} from '@angular/platform-browser' +import {DomSanitizer} from '@angular/platform-browser' @Component({ selector: 'home', @@ -15,17 +15,17 @@ export class Home implements OnInit { news: News[] = []; newsOfTheDay: News = {}; nextNews: News = {}; - //trustedUrl: string; + trustedUrl: string = ''; constructor( private newsService: NewsService, - // private sanitizer: DomSanitizer + private sanitizer: DomSanitizer ) {} ngOnInit() { // javascript: URLs are dangerous if attacker controlled. // Angular sanitizes them in data binding, but you can // explicitly tell Angular to trust this value: - //this.trustedUrl = this.sanitizer.bypassSecurityTrustUrl('javascript:alert("Don\'t forget to add a comment in the bottom please!")'); + this.trustedUrl = this.sanitizer.bypassSecurityTrustUrl('javascript:alert("Don\'t forget to add a comment in the bottom please!")'); this.updateNews(); } @@ -38,7 +38,7 @@ export class Home implements OnInit { this.newsOfTheDay = news; // uncomment the line below only for demo purpose, don't do this in a real situation // if you want to force a given scripting which you trust and is under you strict control (never from user input), use DomSanitizer#bypassSecurityTrustHtml(String) method - //this.newsOfTheDay.content = this.sanitizer.bypassSecurityTrustHtml(this.newsOfTheDay.content); + this.newsOfTheDay.content = this.sanitizer.bypassSecurityTrustHtml(''); }); }
Latest news from Web & Mobile Framework Team
{{currentNew.author}}{{currentNew.category}}{{currentNew.content}}