feat: add Redis connector - #514
pushtisonawala wants to merge 2 commits into
Conversation
Adds a Redis source to Playbooks with three tasks: - Fetch Redis INFO stats (optional section) - Fetch Redis slow query log (SLOWLOG GET) - Run a read-only Redis command (allowlist-guarded; write/admin commands blocked) Covers issue DrDroidLab#480. Follows the existing Postgres/Bash connector pattern: proto definitions + regenerated stubs, RedisProcessor (redis-py), RedisSourceManager, facade registration, credential mapping, connector-key maps (only host required), frontend constants, two playbook templates (latency spike, memory & eviction pressure) and unit tests. Fixes DrDroidLab#480 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for raising this, will take a look! |
Review: Redis connectorOverall the structure follows the existing connector pattern well (source manager + processor + protos + templates + tests). The main concern is the "Run a read-only Redis command" task: the allow/deny list approach has several holes that let a playbook author read the Redis password or mutate/block the server. Details below, ordered by severity. 🔴 Security1. 2. Deny-list of sub-commands is structurally insufficient — same file
Recommendation: flip the model for compound commands to an allow-list of (command, subcommand) pairs (e.g. 3. Command tokenisation uses 🟠 Correctness / completeness4. Missing Django migration — 5. Key-combination enumeration is incomplete — 6. 7. Redis logo never used — 🟡 Minor
Happy to re-review once the command guard is tightened. |
- CONFIG GET could leak the Redis password (requirepass, masterauth, ...). CONFIG is no longer allow-listed wholesale; only CONFIG GET is permitted, and its result is filtered to strip sensitive keys regardless of the request pattern (so `CONFIG GET *` can't exfiltrate them either). - DEBUG and WAIT removed entirely: DEBUG POPULATE writes keys, DEBUG RELOAD/ RESTART/CRASH-AND-RECOVER disrupt the server, and WAIT blocks the connection - none of that belongs on a "read-only" allow-list. - CLIENT, MEMORY, SLOWLOG, LATENCY, OBJECT, XINFO, COMMAND are no longer allow-listed wholesale either. Only their genuinely read-only sub-commands are permitted (CLIENT LIST/INFO/ID/GETNAME, MEMORY USAGE/STATS/DOCTOR, SLOWLOG GET/LEN, LATENCY LATEST/HISTORY/DOCTOR, OBJECT ENCODING/FREQ/ IDLETIME/REFCOUNT, XINFO STREAM/GROUPS/CONSUMERS, COMMAND COUNT/DOCS/INFO/ LIST/GETKEYS). CLIENT REPLY OFF in particular would also have wedged the connector's cached connection for every later call. - get_connection()'s cached client is now reset on any failure instead of being reused, so a blocked/broken connection doesn't poison later tasks. - Command parsing uses shlex.split() instead of str.split(), so a quoted argument (`GET "my key"`) is tokenised correctly. - Reverted the Redis connector-key map to a single full 5-key set (matching Postgres/Clickhouse) instead of enumerating subsets - RedisProcessor already tolerates blank port/password/db/ssl, and the UI always submits all five keys anyway. - Added the migration for the new Source/SourceKeyType/SourceModelType choices (0034_alter_connector_connector_type_and_more.py). - Added negative test coverage for all of the above; verified live against a real Redis 7 (with requirepass set) that CONFIG GET can no longer surface the password and that DEBUG/WAIT/CLIENT REPLY/CLIENT KILL/MEMORY PURGE/SLOWLOG RESET/LATENCY RESET are all rejected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@sidPhoenix17 @dimittal CONFIG is now allow-list-only (GET), and the result is filtered so requirepass/masterauth/etc. can never come back, even via CONFIG GET *. |
Fixes #480
Adds a Redis source to Playbooks. Playbooks had no way to connect to a Redis
instance before this; the only Redis-related asset was a CloudWatch-based text
template.
Demo (90s)
https://www.loom.com/share/902b71f03a6e4b85aa001939e5390a08
What it does
Three tasks, following the existing Postgres / Bash connector pattern:
INFO [section]SLOWLOG GET n