This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Securing URL parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Securing URL parameters" Watch "Securing URL parameters" New topic
Author

Securing URL parameters

Alok Pota
Ranch Hand

Joined: Mar 07, 2001
Posts: 185
Often a url parameter contains the id/guid of an object that one
wishes to access. i.e., http://.../servlet/Test?GUID="25IUYEUEU"
is there a way to secure these parameters passed. Currently
we encrypt the GUID on a per session basis and then pass it on
the URL, the recieving servlet then decrypts the GUID and then uses it. The concern is that because the encryption is session]
based, one could use the same encrypted key through out the session to access other parts of the application.
Is there a cool way to this...?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The scenario you pointed out represents a HTTP GET operation. This is generally not good for sensitive areas since 1) the values can be read in the URL and the URL can leave footprints in the machines it passes on the way to its destination.
What you are looking for is the POST operation. The difference is that all the data sent is stored inside the HTTP header, so if the page is encrypted the header (and therefore transmitted data) is as well.
The easiest way to accomplish this:

As a rule of thumb, if the page is one a user can bookmark then use GET or URL rewriting, if you are transmitting user or other data use POST.
Dave.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Securing URL parameters