598 Commits (887e0ec73fcea5c68aee2adb32db92f80519cad9)
 

Author SHA1 Message Date
Jessie Murray 887e0ec73f
Only call ws_client_free once all scheduled events have triggered
Fixes #209. A WS client socket closure could cause Webdis to schedule
the send of a closing frame, leading to both EV_READ and EV_WRITE
scheduled events. They would both fail and each lead to a call to
ws_client_free, causing a double free that ends in a crash.
3 years ago
Jessie Murray 55128ae263
Fix http_parser check for architectures with unsigned chars
http_parser.c has a table named "unhex" that it uses to convert hex
characters to their numeric values, e.g. 'F' -> 15. For non-hex
characters, the value is -1 but while the table contains int8_t values,
the extraction is done using a char. On ARMv8, char is *unsigned*, which
means it can't be compared to -1 as this is always false. Comparing to
(char)-1 instead will work.
3 years ago
Nicolas Favre-Felix 74d4092ac6
Merge pull request #205 from jessie-murray/http-improvements 3 years ago
Jessie Murray 7ce6d497c1
Add HEADER_CHECK_DUPE to bypass duplicate check
Almost all header entries are guaranteed to be added only once, so we
don't need to check for duplicates all the time. In the current code
base only Content-Length has the potential for being added twice, and
even then it seems highly unlikely. For all others, we can now bypass
this check.
This commit also changes the header_copy flags to be 1-bit flags, so
that they can be combined.
3 years ago
Jessie Murray dc9d1b646e
Avoid re-allocating headers array in http_response
Allocate the headers array once with the default number of entries
sufficient for most requests, and only re-allocate if needed instead of
re-allocating with each header.
3 years ago
Jessie Murray c7c6fc010f
Avoid copying header strings for http_response
http_response has an array of http_header key/value pairs, and most of
the time these use constant strings that do not need to be copied and
re-allocated. This change adds a flag tracking which values need to be
copied, were copied and need to be freed.
3 years ago
Nicolas Favre-Felix 93e96565a6
Update Dockerfile for Webdis 0.1.18.1 3 years ago
Nicolas Favre-Felix bb98f6113c
Add link to tutorial on Redis & Webdis in Docker Compose with SSL 3 years ago
Nicolas Favre-Felix b5841037c8
Update docker images referenced in the README to the latest version (0.1.18) 3 years ago
Nicolas Favre-Felix 173ce15308
Version bump after release 3 years ago
Nicolas Favre-Felix a12c39a6f3
Release 0.1.18
New feature: support for SSL connections to Redis.

Webdis can now connect securely to Redis, thanks to the Hiredis
client library. Docker images for Webdis will now contain two binaries,
"webdis" and "webdis-ssl", the latter depending on OpenSSL.

See Webdis README for details: https://github.com/nicolasff/webdis#configuring-webdis-with-ssl
3 years ago
Nicolas Favre-Felix 277e6fc303
Update Dockerfile to build webdis with SSL support
Two binaries are built and packaged:
* /usr/local/bin/webdis -- still without SSL and does not depend on
  OpenSSL
* /usr/local/bin/webdis-ssl -- supports SSL, depends on OpenSSL but has
  to be used with the webdis image as a base image or in a container
  injecting the webdis config and certs.
3 years ago
Nicolas Favre-Felix 119ebc85b6
Merge branch 'redis-ssl' into 'master' (fixes #201) 3 years ago
Jessie Murray 863d003531
Review comments 3 years ago
Jessie Murray 8e9dcda928
Document SSL configuration and troubleshooting 3 years ago
Jessie Murray 1e9f6048e8
Add config parsing 3 years ago
Jessie Murray 83fe141f7e
Encrypt connections to Redis
Initialize SSL, use SSL context with each connection, enable flags in
Makefile.
TODO: read config into s->cfg, still missing for now
3 years ago
Jessie Murray 524e0245c1
Fix warnings introduced by type change due to Hiredis upgrade 3 years ago
Jessie Murray fc671090cd
Mark unused functions in Hiredis dict.c
Add back __UNUSED_FUNCTION__ dropped in Hiredis upgrade.
3 years ago
Jessie Murray c943844451
Upgrade Hiredis to v1.0.2 3 years ago
Nicolas Favre-Felix 73fb3b68ff
Update docker images in README, add ECR trust details
1. Update docker images referenced in the README to latest version
 2. Add paragraph + tutorial about content trust and ECR
3 years ago
Nicolas Favre-Felix 10e1c40a5f
Version bump after release 3 years ago
Nicolas Favre-Felix 942be1fd54
Release 0.1.17.1 (Fixes Redis vulnerabilities)
Security update: upgrading the version of Redis bundled in
the Webdis image to fix a number of severe vulnerabilities.

* Low severity vulnerability found in redis/redis
  Description: Integer Overflow or Wraparound
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727801
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* Medium severity vulnerability found in redis/redis
  Description: Out-of-bounds Read
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727803
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* High severity vulnerability found in redis/redis
  Description: Allocation of Resources Without Limits or Throttling
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727783
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* High severity vulnerability found in redis/redis
  Description: CVE-2021-32626
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727820
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* High severity vulnerability found in redis/redis
  Description: Integer Overflow or Wraparound
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727822
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* High severity vulnerability found in redis/redis
  Description: Integer Overflow or Wraparound
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727823
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* High severity vulnerability found in redis/redis
  Description: Integer Overflow or Wraparound
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727825
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0

* High severity vulnerability found in redis/redis
  Description: Integer Overflow or Wraparound
  Info: https://snyk.io/vuln/SNYK-ALPINE314-REDIS-1727826
  Introduced through: redis/redis@6.2.5-r0
  From: redis/redis@6.2.5-r0
  Fixed in: 6.2.6-r0
3 years ago
Nicolas Favre-Felix 9bbe0d3389
Update docker images referenced in the README to the latest version (0.1.17) 3 years ago
Nicolas Favre-Felix ad0e14c3df
Version bump after release 3 years ago
Nicolas Favre-Felix 8430eadc29
Release 0.1.17
* Many improvements to WebSocket implementation (#198, #199). WebSocket
  support is now much more stable, and better tested. The feature is
  still disabled by default, but is recommended for testing.
* Base image updated from Alpine 3.12.7 to 3.14.2 to resolve
  vulnerabilities found in Alpine. Webdis itself is not at risk, but
  images *based* on Webdis could be using vulnerable software if they
  use packages from Alpine 3.12.7.
3 years ago
Nicolas Favre-Felix 871992d4aa
Update base image from alpine 3.12.7 to 3.14.2 3 years ago
Jessie Murray 3aaeabfcd3
CodeQL: Poorly documented large function
Document conf_read a bit more, and add some error reporting + 2 missing
free() calls. The leak was insignificant, only happening once at
startup.
3 years ago
Jessie Murray d2b115616f
CodeQL: Potentially uninitialized local variable
This is not really uninitialized, it would only happen if the string
dumped with dump_string was empty of contained invalid UTF-8. Setting
an initial value has no effect since codepoint is used as an "out"
value in utf8_iterate.
3 years ago
Nicolas Favre-Felix b1b300f508
README: document WebSocket demo, add links, minor cleanup 3 years ago
Nicolas Favre-Felix 35a2598760
Report invalid config keys or value types 3 years ago
Nicolas Favre-Felix 97d9d77430
Add Makefile section to detect msgpackc with ld
If all checks fail, use ld to look for -lmsgpackc. This doesn't work on
macOS, but seems to pick up installs that were as of yet undetected.
3 years ago
Nicolas Favre-Felix 0528287aa6
Merge pull request #199 from jessie-murray/ws-improvements 3 years ago
Jessie Murray a8612e846e
Close fd if needed in ws_client_free 3 years ago
Jessie Murray 33b2923b3a
Make sure to reserve enough space for large frames
Add description of header and increase header size from 8 to 14 bytes.
3 years ago
Jessie Murray 3be189b527
Use macro for htonll/ntohll for portability
I realized that these functions are not standard, so this is bringing
macros back for the 64-bit transforms.
3 years ago
Jessie Murray e213af3226
Fix for WebSocket payload length using 8 bytes
The 8-byte conversion macros were incorrect, and could be replaced with
standard methods instead. This also adds a test to cover this case.
3 years ago
Jessie Murray 7f09680c86
Fix ResourceWarning in limits.py 3 years ago
Jessie Murray 1cbffb63c9
Re-enable pub/sub test in ws-tests 3 years ago
Jessie Murray bb02c1dd04
Formatting only: make ws-tests.py PEP8 compliant. 3 years ago
Jessie Murray 71223ae005
Address review comments (tests) 3 years ago
Jessie Murray d48353cec3
Rename self_cmd to reused_cmd 3 years ago
Jessie Murray b65c05a985
Reject unauthorized commands after SUBSCRIBE
Redis docs mention that a subscribed client cannot send a
non-subscription-related command.
3 years ago
Jessie Murray 67490fb825
Address review comments 3 years ago
Jessie Murray d7703b97b3
Add pub/sub test in HTML demo
1. Add publish button with channel and message
2. Add subscribe button with channel
3. Change "Clear logs" button to appear when logs are visible
3 years ago
Jessie Murray 545d18d84d
Send error messages to WS clients if triggered by Redis
Also mark the WS client as closing before we close the Redis connection,
to avoid its last error callback (if sent) trying to send out data while
we're in the middle of freeing the client.
3 years ago
Jessie Murray 583f6747b3
Avoid dereferencing NULL in pool_on_disconnect
pool_on_disconnect was assuming a pool object was attached and logging
using its server object. It also checked for NULL, but too late.
3 years ago
Jessie Murray dedfc42c67
WS: Log commands
WS client commands were not being logged, they are now with a "WS: "
prefix. This is done at debug level like for HTTP commands.
3 years ago
Jessie Murray 6b090b4ede
Large refactoring of WS code
1. Introduce ws_client struct
2. Handle all communications from websocket.c for WS clients
3. Always use a dedicated Redis connection for WS clients
4. Add rbuf & wbuf evbuffers for incoming & outgoing WS data
5. Use event_base_once to control R/W events
6. WS test: make sure to read complete HTTP response
3 years ago
Jessie Murray e26d6358e7
WS: Better reuse of the cmd struct for WS clients
For WS clients, reuse a persistent cmd struct attached to the
http_client object: take the cmd built from the WS frame, and copy it to
the persistent cmd.
3 years ago