Sanitization of User-Supplied Regular Expressions in PHP

前端 未结 5 858
盖世英雄少女心
盖世英雄少女心 2020-12-20 21:03

I want to create a website where users can test regular expressions (there are many out there already...such as this one: http://www.pagecolumn.com/tool/pregtest.htm). Basic

5条回答
  •  再見小時候
    2020-12-20 21:50

    If you allow user-submitted values for preg_replace make sure you disallow the e flag! Not doing so could allow a malicious user to delete your entire site, or worse.

    Otherwise, the worst thing that can happen is what the other answers already point out. Set a low script timeout, and maybe you should even make sure that the page can only be called X times per minute.

提交回复
热议问题