课程: Secure Coding in Go

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Cross-site scripting?(XSS)

Cross-site scripting?(XSS) - Go教程

课程: Secure Coding in Go

Cross-site scripting?(XSS)

- [Instructor] XSS stands for cross-site scripting. It's a way for attackers to inject client-side scripts to webpages viewed by other users. On October, 2005, Samy Kamkar released an XSS worm called Samy on the MySpace social network. In about 20 hours, more than 1 million users ran the worm. Lucky for these users, the worm was mostly harmful. It displayed a message saying, "Samy is my hero," on their MySpace profile. Let's see an example. Say you're displaying your messages for the users. So we have the HTML template which gives a title and a header, and then how many messages, and finally, the messages. A message has a time, from and the content. And we can format the message, so we get the bytes.Buffer. We go over the messages, print them out into the buffer in a format for HTML, and finally, return this thing. And here is our web handler. The web handler extracts the user from the path, then load the…

内容