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.
An extensible Redis-over-WebSocket API on top of websockets and aioredis.
For basic functionality:
pip install redis_websocket_api
With geo extension (filtering messages by extent, projection transformation):
pip install redis_websocket_api[geo]
For a quick test you can run
python -m redis_websocket_api
to start a simple redis websocket api on ws://localhost:8765
.
This does roughly the equivalant of:
from aioredis import from_url
from redis_websocket_api import WebsocketServer, WebsocketHandler
class PublishEverythingHandler(WebsocketHandler):
def channel_is_allowed(self, channel_name):
return True
WebsocketServer(
redis=from_url("redis:///", encoding="utf-8", decode_responses=True),
read_timeout=30,
keep_alive_timeout=120,
handler_class=PublishEverythingHandler,
).listen(
host='localhost',
port=8000,
channel_patterns=["[a-z]*"],
)
Have a look at examples/demo.py
for an example with the GeoCommandsMixin
added.
WebsocketHandler
The default functionality provides the following interface to the web client (expecting the requests over a websocket connection):
GET key
translates to hvals key
GET key hkey
translates to hget key hkey
SUB key
subscribes the websocket to a redis channel (using a single redis
connection pool for all clients)DEL key
unsubscribes the client from the channelPING
causes a PONG
response (to avoid timeouts)WebsocketHandler
with GeoCommandsMixin
addedBy adding the GeoCommandsMixin
the web client can use
BBOX left bottom right top
to only receive GeoJSON features within this box
plus all messages which are not valid GeoJSONPROJECTION epsg:number
causes all future GeoJSON features to be transformed
to the given projectionSee examples/demo.py
for how to use an extended WebsocketHandler
subclass.
Geo commands are currently limited to LineString
, Polygon
, and Point
geometries.
Note that the projection input and output coordinates will use the traditional GIS order,
that is longitude, latitude for geographic CRS and easting, northing for most projected CRS.
If you want the input and output axis order to strictly follow the definition of the CRS,
use StrictAxisOrderGeoCommandsMixin
instead of GeoCommandsMixin
.
Using the commands listed above for communicating from client to server is
completly optional and determinded by the Mixin classes added to the
WebsocketHandlerBase
.
FAQs
Redis-over-WebSocket API on top of websockets and aioredis
We found that redis-websocket-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
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.