AppScan 扫描出漏洞 'Content-Security-Policy' 中缺少 'Style-Src' 或 'Default-Src' 策略或相应策略不安全,服务器的域名为 https://172.16.15.87:8444,并且允许 https://172.16.15.87:8090 访问,如何通过 Nginx 处理内容?

可以通过在 Nginx 配置文件中添加以下内容来解决该漏洞:

add_header Content-Security-Policy 'default-src https: 'unsafe-inline' 'unsafe-eval'; style-src https: 'unsafe-inline';';

这将为 Content-Security-Policy 添加默认源和样式源,以确保安全性。

同时,还需要在 Nginx 配置文件中添加以下内容,以允许 https://172.16.15.87:8090 访问:

location / {
    add_header 'Access-Control-Allow-Origin' 'https://172.16.15.87:8090';
    add_header 'Access-Control-Allow-Credentials' 'true';
    # 其他配置项
}

这将允许 https://172.16.15.87:8090 访问该服务器,并允许传递凭据。然后重新启动 Nginx 服务,使配置生效。

AppScan 漏洞修复:解决 'Content-Security-Policy' 中缺少 'Style-Src' 或 'Default-Src' 策略问题

原文地址: https://www.cveoy.top/t/topic/oBiS 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录