api-design-first
Warn
Audited by Socket on Nov 16, 2026
1 alert found:
AnomalyAnomalyreferences/api-error-handling/examples/ApiClient.js
LOWAnomalyLOW
references/api-error-handling/examples/ApiClient.js
No clear malicious payload/backdoor behavior is present in this snippet. However, it contains a significant client-side security weakness: it renders untrusted server-provided error/validation messages into SweetAlert2 using the html option without escaping or sanitization, creating a realistic DOM XSS risk. Because the module also uses a Bearer token stored in localStorage and automatically attaches it to requests, any successful XSS in the context of the application could enable token theft and account compromise. Additionally, authenticated request routing depends on caller-controlled baseUrl/endpoint and should be tightly controlled elsewhere.
Confidence: 70%Severity: 64%
Audit Metadata