AppEngine makes some guarantees about specific headers in tasks. Specifically, a set of headers such as X-AppEngine-QueueName
are not able to be set by a user.
These headers are set internally by App Engine: If an external user request attempts to set these headers, they are removed. Therefore, if your request handler finds any of these headers in a request, that task queue request is guaranteed to be valid.
It appears that both web frameworks provided by GAE (webapp
and webapp2
) have Request
objects that inherit from webob.Request
. Unfortunately, as far as I can tell, webob.Request
only exposes the headers in a case-insensitive way. Does AppEngine guarantee that a user is unable to provide those request headers in a case-insensitive way?
In other words, can a user set a X-AppEngine-Queuename
header on the request and have it passed through (at which point, webob
would not be able to distinguish between that header and the real one provided by GAE)?
In the webapp2
framework, how do I guarantee that my request originated as a task and not as the result of a malicious user?