相对路径样式表导入漏洞 [英] Path-relative style sheet import vulnerabilities

查看:64
本文介绍了相对路径样式表导入漏洞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为避免路径相对的样式表导入漏洞,我应该使用完整路径将css文件附加到页面上,例如

To avoid path-relative style sheet import vulnerabilities should I attach css file on my page using full path e.g.

<link href="http://mywebsite/style.css" type="text/css" rel="stylesheet" />

代替

<link href="style.css" type="text/css" rel="stylesheet" />

您怎么看?

推荐答案

只需添加一个斜杠并使路径相对于根,而不是此漏洞所依赖的相对路径.
不需要域名/方案.

Just add a leading slash and make the path root-relative, rather than relative which this vulnerability relies on.
No need for the domain / scheme.

 <link rel="stylesheet" href="/style.css">

这篇关于相对路径样式表导入漏洞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆