首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在角13项目上运行checkmarx时,可能会在遗留浏览器上单击

在角13项目上运行checkmarx时,可能会在遗留浏览器上单击
EN

Stack Overflow用户
提问于 2022-04-04 08:21:31
回答 1查看 902关注 0票数 1

在运行角13项目的checkmarx报告时,报告了潜在的点击问题。即使我尝试使用app.component.html文件中的框架破坏脚本修复此问题,也会报告index.html的问题。有什么解决这个问题的建议吗?

  1. 方法:添加到index.html

中的框架破坏脚本

代码语言:javascript
运行
复制
<style> html {display : none; } </style>
<script>
    if ( self === top )

{         document.documentElement.style.display = 'block';     }
    else

{         top.location = encodeURI(self.location);     }
</script>
代码语言:javascript
运行
复制
 Result: One more high priority issue was raised: Client DOM open redirect

  1. 方法:在index.html

中向元标记添加框架祖先和CSP标记

代码语言:javascript
运行
复制
{{ <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' *.tech.orange; upgrade-insecure-requests;frame-ancestors 'none'; ">}}

{{}结果:问题持续存在

  1. 方法:为身份验证服务和auth-http拦截器

设置x帧选项

内部认证服务:

代码语言:javascript
运行
复制
const myheader = new HttpHeaders().set('Content-Type',CONTENT_TYPE ).set('Authorization', AUTH_AUTHENTICATION).set('Content-Security-Policy',CSP_TYPE); AUTH_AUTHENTICATION).set('Content-Security-Policy',CSP_TYPE).set('X-Frame-Options', 'SAMEORIGIN');;
Inside auth-http interceptor:
intercept(req: HttpRequest<any>, next: HttpHandler) { const token = this.tokenService.getToken(); if (token != null) { req = req.clone(

{ headers: req.headers.set('Authorization', 'Bearer ' + token) }
); req = req.clone(

{ headers: req.headers.set('Authorization', 'Bearer ' + token).set('X-Frame-Options', 'sameorigin') }
); }

结果:问题依然存在

  1. 方法:将头元标记内的X帧选项设置为单独的标记,以及CSP标记

代码语言:javascript
运行
复制
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' *.tech.orange; upgrade-insecure-requests;"> <meta http-equiv="X-Frame-Options" content="deny">

结果:问题依然存在

5)方法::按照下面的堆栈溢出建议,对早期方法中使用的框架破坏脚本进行修正:

Implementing Checkmarx suggested clickjacking fix introduces high severity Client DOM XSS vulnerability

代码语言:javascript
运行
复制
top.location = encodeURI(self.location);

结果:问题依然存在

6)方法:配置Nginx

若要配置Nginx以发送X框架选项头,请将其添加到您的http、服务器或位置配置中:

代码语言:javascript
运行
复制
add_header X-Frame-Options SAMEORIGIN always;

结果:问题依然存在

X-frame-options

  1. 方法:安装npm包

对角度的用法解释不充分

结果:无法核实

EN

回答 1

Stack Overflow用户

发布于 2022-11-29 03:36:38

代码语言:javascript
运行
复制
// Won't render the application if WebApp is under a Clickjacking attack

if(window. self === window.top) { //main File
  
} else{
<div>
    If you see this page,is under Clickjacking security attack.
  </div>
}

Also tested the above code with the below HTML in WebPage (test.html)

<html>
  <head>
    <title>Clickjack vulnerability test page</title>
  </head>
  <body>
    <iframe src="http://localhost:3000/" width="900" height="300"></iframe>
  </body>
</html>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71734022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档