Giter Site home page Giter Site logo

Comments (7)

Jieyab89 avatar Jieyab89 commented on May 17, 2024

image
image

from chatify-demo.

Jieyab89 avatar Jieyab89 commented on May 17, 2024

If the system is already right, only when it parses from append input to chat it has an xss bug

from chatify-demo.

munafio avatar munafio commented on May 17, 2024

Hi @Jieyab89 ,
I'll check this issue and fix it ASAP.
Thanks a lot for your efforts to make this package better.

from chatify-demo.

Jieyab89 avatar Jieyab89 commented on May 17, 2024

Solved, im fix xss in chat message, im create function for encoding

//create like htmlspecialchars in js
function escapeHtml(text) {
var map = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};

return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}

from chatify-demo.

Jieyab89 avatar Jieyab89 commented on May 17, 2024

in file code.js

from chatify-demo.

Jieyab89 avatar Jieyab89 commented on May 17, 2024

image
Create function htmlescape in code.js

Code :
//create like htmlspecialchars in js
function escapeHtml(text) {
var map = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};

return text.replace(/[&<>"']/g, function(m) { return map[m]; });

}
after you create the function you can call it, and call the function as needed,

For example, I called the htmlescape function in the message text area. You can check this

Example :

//create like htmlspecialchars in js
function escapeHtml(text) {
var map = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};

return text.replace(/[&<>"']/g, function(m) { return map[m]; });

}

// While sending a message, show this temporary message card.
function sendigCard(message, id) {
const body = escapeHtml(message);
return <div class="message-card mc-sender" data-id="+ id + "> <p>+ body + <sub><span class="far fa-clock"></span></sub></p> </div> ;
}

from chatify-demo.

Jieyab89 avatar Jieyab89 commented on May 17, 2024

Thank you munafio

from chatify-demo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.