How can I allow my user to insert HTML code, without risks? (not only technical risks)

后端 未结 10 830
一生所求
一生所求 2020-12-09 05:41

I developed a web application, that permits my users to manage some aspects of a web site dynamically (yes, some kind of cms) in LAMP environment (debian, apache, php, mysql

10条回答
  •  遥遥无期
    2020-12-09 06:09

    If it is too difficult removing the tags you could reject the whole html-data until the user enters a valid one. I would reject html if it contains the following tags:

    frameset,frame,iframe,script,object,embed,applet.

    Also tags which you want to disallow are: head (and sub-tags),body,html because you want to provide them by yourself and you do not want the user to manipulate your metadata.

    But generally speaking, allowing the user to provide his own html code always imposes some security issues.

提交回复
热议问题