Skip to content
Back to skills

Valkey Knowledge Patch

ASecurity

Valkey

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
developmentgophpnodedatabasesecurity

Works with

  • cursor
  • terminal
  • cli

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill valkey-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Valkey Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Valkey Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-valkey-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-valkey-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: valkey-knowledge-patch
description: Valkey
version: "9.2.1"
license: MIT
metadata:
  author: Nevaberry
---


# Valkey knowledge patch

Load this skill when updating Valkey commands or clients, configuring a deployment,
working with cluster databases or slot migration, or maintaining modules and scripts.
It covers command semantics, compatibility changes, security fixes, persistence,
replication, access control, and operational tooling.
Use the topic references for complete syntax, conditions, and version-specific fixes.

## Reference index

| Reference | Topics |
| --- | --- |
| [Compatibility and security](references/compatibility-and-security.md) | Revoked release, command recommendations, RESP changes, security fix matrix |
| [Access and TLS](references/access-and-tls.md) | Database and key ACLs, roles, reloads, certificates, authentication, randomness |
| [Strings and transactions](references/strings-and-transactions.md) | Conditional writes/deletes, conditional EXEC, MSETEX, INCREX, TTL overflow |
| [Hash fields](references/hash-fields.md) | Field TTLs, GLIDE, HGETEX, HGETDEL, expiration propagation, Path Hash |
| [Collections and streams](references/collections-and-streams.md) | Sets, sorted sets, lists, polygons, stream deletion, invalidation, lag |
| [Cluster routing and databases](references/cluster-routing-and-databases.md) | SELECT, MOVE, CLUSTERSCAN, replica routing, failover, cluster configuration |
| [Slot migration](references/slot-migration.md) | Starting/canceling jobs, authentication, status, retention, CLI, database correctness |
| [Persistence and replication](references/persistence-and-replication.md) | Forkless snapshots, compression, AOF recovery/replay, validation, dual-channel sync |
| [Modules and scripting](references/modules-and-scripting.md) | Engines, cache limits, callbacks, scans, memory accounting, loading, build requirements |
| [Operations and tooling](references/operations-and-tooling.md) | Logs/redaction, metrics, clocks, hot keys, client limits, Sentinel, CLI, benchmarks |

## Compatibility changes first

### Release selection and command recommendations

The 8.0.8 tag was revoked because it pointed outside the 8.0 release branch.
Upgrade from 8.0.7 directly to 8.0.9 or later for the intended security fixes.
Valkey 9.0 restores the usage recommendation for 25 previously deprecated commands.
CVE-2026-130822 affects client eviction with `maxmemory-clients` enabled;
the compatibility reference records its fix versions and the other security fixes.

### RESP and required command syntax

Version 8.1.8 strictly validates RESP CRLF delimiters: terminate fields with `\r\n`.
Version 9.0.5 also rejects malformed RESP requests with invalid CRLF terminators.
For commands without subcommands, the RESP3 `COMMAND INFO` subcommands field is an
empty Array starting with 8.1.9 and in 9.0.5; older 8.1 releases returned an empty Set.
In 9.0.6 and 9.1.2, `HPERSIST`, `HTTL`, `HPTTL`, `HEXPIRETIME`, and `HPEXPIRETIME`
require `FIELDS`; omission returns a syntax error.

### Validation and encoding changes

In 9.0.6 and 9.1.2, RDB load and `RESTORE` always validate listpacks and reject
malformed stream payloads. `sanitize-dump-payload` is a no-op in both releases;
its associated ACL flags are also no-ops in 9.1.2.
In 9.2, large sorted sets report `btree` instead of `skiplist` in `OBJECT ENCODING`;
update monitoring or tests that inspect that name.
In 9.2, `ZRANGEBYSCORE`, `ZREVRANGEBYSCORE`, `ZCOUNT`, and `ZRANGESTORE` reject
an empty score bound or a bare `(`. Use `0` for inclusive zero or `(0` for exclusive zero.

### Build and startup requirements

Active defragmentation requires vendored jemalloc starting with 8.1.1.
Building 9.2 with CMake requires 3.24 or later. Sentinel in 9.2 requires write access
to the directory containing its configuration at startup so it can persist state.
In 9.2, `MODULE LOAD` is rejected during async replication loading or atomic slot migration.

## Conditional and atomic commands

### String conditions and lock release

`SET` with `IFEQ` writes only when the current value equals the comparison value;
with `GET`, it returns the previous value whether or not the comparison succeeds.
In 9.2, `SET mode standby IFNE maintenance` writes only when the value differs
from `maintenance`. `DELEX mode IFEQ standby` deletes a string key only when its value matches;
`DELEX` also accepts `IFNE` for a mismatch.
`DELIFEQ key value` atomically deletes a matching string: `1` means deletion,
`0` means missing or different, and `WRONGTYPE` means a non-string key.
When releasing a lock, pass the token from the original acquisition.

### Transactions, multi-key TTLs, and increments

In 9.2, `EXEC` accepts `IFEQ`, `IFNE`, `NX`, and `XX` conditions to check values
or key existence at execution time without a preceding `WATCH`.
`MSETEX numkeys key value [key value ...]` atomically writes all pairs; append one
of `EX`, `PX`, `EXAT`, `PXAT`, or `KEEPTTL`. Relative or absolute times use seconds
for `EX`/`EXAT` and milliseconds for `PX`/`PXAT`; `KEEPTTL` preserves each key's TTL.
`NX` requires every key absent; `XX` requires every key present. The reply is `1`
for all writes succeeding or `0` for condition failure with no keys written.
In 9.2, `INCREX` increments by an integer or float and controls expiration atomically.
It supports `NX`/`XX`, `LBOUND`/`UBOUND`, `SATURATE` to clamp to bounds, and
`ENX`/`PERSIST` to control expiration.

### Hash-field expiration and retrieval

Use `HSETEX` to write a field and set its TTL, and `HGETEX` to read and refresh it.
For `HGETEX`, put at most one expiration option before `FIELDS <count> <field> ...`:
`EX`/`PX` for relative seconds/milliseconds, `EXAT`/`PXAT` for Unix deadlines in
those units, or `PERSIST` to clear TTLs. With no option it behaves like `HMGET`.
The reply follows field order; the command belongs to `@write`.
A zero relative TTL or past absolute timestamp returns the values and immediately
removes those fields. Background expiration can otherwise leave a field readable
after its TTL elapses until the job removes it.
In 9.0.6 and 9.1.2, `HGETEX` requires ACL write permission on the hash key itself.
`HGETDEL key FIELDS count field [field ...]` returns and deletes fields atomically;
9.1.1 rejects missing or misplaced `FIELDS`.
The hash reference includes GLIDE usage, conditional writes, and propagation fixes.

### Paths and consumer-group references

Path Hash in 9.2 stores fields at binary-safe paths. `PHSCAN` scans one exact path;
`PHPATHSCAN` traverses paths incrementally in order. `PHPREFIXES` returns matching
prefixes longest first with pagination and supports `EXCLUDESELF`.
`PHPATHDEL routes /eu WITHSUBPATHS` deletes the path and subtree and returns the
number of paths deleted; omitting `WITHSUBPATHS` deletes only the exact path.
In 9.2, `XACKDEL` acknowledges and deletes stream entries; `XDELEX` deletes them.
Both offer `KEEPREF`, `DELREF`, and `ACKED`; `ACKED` requires all groups to acknowledge
before deletion. With `KEEPREF`, `XACKDEL` returns `1` for acknowledgment even if
the stream message was already deleted.

## Cluster workflows

### Numbered databases and key replacement

`SELECT` supports numbered databases in cluster mode. The same key name can have
different values in different databases, and all instances map to the same hash slot.
`FLUSHDB`, `SCAN`, and `DBSIZE` operate on the selected database on the connected node.
For cluster-wide use, select that database on every primary and run each command there;
maintain a separate `SCAN` cursor per primary. Use a cluster client that supports
nonzero databases and selects the intended database on its node connections.
`SELECT` state can carry over between callers on pooled or multiplexed connections.
In 9.2, `MOVE leaderboard 5 REPLACE` atomically moves the selected database's key
and overwrites an existing `leaderboard` in database 5.

### Cluster scanning

`CLUSTERSCAN` returns `[next-cursor, keys]`. Start with `0`, return each cursor
verbatim, and stop only when it returns `0` again, even after an empty page.
Route each continuation by the cursor's hash tag to the slot owner; follow `MOVED`
with the same cursor. Use the same `hash-seed` on every node for compatible cursors
across migration and failover. A full slot iteration returns every key present
throughout the iteration, with possible duplicates. An unassigned slot returns `CLUSTERDOWN`.
For a single-slot scan, pass the same `SLOT` on every call; separate slots use separate cursors.

### Atomic slot migration

Run `CLUSTER MIGRATESLOTS` on the source primary. Repeat
`SLOTSRANGE <start> <end> NODE <target-node-id>` to queue multiple migrations.
The source serves the slots while the target catches up, then briefly pauses mutations
before transferring ownership atomically. Clients avoid `ASK` redirects during copying,
and same-slot multi-key commands avoid migration-related retry errors.
`CLUSTER CANCELSLOTMIGRATIONS` cancels all migrations originating on the receiving node;
cancellation or failure automatically discards staged data.
`CLUSTER GETSLOTMIGRATIONS` reports active and recently completed jobs; only `success`,
`failed`, and `cancelled` are terminal states. The migration reference details reply fields.
In 9.2, add `AUTH username password` to the target's `NODE` clause to authenticate;
the slow log and `MONITOR` redact these credentials.

## Access control and persistence

### Database ACLs and roles

In 9.0, ACL permissions apply across database numbers. Database-level ACLs in 9.1
allow `db=0,1` to restrict a user's command and key permissions to databases 0 and 1;
authenticated as that user, `SELECT 2` returns `NOPERM`.
In 9.1.2, `MOVE` and `COPY` check access to the selected source database when reading a key.
In 9.2, manage named sets of ACL selectors with `ACL SETROLE`, `ACL GETROLE`,
`ACL ROLES`, and `ACL DELROLE`; assign an existing role with
`ACL SETUSER reader role:profile-read`. Run `ACL DIGEST` after `ACL LOAD` to fingerprint
the active rules; changing a role's rules changes the digest.

### Snapshots, compression, and recovery

In 9.2, enable `forkless-infrastructure-enabled` and set `forkless-policy` to
`prefer-forkless` to prefer background-thread snapshots for RDB saves and disk-based
or diskless full sync. The policy also accepts `require-fork`.
`rdbcompression` controls the on-disk RDB format and defaults to per-string LZF;
`rdbcompression lz4` selects whole-stream compression, with Zstd also available.
Set `repl-compression` independently for the wire format, including full sync;
capability negotiation permits uncompressed transfer to replicas lacking support.
In 9.2, active key and hash-field expiration counts toward `save` change thresholds.
In 9.0.6 and 9.1.2, truncated-AOF recovery discards the whole unfinished `MULTI`
transaction; later writes remain replayable after another restart.
In 9.2.1, a replica aborts and resynchronizes if the primary link breaks while it
applies buffered data during dual-channel replication.

## Operations and extension development

Set `log-format logfmt` for structured logging or `log-format json` for one JSON
object per line. `log-timestamp-format` independently supports `iso8601` and
`milliseconds`. Both log settings default to `legacy`.
`COMMANDLOG` records commands with large requests or replies. In 9.2 its size limits
accept memory units, and an `EXEC` can appear in the slow log and command log based
on the transaction's total execution time.
In 9.2, `hotkeys-top-k 10` enables hot-key tracking; use `HOTKEYS GET` and `HOTKEYS RESET`.
Use `CONFIG INFO maxmemory` in 9.2 for configuration type, flags, enum values, and
numeric bounds where applicable.

The Lua engine ships as a module in 9.1 and can be disabled when scripting is unused.
Inspect the `Scripting Engines` section of `INFO` for loaded engines.
In 9.2, `maxmemory-scripts` limits cached `EVAL` script memory; `SCRIPT LOAD` is
subject to global `maxmemory`. `CONFIG REWRITE` preserves module load order so
dependencies still load before dependent modules after restart.
In 9.2, `ValkeyModule_ScanKeyRawBorrowed` scans hash, set, and sorted-set elements
without allocating a string per element. It and `ValkeyModule_ScanKey` skip expired
fields awaiting cleanup in listpack-encoded hashes.
Use `ValkeyModule_IncrExternalMemory` and `ValkeyModule_DecrExternalMemory` in 9.2
for allocations and frees outside the server allocator; reported memory counts toward
`used_memory` and `maxmemory`.

Files in this skill

  • SKILL.md12.2 KB
  • coverage.json1.6 KB
  • references/access-and-tls.md3.9 KB
  • references/cluster-routing-and-databases.md5.5 KB
  • references/collections-and-streams.md3.3 KB
  • references/compatibility-and-security.md2.8 KB
  • references/hash-fields.md4.8 KB
  • references/modules-and-scripting.md5.4 KB
  • references/operations-and-tooling.md7.8 KB
  • references/persistence-and-replication.md4.4 KB
  • references/slot-migration.md4.1 KB
  • references/strings-and-transactions.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.