627 Commits (d64478f5eed3f48a9afd3e59573104c1c20ce2e7)
 

Author SHA1 Message Date
Nicolas Favre-Felix d64478f5ee
Add docs page on running Webdis with external Redis
Inspired by the questions on issue #232. Documents what should be a
relatively common use case for Webdis users.
1 year ago
Nicolas Favre-Felix f4efbfd334
Update image versions in README after release
0.1.20 -> 0.1.21
2 years ago
Nicolas Favre-Felix 96282e1e0b
Version bump after release 2 years ago
Nicolas Favre-Felix ca5144d811
Version 0.1.21 (security update)
Security update, fixing vulnerabilities found in the Alpine Linux base
image as well as the embedded Redis service and SSL libraries.

Additionally and not related to security: fixed build issues with
CentOS 7

= Security fixes =

Urgency: HIGH

Note for the list of vulnerabilities provided below:
The "Impact" described only applies if the Webdis image is used
without changes. If Webdis is used as a base image, please review
whether the changes made to it can cause these vulnerabilities to
become exploitable.

== Critical severity ==

Description: Out-of-bounds Write in zlib (CVE-2022-37434)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-ZLIB-2976174
Origin: zlib/zlib@1.2.11-r3, from the base image
Impact: Webdis uses zlib to support HTTP compression

== High severity ==

Description: Loop with Unreachable Exit Condition ('Infinite Loop')
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-OPENSSL-2426333
Origin: openssl/libcrypto1.1
Impact: Webdis only uses TLS to connect to Redis

Description: Execute arbitrary code via netstat (CVE-2022-28391)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-BUSYBOX-2440608
Origin: introduced by the base image, alpine:3.14.3
Impact: netstat is not used by Webdis

Description: Arbitrary Code Injection in Redis (CVE-2022-24735)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-REDIS-2805760
Origin: introduced by the embedded Redis service, version 6.2.6
Impact: Webdis embeds this vulnerable version of Redis

Description: NULL Pointer Dereference in LibSSL3
Info: https://snyk.io/vuln/SNYK-ALPINE317-OPENSSL-3314660
Origin: introduced by libssl3, a dependency of Redis
Impact: Webdis connects to its internal Webdis instance over TLS

Description: Double Free in LibSSL3
Info: https://snyk.io/vuln/SNYK-ALPINE317-OPENSSL-3314657
Origin: introduced by libssl3, a dependency of Redis
Impact: Webdis connects to its internal Webdis instance over TLS

Description: Access of Resource Using Incompatible Type in LibSSL3
Info: https://snyk.io/vuln/SNYK-ALPINE317-OPENSSL-3314651
Origin: introduced by libssl3, a dependency of Redis
Impact: Webdis connects to its internal Webdis instance over TLS

Description: Use After Free in LibSSL3
Info: https://snyk.io/vuln/SNYK-ALPINE317-OPENSSL-3314650
Origin: introduced by libssl3, a dependency of Redis
Impact: Webdis connects to its internal Webdis instance over TLS

Description: NULL Pointer Dereference in LibSSL3
Info: https://snyk.io/vuln/SNYK-ALPINE317-OPENSSL-3314647
Origin: introduced by libssl3, a dependency of Redis
Impact: Webdis connects to its internal Webdis instance over TLS

== Medium severity ==

Description: NULL Pointer Dereference in Redis (CVE-2022-24736)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-REDIS-2805761
Origin: introduced by the embedded Redis service, version 6.2.6
Impact: Webdis embeds this vulnerable version of Redis

Description: Inadequate Encryption Strength in openssl (CVE-2022-2097)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-OPENSSL-2941807
Origin: openssl/openssl@1.1.1l-r0, openssl/libssl1.1@1.1.1l-r0
Impact: Webdis only uses TLS to connect to Redis

== Low severity ==

Description: Integer Overflow or Wraparound in Redis (CVE-2022-35977)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-REDIS-3243491
Origin: introduced by the embedded Redis service, version 6.2.6
Impact: Webdis embeds this vulnerable version of Redis

Description: Integer Overflow or Wraparound in Redis (CVE-2023-22458)
Info: https://security.snyk.io/vuln/SNYK-ALPINE314-REDIS-3243489
Origin: introduced by the embedded Redis service, version 6.2.6
Impact: Webdis embeds this vulnerable version of Redis
2 years ago
Nicolas Favre-Felix 1b63174d5d
Dependency updates: alpine, redis, ssl
Alpine: 3.14.3 -> 3.17.1
Redis: 6.2.6 -> 7.0.8
2 years ago
Nicolas Favre-Felix 5eece37333
Merge a number of fixes for CentOS 7
Webdis needed a number of small fixes to build and run on CentOS 7
(released in 2014). Initially reported in PR #231 as a missing -std=
compiler flag, there turned out to be more tweaks needed to cleanly
build and run.
2 years ago
Nicolas Favre-Felix 23838381f6
Add missing includes for strings.h
Several string functions were used without an explicit include.
This was discovered using an old version of GCC which warned about them;
these warnings are not seen with more recent compilers.
2 years ago
Nicolas Favre-Felix 2735950207
Disable pragma warning on old versions of GCC
Found with GCC 4.8.5 (released June 2015)
2 years ago
Nicolas Favre-Felix 05f168fc51
Define _POSIX_C_SOURCE=200809L
This is needed to enable localtime_r(3) used in src/slog.c
Also needed for strdup(3)
Add #ifndef to src/hiredis/fmacros.h to avoid warnings
2 years ago
Nicolas Favre-Felix 7c66f69b21
Remove O_NOFOLLOW from src/server.c
This was unnecessarily limiting, since users could legitimately want to
use a symlink for the config file. It is also unsupported on some
platforms; this was discovered when attempting to build Webdis on CentOS 7.
2 years ago
Nicolas Favre-Felix 08f0d5d7cf
Change contributed fix from gnu99 to c99 2 years ago
quocbao 50d16b16ca
Compile in C99 mode
src/websocket.c:247:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for(int i = 0; p < eom && i < cmd->count; i++) {
  ^
2 years ago
Nicolas Favre-Felix c6b9d52213
Add new docs article about loading an RDB file into a Webdis container 2 years ago
Nicolas Favre-Felix ef8fcc5bab
Update docker images in README after release 0.1.20 was published 3 years ago
Nicolas Favre-Felix 41f200477b
Version bump after release 3 years ago
Nicolas Favre-Felix a984fdb8a5
Version 0.1.20
- Smaller Docker image size
- Bugfix: avoid responding to the wrong client (this could happen in rare cases)
- Better handling of WebSocket frames (details in #212)
- Fix regression introduced in 0.1.19, causing an empty header to be sent (#217)
3 years ago
Nicolas Favre-Felix 1b6e3a95ed
Merge pull request #218 from jessie-murray/empty-header 3 years ago
Jessie Murray 055363df46
Add test with curl for empty header (#217) 3 years ago
Jessie Murray 15302e754e
Preserve header count when a value is replaced
Fix for #217, a regression added in #205. The "header_count"
field was incremented even when we overwrote a header entry, which
caused Webdis to send a header with no name and no value.
3 years ago
Nicolas Favre-Felix 73f29055c1
Improvements to ws_peek_data (by @majklik)
Better handling of WS client frames, contributed in the comments of #212:
* Reject unmasked frames as per RFC 6455
* Avoid unnecessary data copy from/to evbuffer
* Remove conditions on has_mask

2 new tests cover this change:
* minimal ping-pong with masked client frame, unmasked response
* rejected unmasked client frame
3 years ago
Nicolas Favre-Felix d28dd3ec80
Avoid responding to the wrong fd after client disconnection
Slightly adapted from a proposed change by @majklik on GitHub in
issue #212 (one invalid read fixed and a memory leak avoided).
This marks an inflight cmd's fd as -1 when the HTTP client disconnects,
which prevents the later response from Redis from being sent to a new
client which has connected in the meantime and been assigned the same
client fd.
3 years ago
Nicolas Favre-Felix 545c56c4cb
Reduce Docker image size
* Remove apk cache after installing packages
* Remove unused Redis binaries: -benchmark and -cli

Those have to be done on the same line as `apk add` in order to be part
of the same image layer, since running them in a separate layer would
not affect the layer they were added to.
3 years ago
Nicolas Favre-Felix 2758fc0337
Fix heading typo in README 3 years ago
Nicolas Favre-Felix b8a43f03dc
Move docs from GitHub Discussions to the repo 3 years ago
Nicolas Favre-Felix 908c383838
Update docker images in README, link to new docs 3 years ago
Nicolas Favre-Felix 92ae1df7cd
Version bump after release 3 years ago
Nicolas Favre-Felix 417e0ac483
Release 0.1.19
- Performance: avoid redundant operations when building HTTP responses.
- Fix HTTP parser bug on architectures that used unsigned "char" types.
- Fix crash when receiving "FIN" WebSocket frame (#209).
3 years ago
Jessie Murray 7d495e30c2
Add test for issue #209, Webdis crashing after receiving FIN frame
Connect, handshake, send FIN frame, disconnect. Webdis shouldn't crash.
3 years ago
Jessie Murray 6539ae13f9
Call ws_close_if_able instead of ws_client_free in worker.c
Update last call to ws_client_free to use ws_close_if_able instead, from
worker.c
3 years ago
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