We do this for XSRF protection. Basically you should be able to subvert the web sudo mechanism via a HTTP header.
This posts shows the use case
I believe it just as secure since web sudo is really design to stop some one using your browser (directly or via XSRF) to perform admin actions as you.
Scripts don't suffer this problem. The need your username and password to run at all.