Security check for GreasyFork scripts (Local scan + AI analysis)
Purpose: This script is designed to help people with little programming or code analysis experience quickly assess the level of risk posed by a script they are installing from the GreasyFork website. When you go to the "CODE" tab for any script on the GreasyFork website, an automatic "static analysis" of the code is triggered. There is a feature This script performs a static analysis of the code (without running it), checking the source text for dangerous patterns, functions, and access to sensitive data. Here are the main groups of parameters it checks locally:
Similar to the "GreasyFork Code Safety Scanner" script, when you click the "Check in AI" (You must enter the API key for the AI engine you are using once.) button and select the AI engine you want except for the "Llama 🡒 Puter.js" option:
It sends the statistical findings regarding the locally verified code to the AI and receives a response in the selected language regarding the specific findings, assessing whether they are security-related or false positives. It can be used as an additional method of code verification. There is also a checkbox asking you to give the AI a brief description of the script being tested and to come up with a humorous conclusion about how it works :-)))
The code includes a flag TEST_MODELS_AVAILABLE = true/false to test which AI engines are available for use on the Groq and OpenRouter platforms, with the results displayed in the console.
The code also includes a flag, CLEAR_ALL_API_KEYS = true/false, to clear previously entered API keys for various AI engines from the browser’s storage.
Note 1: I would appreciate it if you could suggest how to modify the code lines for other AI systems or add additional checks to improve the script’s quality.
Note 2: I’m not a programmer, so please don’t criticize—just offer suggestions if you have any. I use the script for myself, but if it’s useful to anyone else, I’d be happy.