dav*_*vid 7 css xss gradient angular
我正在尝试动态地在组件上设置渐变,并收到以下警告:
WARNING: sanitizing unsafe style value linear-gradient(#000,#00f) (see http://g.co/ng/security#xss).
这是一个最小的再现:
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<h1 [style.background]="(\'linear-gradient(#000,#00f)\')">My First Angular 2 App</h1>'
})
export class AppComponent {}
Run Code Online (Sandbox Code Playgroud)
我的谷歌搜索告诉我使用,bypassSecurityTrustStyle但在我知道之前我不喜欢这样做
这必须是动态的,因为我正在以编程方式构建渐变字符串.我不能为此使用css类.
它已在 Angular 2.4.4 中修复(https://github.com/angular/angular/blob/master/CHANGELOG.md#244-2017-01-19)
公关: https: //github.com/angular/angular/pull/13943/files
| 归档时间: |
|
| 查看次数: |
863 次 |
| 最近记录: |