
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@mapbox/css-sieve
Advanced tools
Sift CSS through HTML.
Parses HTML with Cheerio — using its jQuery-like selector queries — to determine which selectors in the CSS correspond to actual elements on the page. Removes selectors that have no corresponding elements, rules that have no corresponding selectors, at-rules containing no corresponding rules, etc.
Also, for good measure, runs the CSS through postcss-discard-unused, which removes unused @counter-style
, @keyframes
, and @font-face
at-rules.
cssSieve.sift(css: string, html: string): Promise<string>
Returns a Promise that resolves with the fragment of css
that has corresponding elements in the provided html
.
cssSieve.plugin({ html: string })
Returns a PostCSS plugin function that you can use wherever you run PostCSS.
For more details about how to use PostCSS plugins, read the PostCSS documentation.
The tests are very simple. In fact, there's just one Jest snapshot test at the moment, which provides 100% code coverage. We can add more to the CSS and HTML fixtures, as needed, to test other scenarios and code changes; and Jest handles the comparison and offers a nice legible read-out of what went wrong.
Yes. This is essentially a simplified version of what UnCSS does. Instead of using PhantomJS or jsdom to load the page, try to size things, download resources, etc., this module address the core problem of filtering out CSS that is not used in some HTML. This is a low-level module that could be used within other, higher-level projects (e.g. ones that download resources).
Another project that uses Cheerio to filter out unused CSS is css-razor.
FAQs
Sift CSS through HTML
The npm package @mapbox/css-sieve receives a total of 6 weekly downloads. As such, @mapbox/css-sieve popularity was classified as not popular.
We found that @mapbox/css-sieve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 148 open source maintainers 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.