feat(#44): Vulnerability Mesh — Remediation Engine (BLUE Agent Patcher)#102
Merged
Nicolas0315 merged 1 commit intomainfrom Apr 4, 2026
Merged
feat(#44): Vulnerability Mesh — Remediation Engine (BLUE Agent Patcher)#102Nicolas0315 merged 1 commit intomainfrom
Nicolas0315 merged 1 commit intomainfrom
Conversation
Implements BLUE Agent automated patch generation for verified vulnerabilities. ## Changes - src/lib/vuln/RemediationEngine.ts — Core engine (RemediationEngine class) - src/lib/vuln/__tests__/RemediationEngine.test.ts — 21 unit tests - src/lib/vuln/index.ts — Export new module ## Architecture Pipeline: VulnFinding + VulnVerificationResult → PatchCandidate[] → PRRecord - selectStrategies(): heuristic CWE/description-based strategy selection (9 strategies) - Precise CWE matching via matchesCwe() helper (prevents CWE-79 → CWE-798 false match) - generateCandidates(): per-strategy patch templates with codeExample + testSuggestion - evaluateCandidate(): 4-axis quality scoring (correctness/safety/testability/invasiveness) - Quality = correctness(40%) + safety(30%) + testability(20%) + invasiveness(10%) - buildPrRecord(): Conventional Commits PR title + structured PR body - ImmutableLedger-compatible event log (5 event types) - Batch processing via remediateAll() - Aggregate metrics tracking (successRate, avgQualityScore, avgGenerationTimeMs) ## Test Coverage 21 tests — all passing: - SQL injection → parameterization strategy - XSS → sanitization strategy - Weak crypto → crypto-upgrade strategy - Hardcoded secrets → config-hardening strategy (CWE-798 exact match bug fixed) - Quality axes validation - PR record structure (severity-based title prefix) - Event log completeness - Batch processing + skip-on-missing-verification - Aggregate metrics ## Full regression: 208 tests pass (0 failures) Closes #44
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🤖 RALPH Auto-Review RALPH review completed. |
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.
Summary
Implements Issue #44: BLUEエージェントが検証済み脆弱性に対して自動でパッチ提案を生成するRemediationEngine。
Architecture
Changes
src/lib/vuln/RemediationEngine.tssrc/lib/vuln/__tests__/RemediationEngine.test.tssrc/lib/vuln/index.tsAcceptance Criteria
remediate(finding, verificationResult)buildPrRecord()でConventional Commits準拠のPRタイトル・本文生成getAggregateMetrics()、ImmutableLedger互換イベントログPatch Strategies (9種類)
input-validation— Zodスキーマによる入力検証 (CWE-89/79/78/1321)sanitization— HTML出力エスケープ (CWE-79)parameterization— プリペアドステートメント (CWE-89)crypto-upgrade— SHA-256/randomBytes移行 (CWE-327/338)config-hardening— 環境変数移行、CORS修正 (CWE-798/259/942)access-control— 認証・認可チェック追加 (CWE-284)code-removal— eval()など危険コード削除 (CWE-95/78)dependency-update— npm audit fix (CWE-1104)generic— 汎用フォールバックQuality Scoring
パッチ品質 = correctness×40% + safety×30% + testability×20% + invasiveness×10%
matchesCwe()でCWE-79→CWE-798誤マッチを防止)Tests
21テスト全通過 / フル回帰208テスト全通過 / ESLintクリーン
RALPH Self-Review — KS40e Score: 17/18
Security ✅
matchesCwe()を使用し、CWE-79→CWE-798の誤検知バグを修正cryptoモジュールのみ)Quality ✅
Style ✅
Risk ✅
CrossModal検証 ✅
未充足軸 (-1)
🤖 Generated by RALPH Issue Pipeline
Branch:
ralph/issue-44Closes #44