chechogrom's avatar

How to avoid xss attacks, some ideas?

Hello everyone, I want all the forms, which I have in my system before saving the information to first go through a package that I install (https://github.com/stevebauman/purify), I would like you to give me ideas on how I can implement this functionality, I would like to get rid of xss attacks on my system, the package helps with this, thanks in advance to all who can help me

0 likes
3 replies
jlrdw's avatar

You do not need an outside package for that.

Use blade, validation, and if you really worried just strip_tags.

1 like
Snapey's avatar
Snapey
Best Answer
Level 122

purify the fields as you store them

eg.

$post->title = Purify::clean($request->title);

and make sure you always use {{ }} when outputting strings

1 like
bugsysha's avatar

I would go with validation. Just define everything as specific as you can and you should be all good.

1 like

Please or to participate in this conversation.