
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
github.com/middlewares/minifier
Middleware to minify the Html
, CSS
and Javascript
content using wyrihaximus/compress and the following compressors by default:
This package is installable and autoloadable via Composer as middlewares/minifier.
composer require middlewares/minifier
Dispatcher::run([
Middlewares\Minifier::html(),
Middlewares\Minifier::css(),
Middlewares\Minifier::js(),
]);
This middleware minify the code of http responses using any compressor implementing the WyriHaximus\Compress\CompressorInterface
. The code format is detected from the Content-Type
header, so make sure your responses contains this header (you may want to use middlewares/negotiation for that).
use WyriHaximus\HtmlCompress\Factory;
$compressor = Factory::construct();
$mimeType = 'text/html';
$minifier = new Middlewares\Minifier($compressor, $mimeType);
Optionally, you can provide a Psr\Http\Message\StreamFactoryInterface
as third argument to create the response body. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.
$streamFactory = new MyOwnStreamFactory();
$minifier = new Middlewares\Minifier($compressor, $mimeType, $streamFactory);
Three static functions are provided to create instances of this middleware with common configuration for html, css and js responses:
$htmlMinifier = Middlewares\Minifier::html();
$cssMinifier = Middlewares\Minifier::css();
$jsMinifier = Middlewares\Minifier::js();
Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
FAQs
Unknown package
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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.