Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!