Module: ClawSec Scanner

March 10, 2026 ยท View on GitHub

Responsibilities

  • Provide multi-layer vulnerability scanning for OpenClaw-oriented skill repositories.
  • Orchestrate dependency, SAST, and DAST engines into a single report contract.
  • Execute real OpenClaw hook handlers in an isolated DAST harness to validate runtime security behavior.
  • Support periodic scan execution through an OpenClaw hook integration.
  • Normalize findings into severity buckets for downstream triage and automation.

Key Files

  • skills/clawsec-scanner/skill.json: skill metadata, SBOM paths, trigger phrases.
  • skills/clawsec-scanner/scripts/runner.sh: main orchestrator for dependency/SAST/DAST scans.
  • skills/clawsec-scanner/scripts/scan_dependencies.mjs: npm audit + pip-audit parsing.
  • skills/clawsec-scanner/scripts/sast_analyzer.mjs: Semgrep and Bandit execution/parsing.
  • skills/clawsec-scanner/scripts/dast_runner.mjs: hook discovery + real harness DAST evaluation.
  • skills/clawsec-scanner/scripts/dast_hook_executor.mjs: isolated per-hook runtime executor.
  • skills/clawsec-scanner/hooks/clawsec-scanner-hook/handler.ts: periodic OpenClaw event hook.
  • skills/clawsec-scanner/lib/report.mjs: unified report generation and text/JSON formatting.

Public Interfaces

InterfaceConsumerBehavior
runner.sh CLIOperators/automationRuns all enabled scan engines and emits merged report output.
dast_runner.mjs CLIOperators/CI/hooksDiscovers hooks and runs isolated runtime DAST checks.
OpenClaw scanner hook default exportOpenClaw runtimeHandles agent:bootstrap and command:new scanner trigger events.
ScanReport JSON outputHumans and automationProvides normalized severity summary + finding list.

Inputs and Outputs

Inputs/outputs are summarized in the table below.

TypeNameLocationDescription
InputScan target path--target CLI argRoot directory where skills/hooks are scanned.
InputDependency manifestspackage-lock.json, requirements.txt, pyproject.tomlDrives dependency vulnerability checks.
InputHook metadata and handlers**/HOOK.md, handler.{js,mjs,cjs,ts}DAST harness discovers and executes these handlers.
InputEnv configurationCLAWSEC_*, GITHUB_TOKENControls engine behavior, severity filtering, and output paths.
OutputUnified scan reportstdout or --output fileJSON/text report with severity summary and finding details.
OutputRuntime hook alertsOpenClaw event.messagesNew vulnerability alerts pushed into conversations.
OutputScanner state file~/.openclaw/clawsec-scanner-state.json by defaultDe-duplication memory for reported finding IDs.

Configuration

VariableDefaultModule Effect
CLAWSEC_SCANNER_INTERVAL86400Minimum interval between periodic hook-triggered scans.
CLAWSEC_SCANNER_MIN_SEVERITYmediumThreshold for findings pushed to conversation alerts.
CLAWSEC_SCANNER_FORMATtextHook alert serialization format (text or json).
CLAWSEC_SKIP_DEPENDENCY_SCAN0Disables dependency scanner when set to 1.
CLAWSEC_SKIP_SAST0Disables Semgrep/Bandit scanner when set to 1.
CLAWSEC_SKIP_DAST0Disables runtime hook DAST checks when set to 1.
CLAWSEC_SKIP_CVE_LOOKUP0Disables CVE enrichment stage when set to 1.
CLAWSEC_DAST_HARNESSunsetInternal guard to avoid recursive scans during harness execution.
CLAWSEC_DAST_DISABLE_TYPESCRIPTunsetTest/debug switch forcing TypeScript harness coverage fallback mode.

DAST Harness Behavior

  • Hook discovery walks the target tree for HOOK.md and resolves adjacent handler files.
  • Each declared event key is executed in a separate Node subprocess via dast_hook_executor.mjs.
  • Findings are generated from real runtime behavior:
    • Baseline execution crash or timeout.
    • Malicious-input crash or timeout.
    • Output amplification beyond message/character thresholds.
    • Core event identity mutation (type, action, sessionKey).
  • Harness capability gaps (for example missing TypeScript compiler for .ts handlers) are reported as info coverage findings, not high-severity vulnerabilities.

Example Snippets

# run scanner end-to-end
bash skills/clawsec-scanner/scripts/runner.sh --target ./skills --format json
# run DAST harness directly
node skills/clawsec-scanner/scripts/dast_runner.mjs --target ./skills --format text --timeout 30000

Tests

Test FileFocus
skills/clawsec-scanner/test/dast_harness.test.mjsReal hook execution path, malicious crash detection, TypeScript coverage fallback semantics.
skills/clawsec-scanner/test/reviewer_regressions.test.mjsRunner behavior around non-zero DAST exit and merged reporting.
skills/clawsec-scanner/test/dependency_scanner.test.mjsDependency scanner utility/report contracts.
skills/clawsec-scanner/test/sast_engine.test.mjsSAST parser/normalization behavior.
skills/clawsec-scanner/test/cve_integration.test.mjsOSV/NVD/GitHub enrichment integration checks.

Update Notes

  • 2026-03-10: Added module page for clawsec-scanner and documented the 0.0.2 real OpenClaw DAST harness execution model.

Source References

  • skills/clawsec-scanner/skill.json
  • skills/clawsec-scanner/SKILL.md
  • skills/clawsec-scanner/CHANGELOG.md
  • skills/clawsec-scanner/scripts/runner.sh
  • skills/clawsec-scanner/scripts/scan_dependencies.mjs
  • skills/clawsec-scanner/scripts/sast_analyzer.mjs
  • skills/clawsec-scanner/scripts/dast_runner.mjs
  • skills/clawsec-scanner/scripts/dast_hook_executor.mjs
  • skills/clawsec-scanner/scripts/setup_scanner_hook.mjs
  • skills/clawsec-scanner/hooks/clawsec-scanner-hook/HOOK.md
  • skills/clawsec-scanner/hooks/clawsec-scanner-hook/handler.ts
  • skills/clawsec-scanner/lib/report.mjs
  • skills/clawsec-scanner/lib/utils.mjs
  • skills/clawsec-scanner/test/dast_harness.test.mjs
  • skills/clawsec-scanner/test/reviewer_regressions.test.mjs