MySQLClaw Skill v1.0.7
MySQLClaw is a security-hardened MySQL backend for OpenClaw that stores user profiles, personas, media preferences, and configuration snapshots. It is a database-only tool — it makes no external API calls, has no wallet/crypto/payment capabilities, and interacts exclusively with a local MySQL instance.
Capability Declarations
See CAPABILITIES.md for explicit declarations of what this skill can and cannot do. Key points:
- ❌ No wallet access, cryptocurrency, blockchain, or payment processing
- ❌ No external API calls (Stripe, AWS, GitHub, or any other service)
- ❌ No network access beyond localhost MySQL
- ✅ MySQL operations on
mysqlclawschema only - ✅ User profile and persona storage
- ✅ Config snapshot storage with automatic retention/purge
The crypto / wallet / purchases capability signals from automated scanners are false positives caused by the defensive secret-redaction patterns in sanitize_snapshot.sh. See CAPABILITIES.md for full explanation.
Dependencies
| Requirement | Install Command |
|---|---|
| MySQL client (mysql >= 8.0) | Debian/Ubuntu: sudo apt install default-mysql-client · RHEL: sudo yum install mysql · macOS: brew install mysql-client |
| OpenSSL | Usually pre-installed |
| Bash >= 4.0 | Required for associative arrays |
| Perl | Required for sanitize_snapshot.sh regex engine (usually pre-installed) |
Required Environment Variables
| Variable | Description |
|---|---|
MYSQL_USER | Dedicated MySQL account (not root in production) |
MYSQL_PASSWORD | Password for the MySQL account |
MYSQL_HOST | MySQL server hostname (default: localhost) |
MYSQL_PORT | MySQL server port (default: 3306) |
Security Note: Passwords are never passed on the command line. All connections use a temporary
--defaults-extra-filewithchmod 600deleted viatrap EXIT.
Security Architecture
1. Credential Handling
- Passwords never appear on the command line or in process listings
- Temporary credentials file created with
chmod 600, deleted viatrap EXIT(survivesset -efailures) - Setup wizard uses
read -sp— password not echoed to terminal
2. SQL Safety (sql_safe_exec.sh)
| Control | Behavior |
|---|---|
| Multi-statement rejection | Semicolons rejected — one statement at a time |
| DDL blocking | DROP, TRUNCATE, ALTER, CREATE blocked anywhere in input |
| DML confirmation | INSERT, UPDATE, DELETE, REPLACE require interactive confirmation |
| Path traversal prevention | .ssh, /etc/, .env, .gnupg, .aws, .config blocked |
| Database restriction | USE only allowed for mysqlclaw |
| Input sanitization | Single quotes escaped; identifiers validated ^[a-zA-Z_][a-zA-Z0-9_]{0,63}$ |
| Trap-based cleanup | Credentials file removed on ANY exit via trap EXIT |
3. Command Mapping (custom_mysql)
The custom_mysql executable is included in this skill and maps directly to the safety wrapper:
| Command | Implementation | Safety |
|---|---|---|
custom_mysql.sh query "SQL" | custom_mysql → sql_safe_exec.sh | Single-statement, DDL blocked, DML confirmed |
custom_mysql.sh exec_script --file X | custom_mysql → sql_safe_exec.sh per line | Each statement individually verified |
4. Snapshot Security
- Secret redaction:
sanitize_snapshot.shredacts API keys, tokens, passwords, Stripe keys (sk_live_*), AWS keys, GitHub tokens via Perl regex - Path whitelist: Only files in
allowed_snapshot_pathsmay be snapshotted - Untrusted by default: All snapshots marked
is_trusted = 0until user-verified - Retention: Auto-purge via MySQL event (default 30 days). Manual:
CALL sp_purge_snapshots(N);
Installation
cp -r custom_mysql /home/noodly/.openclaw/workspace/skills/
cd /home/noodly/.openclaw/workspace/skills/custom_mysql
./setup_wizard.sh
Creating a Least-Privilege MySQL User
CREATE USER 'mysqlclaw'@'localhost' IDENTIFIED BY 'strong_password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, EVENT, EXECUTE
ON mysqlclaw.* TO 'mysqlclaw'@'localhost';
FLUSH PRIVILEGES;
Files
| File | Purpose |
|---|---|
SKILL.md | This file — skill documentation |
CAPABILITIES.md | Explicit capability declarations (addresses scanner false positives) |
custom_mysql | Agent-facing command wrapper (query / exec_script) |
sql_safe_exec.sh | Safe SQL execution engine |
setup_wizard.sh | Interactive setup wizard |
sanitize_snapshot.sh | Secret redaction before DB storage |
create_user_tables.sql | Schema for user profiles, personas, snapshots |
cleanup_snapshots.sql | Retention policy (auto-purge event + manual procedure) |
changelog.md | Version history |
Changelog
See changelog.md for full version history.