Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda