1. Is it crazy?
Do not think so, but close by. We'll see.
2. Are there any sanitizer scripts for Javascript or good regex patterns for scanning warnings, iframes, deleted scripts and other malicious Javascript?
Yes, at least there is Google Caja and ADSafe for code disinfection, allowing it to isolate> . I do not know to what extent they are trustworthy.
3. If this process will be resolved manually (by the person checking Javascript)?
It is possible that the sandbox will be unsuccessful, so this will be a reasonable decision, depending on the risk and compromise with the attack of malicious (or faulty) code.
4. Would it be more prudent to allow users to use a framework (for example, jQuery) rather than provide them with access to actual Javascript? Thus, it would be easier to control.
JQuery is just Javascript, so if you are trying to protect against attacks, this will not help.
If it is imperative to prevent such attacks, you can implement a custom language, parse it in the backend, and create managed, secure javascript; or you might consider another strategy, such as providing an API and accessing it from a third-party component of your application.
Chubas
source share