mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Fixed security breach in conversations system
This commit is contained in:
		@@ -290,3 +290,30 @@ function checkString(value){
 | 
			
		||||
	return true;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Remove HTML carachters : < and >
 | 
			
		||||
 * 
 | 
			
		||||
 * @param {String} input The string to change
 | 
			
		||||
 * @return {String} The updated string
 | 
			
		||||
 */
 | 
			
		||||
function removeHtmlTags(input){
 | 
			
		||||
	
 | 
			
		||||
	//Prepare update
 | 
			
		||||
	var output = input;
 | 
			
		||||
	
 | 
			
		||||
	//Replace opening braces
 | 
			
		||||
	while(output.includes("<")){
 | 
			
		||||
		//Replace an occurence
 | 
			
		||||
		output = output.replace("<", "<");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//Replace closing braces
 | 
			
		||||
	while(output.includes(">")){
 | 
			
		||||
		//Replace an occurence
 | 
			
		||||
		output = output.replace(">", ">");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	//Return result
 | 
			
		||||
	return output;
 | 
			
		||||
}
 | 
			
		||||
@@ -789,7 +789,7 @@ ComunicWeb.components.conversations.chatWindows = {
 | 
			
		||||
		var textMessage = createElem2({
 | 
			
		||||
			appendTo: messageTargetElem,
 | 
			
		||||
			type: "span",
 | 
			
		||||
			innerHTML: messageInfos.message,
 | 
			
		||||
			innerHTML: removeHtmlTags(messageInfos.message), //Remove HTML tags
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		//Check if an image has to be added
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user