I created an ephemeral group chat app for strangers
commonroom.chat
commonroom.chat
Edit: this focuses on script tags and other means to inject code, but most defenses also work for other injected tags
first time figuring out opsec !
What chat I did get really recreated the 14 year old edgelords in chatrooms experience though. Lots of porn gif spamming
I'm trying to replicate the feeling of a hostel commonroom
const chatMessage = document.createElement("div");
chatMessage.classList.add("chat-message");
chatMessage.innerHTML = `<span class="username" style="color: ${color};">${username}:</span> `;
const userMessage = document.createElement('span');
span.innerText = message;
chatMessage.appendChild(userMessage);
chatContainer.appendChild(chatMessage);
chatContainer.scrollTop = chatContainer.scrollHeight;You really think some rando that spins up a web server is significantly more trustworthy that a rando in a chat channel? Of course not, they're the same people.
I couldn't figure out what my username was, I had to ask in the chat.
It's possible to embed recursive iframes, so I can see that being exploited for bad things.
Otherwise I like the idea. People in the chat were nice, but I can't help but think that soon chat rooms will be full of chatGPT bots and nobody will be any the wiser!
So far from users I've heard they want:
1) username visibility fix making sure all colors are visible 2) removal of xss 3) ability to see your own username (its just "you" rn) 4) dark mode
open to any and all suggestions :) my first full stack app. its cool seeing it being used
[b]bold[/b] [i]italic[/i] [img]example.com/image.jpg[/img] [youtube]youtube.com/watch?v=someVideo[/youtube]
function asTextContent(input) {
const tempElement = document.createElement('span');
tempElement.textContent = input;
return tempElement.innerHTML;
}
It will let the browser handle the escaping.The author of the site was naughty and didn't do any sanitization :) They said they've fixed it in another comment, though.