Sanitizing an input is not a way to avoid problems with downloading requests and markup. Using the right form of shielding at the output stage ... or, even better, using a higher level tool that does this for you.
So, to prevent GQL query injection, use the GqlQuery parameter binding interface. To prevent markup injection against HTML (resulting in XSS), use the HTML escaping function of any template language that you use. For example, for Django templates, |escape ... or, better, {% autoescape on %} so you don't accidentally miss it.
bobince
source share