mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
xss 问题修复
This commit is contained in:
parent
eb939b0e3f
commit
66a1f910b0
@ -157,6 +157,13 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
||||
...tempStyle,
|
||||
...style
|
||||
};
|
||||
|
||||
const finalSrc = src ? buildApi(src, data).url : undefined;
|
||||
|
||||
if (typeof finalSrc === 'string' && /javascript\:/.test(finalSrc)) {
|
||||
return <p>请填写合法的 iframe 地址</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<iframe
|
||||
className={className}
|
||||
@ -164,7 +171,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
||||
style={style}
|
||||
ref={this.IFrameRef}
|
||||
onLoad={this.onLoad}
|
||||
src={src ? buildApi(src, data).url : undefined}
|
||||
src={finalSrc}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user