Port self-upskilling security agent from VXD#87
Merged
Conversation
Mirrors vortex-dispatch's security agent (offline-friendly: scanners are local
binaries, LLM layer uses the configured Ollama/cloud client; zero VXD refs).
- internal/security/ (verbatim, LLM-free): growable OWASP Top 10 + CWE knowledge
base (immutable Add, Covers by ID-or-CWE, Checklist for prompts) + runner for
gosec/govulncheck/gitleaks/semgrep/npm-audit (graceful degrade, real parsers).
- engine/security_gate.go: ScanRepo (standalone) + ReviewStory (per-story
pre-merge gate in postExecutionPipeline after QA before merge). Findings >=
gate severity (default critical) pause the requirement; self-upskills the KB
from confirmed findings.
- Wiring: Monitor.SetSecurityGate + resume.go (TestResume_WiresSecurityGate);
events STORY_SECURITY_PASSED/FAILED + SECURITY_SCAN_COMPLETED/RULE_LEARNED
projected; planner prompt carries the OWASP Top 10 baseline.
- CLI: nxd security scan/kb (falls back to DefaultConfig so it runs in any repo).
- Config: security.{disable_gate, gate_severity, auto_learn, kb_path}.
Verified: scanned NXD itself (Go/JS/Python/Shell, all 5 scanners, crit=0). Full
suite 31 pkgs + vet + golangci-lint clean. Docs: CLAUDE.md + cli-reference.md +
regenerated nxd.config.example.yaml.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports vxd's security agent to NXD, adapted for the offline-first design (scanners are local binaries; the LLM threat-model layer uses the configured Ollama/cloud client). Zero VXD references.
internal/security/(LLM-free, unit-tested, mirrored verbatim) — growable OWASP Top 10 + CWEKnowledgeBase(JSON-persisted; immutable/versionedAdd;Coversmatches ID or CWE;Checklistrenders for prompts) + a runner orchestrating gosec, govulncheck, gitleaks, semgrep, npm audit (language-aware applicability, PATH detection, graceful degrade — skipped tools listed, never silently dropped; pure per-tool parsers → real findings).engine/security_gate.goSecurityGate—ScanRepo(standalone) +ReviewStory(per-story pre-merge, inpostExecutionPipelineafter QA before merge viaMonitor.SetSecurityGate). Findings ≥security.gate_severity(default critical) pause the requirement (human decision), never escalate. Self-upskilling: confirmed high+ findings of a new vuln class become learned KB rules (SECURITY_RULE_LEARNED).nxd security scan [path] [--json] [--llm] [--min <sev>]+nxd security kb(falls back toDefaultConfigso it runs in any repo). Planner prompt now carries the OWASP Top 10 so every story is designed secure.security.{disable_gate, gate_severity, auto_learn, kb_path}.Verified
TestResume_WiresSecurityGateguards the wire;cli-reference.md+ regeneratednxd.config.example.yamlupdated.go vetclean,golangci-lint0 issues.