refactor(backend): standardize errors and simplify configuration and test setup

This commit is contained in:
TakuyaYagam1 committed 2026-10-05 16:15:30 +03:00
1 parent 1535c19b8c
commit 138666a7bb
92 files changed
+3994 -210

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
// Static scanner fixtures. Never execute this file.
function dynamicCode(source: string) {
// ruleid: frontend-no-dynamic-code
eval(source);
// ruleid: frontend-no-dynamic-code
new Function(source);
// ruleid: frontend-no-dynamic-code
Function(source);
// ok: frontend-no-dynamic-code
JSON.parse(source);
}
function renderText(node: HTMLElement, text: string) {
// ruleid: frontend-no-document-write
document.write(text);
// ruleid: frontend-no-document-write
document.writeln(text);
// ruleid: frontend-no-inner-html-assignment
node.innerHTML = text;
// ruleid: frontend-no-inner-html-assignment
node.innerHTML += text;
// ok: frontend-no-inner-html-assignment, frontend-no-document-write
node.textContent = text;
// ok: frontend-no-inner-html-assignment
return <span>{text}</span>;
}
+82
View File
@@ -0,0 +1,82 @@
# Static scanner fixtures. Never import or execute this file.
import ast
import json
import pickle
import subprocess
import httpx
import requests
import yaml
from subprocess import run
from yaml import SafeLoader
def dynamic_code(source):
# ruleid: python-no-dynamic-code
eval(source)
# ruleid: python-no-dynamic-code
exec(source)
# ok: python-no-dynamic-code
ast.literal_eval(source)
# ok: python-no-dynamic-code
json.loads(source)
def yaml_data(source):
# ruleid: python-safe-yaml-loader
yaml.load(source)
# ruleid: python-safe-yaml-loader
yaml.load(source, Loader=yaml.Loader)
# ruleid: python-safe-yaml-loader
yaml.load_all(source, Loader=yaml.UnsafeLoader)
# ok: python-safe-yaml-loader
yaml.safe_load(source)
# ok: python-safe-yaml-loader
yaml.safe_load_all(source)
# ok: python-safe-yaml-loader
yaml.load(source, Loader=yaml.SafeLoader)
# ok: python-safe-yaml-loader
yaml.load(source, Loader=SafeLoader)
# ok: python-safe-yaml-loader
yaml.load(source, yaml.CSafeLoader)
# ok: python-safe-yaml-loader
yaml.load_all(source, Loader=yaml.SafeLoader)
def processes(command):
# ruleid: python-no-subprocess-shell
subprocess.run(command, shell=True, check=True)
# ruleid: python-no-subprocess-shell
subprocess.Popen(command, shell=True)
# ruleid: python-no-subprocess-shell
run(command, shell=True)
# ok: python-no-subprocess-shell
subprocess.run(["tool", command], check=True)
# ok: python-no-subprocess-shell
subprocess.run(["tool", command], shell=False, check=True)
def http_clients(url):
# ruleid: python-no-disabled-tls
requests.get(url, verify=False, timeout=5)
# ruleid: python-no-disabled-tls
httpx.post(url, verify=False)
# ruleid: python-no-disabled-tls
httpx.Client(verify=False)
# ruleid: python-no-disabled-tls
httpx.AsyncClient(verify=False)
# ok: python-no-disabled-tls
requests.get(url, verify=True, timeout=5)
# ok: python-no-disabled-tls
httpx.Client()
# ok: python-no-disabled-tls
httpx.get(url, verify="certificates.pem")
def serialized_data(source, file):
# ruleid: python-no-pickle-load
pickle.loads(source)
# ruleid: python-no-pickle-load
pickle.load(file)
# ok: python-no-pickle-load
json.loads(source)