javascript - Is putting an objects id in the html okay? -
this question has answer here:
i have complex object foo.
in view list these objects user can see them , each gives basic info it's title description , status.
each has edit button , when button click trying pre-populate form on page them edit it, don't have information object on page going make ajax call , json representation of object. can fill in form json.
so question if hide object id in class or id of div way can pass along ajax call considered bad practice / security vulnerability? since user can see id if @ html.
<c:foreach var="foo" item="${foos}"> <div class="foo-${foo.id}"> <span>${foo.title}</span> <span>${foo.description}</span> <span>${foo.status}</span> <a class="edit-btn" href="#">edit</a> </div> </c:foreach>
based on comments @musefan , @mastov fine this. it's better practice put in data attribute. better server side validation if have restriction on can see what.
Comments
Post a Comment