0

We have a JSP page and it has a table like below

enter image description here

We load the data into this table using a JDBC Query. Now, please consider the below.

  1. Each row display the data of a one single person.
  2. Each person has a unique ID called idPerson

Now, we need to track which row contains the data belongs to which person. To do that, we have to "attach" the idPerson to the rows somehow. We found the below way of doing that.

  1. Create a "hidden text box" for each row and set idPerson into its value or id attribute.

However not sure how secure this method is, or whether someone can simply edit the HTML from browser and hack in.

What is the recommended way of doing this?

Community
  • 1
  • 1
PeakGen
  • 21,894
  • 86
  • 261
  • 463

1 Answers1

1

Your approach can change to use a proper hidden field: <input type="hidden />. Now, your concern is about security:

not sure how secure this method is, or whether someone can simply edit the HTML from browser and hack in

This id without a context is useless for attackers. Think about it: what's the real value of id=1? You cannot do anything valuable with this. You can add security in other parts of your web application:

  • Use https to secure the communication between client and server.
  • Validate if the user is authenticated and authorized to access to this view.
  • Validate if the user has authorization to modify the fields being displayed.
  • Validate if the user has authorization to send the data for the fields being sent to the server.
  • Etc...

Apart of that, there's no problem on doing this.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332