mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Fixed security breach in conversations system
This commit is contained in:
		@@ -290,3 +290,30 @@ function checkString(value){
 | 
				
			|||||||
	return true;
 | 
						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({
 | 
							var textMessage = createElem2({
 | 
				
			||||||
			appendTo: messageTargetElem,
 | 
								appendTo: messageTargetElem,
 | 
				
			||||||
			type: "span",
 | 
								type: "span",
 | 
				
			||||||
			innerHTML: messageInfos.message,
 | 
								innerHTML: removeHtmlTags(messageInfos.message), //Remove HTML tags
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Check if an image has to be added
 | 
							//Check if an image has to be added
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user