momosecurity / rhizobia_p Goto Github PK
View Code? Open in Web Editor NEWPHP安全SDK及编码规范
License: BSD 3-Clause "New" or "Revised" License
PHP安全SDK及编码规范
License: BSD 3-Clause "New" or "Revised" License
DefenseAgainstSSRF存在2点问题:
^_^ 占个坑,等有空了提pr
src/SecurityUtil.php 类中,如果要做单例是需要把 getinstance 方法的可见性设置为 protected 或者 private,如果不是单例,允许去new实例化,那是否应该在 __construct 方法中保证有和 getinstance 方法相同的逻辑
项目原demo,这样设置白名单的结果是允许跳转到protect.domain
的所有子域。
$white=[".protect.domain"];
if(!$this->securityUtil->verifyRedirectUrl($url,$white)){
return ; //非法url
}
// 处理业务逻辑
问题:
protect.domain
,不允许跳转到任何子域,那么该如何设置?$white=["protect.domain"];
来解决上述问题,会导致preg_match("/" . str_replace(".", "\\.", $item) . "$/i", $host)
这个校验可以被域名xxprotect.domain
绕过建议:
增加对单个域名的白名单支持
对输入容错,开发不够熟悉api的情况下传入了错误的参数,sdk应该对其进行处理,保证不出现安全漏洞
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.