How to Configure OpenHands Redis Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openhands redis prevent delete rule by limiting user command permissions. You assign a strict role to the agent so it cannot drop data. Many engineering teams start by giving their coding agents full database admin rights. This wide setup lets an automated agent wipe whole key spaces by mistake. One bad loop or flawed prompt can clear your active cache in seconds. How to set up openhands redis prevent delete rules Redis uses a native role system to control what commands a user r

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up an openhands redis prevent delete rule by limiting user command permissions. You assign a strict role to the agent so it cannot drop data. Many engineering teams start by giving their coding agents full database admin rights. This wide setup lets an automated agent wipe whole key spaces by mistake. One bad loop or flawed prompt can clear your active cache in seconds.

How to set up openhands redis prevent delete rules

Redis uses a native role system to control what commands a user runs. To set up an openhands redis prevent delete workflow, make a custom user profile. You grant this new profile permission to run only read and write commands. Then you block all destructive commands for that specific user role.

Blocking the basic delete command is only the first step in your setup. You must also block commands that flush databases or unlink keys in the background. You also need to check commands that rename keys or set very short timeouts. An agent can use a one-second timeout to erase a key right away.

Admins can also rename dangerous commands inside the main server settings file. When you rename a command to a random string, normal users cannot guess it. After you save these rules, you give the restricted user credentials to OpenHands. The agent logs in with this role during its task session. When the agent tries to drop a key, the server rejects the command.

What native permissions solve and what they miss

Native server roles work well to stop basic destructive commands at login. They enforce a hard wall against full database wipes and bulk key removal. If an OpenHands agent tries to flush a cache, the database stops it. This setup protects your core state from simple agent mistakes.

Still, static database roles only decide who logs in and which commands work. They do not inspect what individual write requests do in flight. An agent with write permissions can still overwrite a valid key with blank data. Overwriting a key destroys the old value just like a delete command does.

Redis Access Control Lists + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static roles also lack context about why an agent runs a specific command. Sometimes an agent needs to clear a temporary test key it just made. Native rules cannot tell a safe test cleanup from a bad production wipe. If you block deletes everywhere, the agent cannot clean up its own test data.

Native rules also do not protect private data inside the keys being read. When OpenHands reads user records, the server returns raw emails and phone numbers. The agent then sends those raw card numbers and national IDs to external models. Data masking rewrites matched fields in results before the agent processes the response. Teams also need detailed logs that link every database command to a specific agent run.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Which commands should we block to stop key removal in Redis?

You should block delete, unlink, and all database flush commands on the server. You must also restrict expire and script commands that can clear keys indirectly.

Can OpenHands still erase data if we block delete commands?

Yes, an agent with write permissions can overwrite existing keys with empty strings. It can also set a very short expiration time to make keys vanish.

How do we let OpenHands delete test keys but protect production keys?

You can restrict the agent role to specific key prefixes in your server settings. The agent can then only modify or remove keys that start with that test prefix.

The query runs. The emails stay hidden.