diff --git a/SECURITY_AUDIT.md b/SECURITY_AUDIT.md new file mode 100644 index 000000000000..afc3d83003c0 --- /dev/null +++ b/SECURITY_AUDIT.md @@ -0,0 +1,451 @@ +## 🔒 Security Audit Report - hermes-agent + +**Audited by:** 天工 AGI Security Auditor v2.0 +**Date:** 2026-05-24 +**Method:** Dual-LLM Cross-Validation (iamhc + longcat) +**Files Scanned:** 11 + +--- + +## 📊 Summary + +| Severity | Confirmed | Total | +|----------|-----------|-------| +| Critical | 14 | 14 | +| Medium | 0 | 1 | + +--- + +## 🔧 Detailed Findings & Fixes + +### 🔴 Finding #1: sql_format + +**File:** `hermes_state.py:637` +**Severity:** Critical +**CWE:** CWE-89 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.1/100` +- 📈 Priority: `2.3/100` +- 🎯 Fused Confidence: `64.0%` (iamhc: 30% / longcat: 95%) + +**Current Code:** +```python +cursor.execute(f"DROP TRIGGER IF EXISTS {_trig}") +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #2: sql_format + +**File:** `hermes_state.py:642` +**Severity:** Critical +**CWE:** CWE-89 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.1/100` +- 📈 Priority: `2.3/100` +- 🎯 Fused Confidence: `61.3%` (iamhc: 30% / longcat: 90%) + +**Current Code:** +```python +cursor.execute(f"DROP TABLE IF EXISTS {_tbl}") +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #3: hardcoded_password + +**File:** `cli.py:4573` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.4/100` +- 📈 Priority: `2.5/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +api_key = "no-key-required" +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #4: hardcoded_password + +**File:** `test_run_workflow.py:186` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `7.6/100` +- 📈 Priority: `2.0/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +r = ComfyRunner(host="https://cloud.comfy.org", api_key="abc") +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #5: hardcoded_password + +**File:** `test_run_workflow.py:191` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `7.6/100` +- 📈 Priority: `2.0/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +r = ComfyRunner(host="https://staging.cloud.comfy.org", api_key="abc") +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #6: hardcoded_password + +**File:** `test_run_workflow.py:195` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `7.6/100` +- 📈 Priority: `2.0/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +r = ComfyRunner(host="https://cloud.comfy.org", api_key="auth-key") +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #7: hardcoded_password + +**File:** `runtime_provider.py:872` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.4/100` +- 📈 Priority: `2.5/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +api_key = "no-key-required" +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #8: sql_format + +**File:** `kanban_db.py:1243` +**Severity:** Critical +**CWE:** CWE-89 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.1/100` +- 📈 Priority: `2.3/100` +- 🎯 Fused Confidence: `64.0%` (iamhc: 30% / longcat: 95%) + +**Current Code:** +```python +conn.execute(f"ALTER TABLE {table} ADD COLUMN {ddl}") +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #9: hardcoded_password + +**File:** `model_switch.py:906` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.4/100` +- 📈 Priority: `2.5/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +api_key = "no-key-required" +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #10: hardcoded_password + +**File:** `openclaw_to_hermes.py:2601` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `9.2/100` +- 📈 Priority: `3.0/100` +- 🎯 Fused Confidence: `90.8%` (iamhc: 60% / longcat: 90%) + +**Current Code:** +```python +is_secret = "password" in oc_key.lower() or "token" in oc_key.lower() or "nsec" in oc_key.lower() +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #11: hardcoded_password + +**File:** `agent_init.py:596` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.4/100` +- 📈 Priority: `2.5/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +agent._anthropic_api_key = "aws-sdk" +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #12: hardcoded_password + +**File:** `agent_init.py:599` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.4/100` +- 📈 Priority: `2.5/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +agent.api_key = "aws-sdk" +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #13: hardcoded_password + +**File:** `auxiliary_client.py:3656` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `8.4/100` +- 📈 Priority: `2.5/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +real_client, final_model, api_key="aws-sdk", +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + +### 🔴 Finding #14: hardcoded_password + +**File:** `test_trajectory_compressor_async.py:33` +**Severity:** Critical +**CWE:** CWE-798 + +**📊 Formula Metrics:** +- 🔥 Risk Score: `7.6/100` +- 📈 Priority: `2.0/100` +- 🎯 Fused Confidence: `93.9%` (iamhc: 60% / longcat: 95%) + +**Current Code:** +```python +comp._async_client_api_key = "test-key" +``` + +**Why This Is a Problem:** +LLM output parsing failed + +**Fix:** +```python + +``` + +**Explanation:** + +**Test Suggestion:** + +--- + + +## 🏗️ CI/CD & Architecture Improvements + +Additional recommendations: +- Review CI/CD pipeline configurations for security best practices +- Consider implementing SAST in pre-commit hooks +- Add dependency scanning to CI pipeline + +--- + +*This PR was auto-generated by **天工 AGI Security Auditor v2.0** with dual-LLM cross-validation.*