How can I allow WYSIWYG editors and disable XSS attacks using Laravel?

前端 未结 5 1164
你的背包
你的背包 2021-02-08 22:31

I have a enterprise level application where logged in users are authorized to post articles to page using a WYSIWYG editor. (You can consider this application as a website build

5条回答
  •  死守一世寂寞
    2021-02-08 23:28

    You can use a tag system similar to the BBCode or Markdown to allow your users to do certain operation. This way, you can be sure the input will be sanitized against EVERY kind of malicious script, just use a lexer and a XSS protection when displaying user content.

    EDIT: To see what i mean, you can use CKEditor as your WYSIWYG editor, in conjunction with the BBCode plugin:

提交回复
热议问题