Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
How to prevent bypass with markdown (Word blacklist system)

I've created a word-blacklist system that works decently, I remove all spaces from the message content, then use regex to match for blacklisted words, and if there's a match, delete the message.

const msgContent = message.content.replace(/\s/g, '');

let foundBlacklist = false;

for (const word of data.Words) {
   const regex = new RegExp(`${word}`, 'gi');
   if (regex.test(msgContent)) {
     foundBlacklist = true;
   }
}

if(foundBlacklist) message.delete().catch(err => console.log(`There was an error trying to delete that message: ${err}`))

The problem is that it's very easy to use markdown to bypass this, if bad is a blacklisted word, simply doing b*a*dto to make it italic, would make the message content b*a*d, and the regex won't match. This of course applies to underline, strikethrough ... etc, where b__ad__ or **b**ad etc won't match either.

How could this be prevented?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda