kurent
05-26-2009, 02:20 AM
For example we have an application with a java servlet that sends data as a response to a request. He sends something like this:
<info>Record found!</info>
<data>
<name>Peter</name>
<age>24</age>
</data>
But what if Peter is a naughty boy and instead of inputing his name he writes "<data>". Now the parser will get confused.
What is the best way of preventing this? The only option I see is to intentionally garble the tags, maybe even generate them randomly. So the improved version is <data_ogr8w31hf9q27sd> ... </data_ogr8w31hf9q27sd>
Now it is almost impossible to confuse the application.
Am I on the right track here?
<info>Record found!</info>
<data>
<name>Peter</name>
<age>24</age>
</data>
But what if Peter is a naughty boy and instead of inputing his name he writes "<data>". Now the parser will get confused.
What is the best way of preventing this? The only option I see is to intentionally garble the tags, maybe even generate them randomly. So the improved version is <data_ogr8w31hf9q27sd> ... </data_ogr8w31hf9q27sd>
Now it is almost impossible to confuse the application.
Am I on the right track here?