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

198
Visualizações
Web Security: Is is safe to store MongoDB _id values on HTML elements?

Hello awesome developers! I have a security related question. I have been storing important information into HTML buttons so that I can retrieve that information when I call an event. I do this by passing the element into the event using the 'this' keyword. Here is an example in using EJS.

<% if (categories.length > 0) { %>
        <table>
            <tr>
                <th>Category</th>
                <th>Description</th>
                <th>Function</th>
            </tr>
            <% categories.forEach(category => { %>
                <tr>
                    <td><%=category.name%></td>
                    <td><%=category.description%></td>
                    <td>
                        <button env=<%=NODE_ENV%> _id=<%=category._id%> onclick='deleteCategory(this)'>Delete</button>
                    </td>
                </tr>
            <% }) %>
        </table>
    <% } %>

the button has my category._id attached to it. Is this bad practice and does it pose a security risk?

Thank you so much for your time, I just want to be sure I am doing things in the 'correct' manner.

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