You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AbortController-based timeout with configurable default
Plaintext credential storage
HIGH
AES-256-GCM encryption at rest with passphrase
Plaintext session transcripts
HIGH
Per-entry encryption for JSONL session files
Unsigned skill loading
HIGH
Ed25519 signing and verification
Limited prompt injection protection
HIGH
Input/output validation layers
Proposed Approach
1. GatewayClient Timeout Fix (PR 1)
Problem:GatewayClient.request() in src/gateway/client.ts:415-441 returns a Promise with no timeout. Pending requests can hang indefinitely, causing resource exhaustion.
Solution:
Add optional timeout parameter to request() method
Use AbortController with setTimeout for clean cancellation
Default timeout: 30 seconds (configurable via gateway.timeout)
Create TimeoutError class for specific error handling
Clean up pending request on timeout
Files:src/gateway/client.ts, ui/src/ui/gateway.ts
Tests: Unit tests for timeout behavior, integration tests with mock server
2. Credential Encryption at Rest (PR 2)
Problem: All credentials in ~/.openclaw/ stored as plaintext JSON (auth-profiles.json, oauth.json, creds.json). Vulnerable to infostealers and disk theft.
Solution:
Implement encryption module using Node.js crypto:
Key derivation: crypto.scrypt (N=2^16, r=8, p=1)
Encryption: AES-256-GCM with random 12-byte IV
Format: salt || IV || authTag || ciphertext
Passphrase prompt on startup (or OPENCLAW_PASSPHRASE env var)
Summary
I'd like to contribute a series of security improvements to OpenClaw addressing five gaps identified through code review:
Proposed Approach
1. GatewayClient Timeout Fix (PR 1)
Problem:
GatewayClient.request()insrc/gateway/client.ts:415-441returns a Promise with no timeout. Pending requests can hang indefinitely, causing resource exhaustion.Solution:
timeoutparameter torequest()methodAbortControllerwithsetTimeoutfor clean cancellationgateway.timeout)TimeoutErrorclass for specific error handlingFiles:
src/gateway/client.ts,ui/src/ui/gateway.tsTests: Unit tests for timeout behavior, integration tests with mock server
2. Credential Encryption at Rest (PR 2)
Problem: All credentials in
~/.openclaw/stored as plaintext JSON (auth-profiles.json, oauth.json, creds.json). Vulnerable to infostealers and disk theft.Solution:
crypto:crypto.scrypt(N=2^16, r=8, p=1)salt || IV || authTag || ciphertextOPENCLAW_PASSPHRASEenv var)openclaw credentials migratesecurity.credentialEncryption: true/falseFiles: New
src/infra/crypto.ts,src/agents/auth-profiles/store.ts,src/web/auth-store.tsTests: Roundtrip encryption, wrong passphrase handling, migration
3. Session Transcript Encryption (PR 3)
Problem: Session logs in
~/.openclaw/agents/*/sessions/*.jsonlcontain sensitive conversation data stored as plaintext.Solution:
Files:
src/config/sessions/transcript.ts,src/gateway/session-utils.fs.tsTests: Write/read encrypted sessions, large file handling, format detection
4. Skill Signing & Verification (PRs 4-5)
Problem: Skills loaded without cryptographic verification. Supply chain attack vector.
Solution:
PR 4 - Signing Infrastructure:
openclaw skills keygenopenclaw skills sign <path>PR 5 - Verification:
~/.openclaw/trusted-keys.jsonskills.requireSigning: true/false/warnFiles: New
src/agents/skills/signing.ts,src/agents/skills/verification.ts5. Prompt Injection Defense (PRs 6-7)
Problem: Limited protection against prompt injection attacks.
Solution:
PR 6 - Input Validation:
PR 7 - Output Validation:
Files: New
src/security/input-validation.ts,src/security/output-validation.tsImplementation Plan
I propose submitting these as 7 atomic PRs over the coming weeks:
Each PR will include:
Questions for Maintainers
GatewayClient.request()?sessions.json)?About Me
I'm contributing as part of a broader AI safety effort. Happy to discuss any aspect of this proposal or adjust the approach based on feedback.
Note: AI-assisted development, as encouraged in CONTRIBUTING.md.