EDIT: Or how about just adding an in-line Javascript variable? Say, on all Gmail pages, you could embed this in the page:
<script>var SECURITY_KEY = "918028cd79a5ba47e83e6ba68d036ca3";</script>
And then when sending AJAX or form requests in the background, make sure to include that as a request parameter. That way, even if the user has the right authentication cookies, external websites won't be able to fool Gmail into thinking they are Gmail.Really, this doesn't seem like a very hard problem to solve...couple lines of code...