Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@aegisjsproject/trusted-types
Advanced tools
A polyfill for the Trusted Types API
Client-side, or DOM-based, XSS attacks happen when data controlled by a user (such as that input into a form field) reaches a function that can execute that data. These functions are known as injection sinks. DOM-based XSS attacks happen when a user is able to write arbitrary JavaScript code and have it executed by one of these functions.
The Trusted Types API locks down risky injection sinks, requiring you to process the data before passing it to one of these functions. If you use a string, then the browser will throw a TypeError and prevent the use of the function.
Trusted Types works alongside Content-Security Policy
with the trusted-types
and require-trusted-types-for
directives.
The Trusted Types API locks down injection sinks that can act as a vector for DOM-XSS attacks. An injection sink is any Web API function that should only be called with trusted, validated or sanitized input. Examples of injection sinks include:
Trusted Types will force you to process the data before passing it to any injection sink rather than use a string. This ensures that the data is trustworthy.
[!IMPORTANT] Since the document cannot directly access HTTP headers, this polyfill requires either
<meta http-equiv="Content-Security-Policy">
or adata-trusted-policies
attribute to be set on<html>
.
The Trusted Types API gives web developers a way to lock down the insecure parts of the DOM API to prevent client-side Cross-site scripting (XSS) attacks.
trusted-types
: Polyfills the globalThis.trustedTypes
objectharden
: Overwrites "injection sink" property & attribute settersbundle
: Loads polyfill and conditionally "harden"s[v1.0.2] - 2024-09-19
@aegisjsproject/sanitizer
FAQs
A polyfill for the Trusted Types API
The npm package @aegisjsproject/trusted-types receives a total of 16 weekly downloads. As such, @aegisjsproject/trusted-types popularity was classified as not popular.
We found that @aegisjsproject/trusted-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.