I am writing an internal tool that will support plugins written by other developers. Ideally, these plugins would have a Javascript component to allow people to make widgets. Some of the pages these widgets operate on may contain sensitive data. What I want to avoid is the developer writing a plugin that has javascript which posts this data to some external server. However, it is essential to the operation of these widgets that they can manipulate the data on the page. Basically these widgets should only be able to effect the presentation of the data, but they should not be able to steal it.
I have looked at adsafe, but this is too restrictive because these widgets can only manipulate the dom provided by the adsafe widget, and so could not access the data they need. I also looked at Google Caja, which might be an okay solution, though its cross compilation would make the code execute slower in a performance critical environment (I have also not played with it, so I don't know specifically if I can use it to avoid posting).
I think the "ideal" solution might be some kind of static analysis tool that can eliminate "just" programs that try to contact an external server, but I welcome any suggestions that could work.