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.
github.com/nrk/predis-async
Asynchronous (non-blocking) version of Predis, the full-featured PHP client library for Redis, built on top of React to handle evented I/O and phpiredis to serialize and parse the Redis protocol with the speed benefits of a C extension.
Predis\Async is currently under development but already works pretty well. The client foundation is being built on top of the event loop abstraction offered by React, an event-oriented framework for PHP that aims to provide everything needed to create reusable libraries and long-running applications using an evented approach powered by non-blocking I/O.
Contributions are highly welcome and appreciated, feel free to open pull-requests with fixes or just report issues if you encounter weird behaviors and blatant bugs.
MULTI
/ EXEC
transactions (Redis >= 2.0).PUBLISH
/ SUBSCRIBE
contexts (Redis >= 2.0).MONITOR
contexts (Redis >= 1.2).Predis\Async is available on Packagist and it requires that phpiredis is pre-installed and loaded in your PHP configuration or it will not be installed by Composer.
<?php
require __DIR__.'/../autoload.php';
$loop = new React\EventLoop\StreamSelectLoop();
$client = new Predis\Async\Client('tcp://127.0.0.1:6379', $loop);
$client->connect(function ($client) use ($loop) {
echo "Connected to Redis, now listening for incoming messages...\n";
$logger = new Predis\Async\Client('tcp://127.0.0.1:6379', $loop);
$client->pubsub('nrk:channel', function ($event) use ($logger) {
$logger->rpush("store:{$event->channel}", $event->payload, function () use ($event) {
echo "Stored message `{$event->payload}` from {$event->channel}.\n";
});
});
});
$loop->run();
Being an asynchronous client implementation, the underlying design of Predis\Async is different from the one of Predis which is a blocking implementation. Certain features have not been implemented yet (or cannot be implemented at all), just to name a few you will not find the usual abstractions for pipelining commands and creating cluster of nodes using client-side sharding. That said, they share a common style and a few basic classes so if you used Predis in the past you should feel at home.
If you want to work on Predis\Async, it is highly recommended that you first run the test suite in
order to check that everything is OK, and report strange behaviours or bugs. When modifying the code
please make sure that no warnings or notices are emitted by PHP by running the interpreter in your
development environment with the error_reporting
variable set to E_ALL | E_STRICT
.
The recommended way to contribute to Predis\Async is to fork the project on GitHub, create new topic branches on your newly created repository to fix or add features (possibly with tests covering your modifications) and then open a new pull request with a description of the applied changes. Obviously you can use any other Git hosting provider of your preference.
Please follow a few basic commit guidelines before opening pull requests.
The code for Predis\Async is distributed under the terms of the MIT license (see LICENSE).
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
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.