Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/trusted-types
Advanced tools
TypeScript definitions for trusted-types
The @types/trusted-types npm package provides TypeScript type definitions for the Trusted Types API, which is a web security standard aimed at preventing Cross-Site Scripting (XSS) by restricting access to potentially dangerous DOM APIs. These type definitions allow developers to use Trusted Types in TypeScript projects with type checking and IntelliSense support.
Type Definitions for Trusted Types
This feature provides TypeScript type definitions for creating and manipulating Trusted Types, such as TrustedHTML, TrustedScript, and TrustedURL. The code sample demonstrates how to create a TrustedHTML type using a Trusted Types policy.
import { TrustedHTML, TrustedScriptURL } from 'trusted-types';
function createTrustedTypes(policyName: string): TrustedHTML {
const policy = trustedTypes.createPolicy(policyName, {
createHTML: (input) => input
});
return policy.createHTML('<div>Safe Content</div>');
}
DOMPurify is a library that sanitizes HTML and prevents XSS attacks. It does not have a dedicated TypeScript types package like @types/trusted-types, but it can be used in conjunction with @types/dompurify to achieve similar goals in terms of preventing XSS, albeit through sanitization rather than enforcing type safety.
npm install --save @types/trusted-types
This package contains type definitions for trusted-types (https://github.com/WICG/trusted-types).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trusted-types.
These definitions were written by Jakub Vrana, Damien Engels, Emanuel Tesar, Bjarki, and Sebastian Silbermann.
FAQs
TypeScript definitions for trusted-types
We found that @types/trusted-types demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.