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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Securing URL parameters" Watch "Securing URL parameters" New topic

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

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.
I agree. Here's the link:
subject: Securing URL parameters
jQuery in Action, 3rd edition