Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e3e9b5c
auto-claude: subtask-1-1 - Create skill directory and package.json wi…
davida-ps Feb 27, 2026
fa6970a
auto-claude: subtask-1-2 - Create TypeScript configuration
davida-ps Feb 27, 2026
0b331e4
auto-claude: subtask-1-3 - Create skill.json metadata with SBOM
davida-ps Feb 27, 2026
7e17121
auto-claude: subtask-1-4 - Create SKILL.md with YAML frontmatter and …
davida-ps Feb 27, 2026
2a55e7d
auto-claude: subtask-1-5 - Create HOOK.md for OpenClaw hook metadata
davida-ps Feb 27, 2026
a8ea4d0
auto-claude: subtask-2-1 - Create TypeScript type definitions for adv…
davida-ps Feb 27, 2026
9a54159
auto-claude: subtask-2-2 - Implement Claude API client wrapper with r…
davida-ps Feb 27, 2026
941587e
auto-claude: subtask-2-3 - Implement advisory feed reader with signat…
davida-ps Feb 27, 2026
89b763c
auto-claude: subtask-2-4 - Implement result caching for offline resil…
davida-ps Feb 27, 2026
ec63215
auto-claude: subtask-3-1 - Implement advisory triage analyzer
davida-ps Feb 27, 2026
893a64f
auto-claude: subtask-3-2 - Implement pre-installation risk assessor
davida-ps Feb 27, 2026
62b682f
auto-claude: subtask-3-3 - Implement natural language policy parser
davida-ps Feb 27, 2026
a1dbaf1
auto-claude: subtask-4-1 - Implement state persistence module
davida-ps Feb 27, 2026
2edf87e
auto-claude: subtask-4-2 - Create main handler.ts with OpenClaw hook …
davida-ps Feb 27, 2026
0e95d77
auto-claude: subtask-4-3 - Add environment variable validation and st…
davida-ps Feb 27, 2026
41db282
auto-claude: subtask-5-1 - Write unit tests for Claude API client
davida-ps Feb 27, 2026
cd7bdd9
auto-claude: subtask-5-2 - Write unit tests for feed reader
davida-ps Feb 27, 2026
972190f
auto-claude: subtask-5-3 - Write unit tests for advisory analyzer
davida-ps Feb 27, 2026
2cc0284
auto-claude: subtask-5-4 - Write unit tests for risk assessor
davida-ps Feb 27, 2026
56b3648
auto-claude: subtask-5-5 - Write unit tests for policy engine
davida-ps Feb 27, 2026
2ccaf40
auto-claude: subtask-6-1 - Write integration test for advisory triage…
davida-ps Feb 27, 2026
52002a2
auto-claude: subtask-6-2 - Write integration test for risk assessment…
davida-ps Feb 27, 2026
a509666
auto-claude: subtask-6-3 - Write integration test for policy parsing …
davida-ps Feb 27, 2026
11f217c
auto-claude: subtask-7-2 - Run TypeScript compilation and ESLint
davida-ps Feb 27, 2026
734a3b1
auto-claude: subtask-7-3 - Run security scan for hardcoded secrets
davida-ps Feb 27, 2026
21629a2
auto-claude: subtask-7-4 - Manual verification: Test skill invocation
davida-ps Feb 27, 2026
14623d8
Merge branch 'main' into auto-claude/004-llm-based-security-analyst-s…
davida-ps Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export default [
}
},
rules: {
'no-empty': ['error', { allowEmptyCatch: true }]
'no-empty': ['error', { allowEmptyCatch: true }],
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }]
}
},
// Node.js scripts (.js files in scripts directory)
Expand All @@ -112,6 +113,32 @@ export default [
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }]
}
},
// Skills JavaScript files
{
files: ['skills/**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
Buffer: 'readonly',
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
URL: 'readonly',
fetch: 'readonly',
AbortController: 'readonly'
}
},
rules: {
'no-empty': ['error', { allowEmptyCatch: true }],
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }]
}
},
{
ignores: ['dist/', 'node_modules/', '*.config.js', 'public/', '.venv/']
}
Expand Down
75 changes: 75 additions & 0 deletions skills/clawsec-analyst/HOOK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: clawsec-analyst
description: AI-powered security analyst that provides automated advisory triage, pre-installation risk assessment, and natural language security policy parsing using Claude API.
metadata: { "openclaw": { "events": ["agent:bootstrap", "command:new"] } }
---

# ClawSec Analyst Hook

This hook integrates Claude API to provide intelligent, automated security analysis for OpenClaw agents on:

- `agent:bootstrap`
- `command:new`

When triggered, it analyzes the ClawSec advisory feed and provides AI-generated security insights, risk assessments, and actionable remediation guidance.

## Safety Contract

- The hook does not delete or modify skills without explicit user approval.
- It only reports security findings and recommendations.
- All analysis results are advisory—users make final decisions on remediation actions.
- Alerts are deduplicated using `~/.openclaw/clawsec-analyst-state.json`.

## Required Environment Variables

- `ANTHROPIC_API_KEY`: **REQUIRED** - Anthropic API key for Claude access. Obtain from https://console.anthropic.com/.

## Optional Environment Variables

- `CLAWSEC_FEED_URL`: override remote advisory feed URL.
- `CLAWSEC_FEED_SIG_URL`: override detached remote feed signature URL (default `${CLAWSEC_FEED_URL}.sig`).
- `CLAWSEC_FEED_CHECKSUMS_URL`: override remote checksum manifest URL (default sibling `checksums.json`).
- `CLAWSEC_FEED_CHECKSUMS_SIG_URL`: override detached remote checksum manifest signature URL.
- `CLAWSEC_FEED_PUBLIC_KEY`: path to pinned feed-signing public key PEM.
- `CLAWSEC_LOCAL_FEED`: override local fallback feed file.
- `CLAWSEC_LOCAL_FEED_SIG`: override local detached feed signature path.
- `CLAWSEC_LOCAL_FEED_CHECKSUMS`: override local checksum manifest path.
- `CLAWSEC_LOCAL_FEED_CHECKSUMS_SIG`: override local checksum manifest signature path.
- `CLAWSEC_VERIFY_CHECKSUM_MANIFEST`: set to `0` only for emergency troubleshooting (default verifies checksums).
- `CLAWSEC_ALLOW_UNSIGNED_FEED`: set to `1` only for temporary migration compatibility; bypasses signature/checksum verification.
- `CLAWSEC_ANALYST_STATE_FILE`: override state file path (default `~/.openclaw/clawsec-analyst-state.json`).
- `CLAWSEC_ANALYST_CACHE_DIR`: override analysis cache directory (default `~/.openclaw/clawsec-analyst-cache`).
- `CLAWSEC_HOOK_INTERVAL_SECONDS`: minimum interval between hook scans (default `300`).

## Analysis Features

### Automated Advisory Triage

- Assesses actual risk level (may differ from reported CVSS score)
- Identifies affected components in the user's environment
- Recommends prioritized remediation steps
- Provides contextual threat intelligence

### Pre-Installation Risk Assessment

- Analyzes skill metadata and SBOM before installation
- Identifies potential security risks (filesystem access, network calls)
- Cross-references dependencies against known vulnerabilities
- Generates risk score (0-100) with detailed explanation

### Natural Language Policy Parsing

- Translates plain English security policies into structured, enforceable rules
- Returns confidence score (0.0-1.0) for policy clarity
- Rejects ambiguous policies (threshold: 0.7)

## Error Handling

- **Missing API key:** Fails fast with clear error message directing user to set `ANTHROPIC_API_KEY`.
- **Rate limits:** Implements exponential backoff (1s → 2s → 4s) with max 3 retries.
- **Network failures:** Falls back to 7-day cache if Claude API is unavailable.
- **Signature verification failure:** Fails closed if advisory feed signature is invalid (unless emergency bypass enabled).

## Offline Resilience

Analysis results are cached to `~/.openclaw/clawsec-analyst-cache/` with a 7-day TTL. If Claude API is unavailable, the hook will use cached results and warn users about potential staleness.
Loading
Loading