fable-heal
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFable Heal
Fable Heal
Automatically synthesize, apply, and verify security fixes for vulnerabilities detected by .
fable-redteam自动合成、应用并验证由 检测到的漏洞的安全修复方案。
fable-redteamPurpose
目的
Bridge the gap between active vulnerability discovery and verified code remediation. translates offensive security findings (SQL injection, BOLA/IDOR, CORS misconfigurations, missing security headers, sensitive file leaks, SSRF, JWT signature bypass, and LLM prompt injections) into concrete, tested, verified code patches with zero regressions.
fable-heal弥合主动漏洞发现与经验证的代码修复之间的差距。 将攻击性安全测试发现的问题(SQL 注入、BOLA/IDOR、CORS 配置错误、缺失安全标头、敏感文件泄露、SSRF、JWT 签名绕过和 LLM 提示词注入)转化为具体、经过测试且已验证的代码补丁,并确保零回归。
fable-healWhen to Use
使用场景
- or security audits have identified vulnerabilities that need immediate code remediation.
fable-redteam - Automatically generating TDD regression test suites to ensure security flaws stay closed in CI.
- Applying surgical code patches in staging or local branches with atomic rollback protection.
- Verifying whether candidate security patches successfully eliminate attack vectors.
- 或安全审计已发现需要立即进行代码修复的漏洞。
fable-redteam - 自动生成 TDD 回归测试套件,确保安全缺陷在 CI 中持续保持已修复状态。
- 在 staging 分支或本地分支中应用精准代码补丁,并提供原子回滚保护。
- 验证候选安全补丁是否成功消除攻击向量。
When NOT to Use
不适用场景
- Before vulnerabilities have been identified or reproduced (use or
fable-redteam).fable-security - For general non-security application refactoring (use ).
fable-simplify - Direct production patching without human review or staging verification.
- 漏洞尚未被发现或复现之前(使用 或
fable-redteam)。fable-security - 常规的非安全应用重构(使用 )。
fable-simplify - 未经人工审核或 staging 环境验证而直接修补生产环境。
Inputs
输入
- : Array or file path of structured vulnerability findings from
redteam_findings.fable-redteam - : Target HTTP/HTTPS endpoint or repository workspace.
target - : When true, previews generated patches and unified diffs without modifying files.
dryRun - : When true, writes patches directly to matching codebase source files.
autoApply - : When true, re-runs attack vectors against the target to prove vulnerability resolution.
verify
- :来自
redteam_findings的结构化漏洞发现结果数组或文件路径。fable-redteam - :目标 HTTP/HTTPS 端点或代码仓库工作区。
target - :为 true 时,预览生成的补丁和 unified diff,而不修改文件。
dryRun - :为 true 时,将补丁直接写入代码库中匹配的源代码文件。
autoApply - :为 true 时,对目标重新运行攻击向量,以证明漏洞已解决。
verify
Expected Outputs
预期输出
- : Concrete code replacements with unified diffs.
security_patches - : Executable Bun test suite asserting vulnerability closure.
test/security/redteam-healed.test.ts - : Tamper-evident cryptographic SHA-256 attestation record.
.fable/heal-attestation.json - : Updated work cards marked as remediated.
.fable/LEDGER.md
- :包含 unified diff 的具体代码替换内容。
security_patches - :断言漏洞已修复的可执行 Bun 测试套件。
test/security/redteam-healed.test.ts - :具备防篡改能力的密码学 SHA-256 证明记录。
.fable/heal-attestation.json - :更新后并标记为已修复的工作卡。
.fable/LEDGER.md
Procedure
流程
- Finding Ingestion: Load findings from , SARIF reports, or
fable-redteam..fable/redteam-findings.json - Strategy Selection: Map each finding category and CWE to its surgical remediation pattern:
- SQL Injection (CWE-89) -> Parameterized queries.
- IDOR/BOLA (CWE-639) -> Resource ownership verification guard.
- CORS Misconfiguration (CWE-942) -> Strict origin whitelist.
- Missing Security Headers (CWE-1021) -> Content-Security-Policy, HSTS, XFO headers.
- Sensitive Exposures (CWE-200) -> Route denial for ,
.env, and secrets..git - SSRF (CWE-918) -> Outbound URL and IP validation blocking loopback and cloud metadata.
- Patch Synthesis: Generate code transformations and compute unified diffs.
- TDD Test Generation: Emit executable test assertions into .
test/security/redteam-healed.test.ts - Atomic Application & Guard: If applied, write patches with automated backup. On syntax or compilation failure, trigger circuit-breaker rollback.
- Closed-Loop Verification: If target is accessible, execute verification probes to confirm fix.
- Attestation & Ledger Sealing: Record cryptographic SHA-256 seal and mark work cards closed.
- 发现结果导入: 从 、SARIF 报告或
fable-redteam加载发现结果。.fable/redteam-findings.json - 策略选择: 将每种发现类别和 CWE 映射到对应的精准修复模式:
- SQL 注入(CWE-89)-> 参数化查询。
- IDOR/BOLA(CWE-639)-> 资源所有权验证防护。
- CORS 配置错误(CWE-942)-> 严格的 origin 白名单。
- 缺失安全标头(CWE-1021)-> Content-Security-Policy、HSTS 和 XFO 标头。
- 敏感信息暴露(CWE-200)-> 拒绝访问 、
.env和 secrets 的路由。.git - SSRF(CWE-918)-> 出站 URL 与 IP 验证,阻止访问 loopback 和云元数据地址。
- 补丁合成: 生成代码转换并计算 unified diff。
- TDD 测试生成: 将可执行的测试断言输出到 。
test/security/redteam-healed.test.ts - 原子应用与防护: 应用补丁时先执行自动备份。发生语法或编译失败时,触发熔断器回滚。
- 闭环验证: 如果目标可访问,则执行验证探针以确认修复。
- 证明与账本封存: 记录密码学 SHA-256 封存值,并将工作卡标记为已关闭。
Decision Rules
决策规则
- If syntax check or typecheck fails on a candidate patch, trigger rollback immediately via circuit breaker.
- Always generate executable TDD regression test suite before sealing remediation.
- Never modify files in mode; only emit unified diffs and previews.
dryRun - When target endpoint is live and verification is requested, probe target to prove vulnerability closure before completing.
- Record SHA-256 cryptographic attestation in for all applied patches.
.fable/heal-attestation.json
- 如果候选补丁的语法检查或类型检查失败,立即通过熔断器触发回滚。
- 在封存修复之前,始终生成可执行的 TDD 回归测试套件。
- 在 模式下绝不修改文件;仅输出 unified diff 和预览内容。
dryRun - 当目标端点在线且请求验证时,在完成前探测目标,以证明漏洞已修复。
- 对所有已应用的补丁,将密码学 SHA-256 证明记录到 。
.fable/heal-attestation.json
Constraints
约束
- Do not apply patches without automated rollback circuit breaker in place.
- Do not bypass verification tests when closing active security work cards.
- Patches must be surgical and preserve existing application business logic and comments.
- 未部署自动回滚熔断器时,不得应用补丁。
- 关闭活跃安全工作卡时,不得绕过验证测试。
- 补丁必须精准,并保留现有应用的业务逻辑和注释。
Tool Policy
工具策略
- Use native AST patching and regex transformers from .
src/core/redteam/heal.ts - Run Bun test runner () to execute generated regression test suites.
bun test - Use native SHA-256 crypto for cryptographic attestation generation.
- 使用 中的原生 AST 补丁工具和正则转换器。
src/core/redteam/heal.ts - 使用 Bun 测试运行器()执行生成的回归测试套件。
bun test - 使用原生 SHA-256 密码学功能生成密码学证明。
Evidence Requirements
证据要求
- Synthesized patches must provide exact file paths, strategy name, and unified diffs.
- Applied patches require syntax verification and automated regression test generation in .
test/security/redteam-healed.test.ts - Cryptographic healing attestation at verifying integrity of all applied patches.
.fable/heal-attestation.json
- 合成的补丁必须提供准确的文件路径、策略名称和 unified diff。
- 已应用的补丁必须通过语法验证,并在 中自动生成回归测试。
test/security/redteam-healed.test.ts - 在 中提供密码学修复证明,以验证所有已应用补丁的完整性。
.fable/heal-attestation.json
Failure Handling
失败处理
- If a candidate patch produces invalid syntax or type errors, immediately rollback changes via the circuit breaker.
- If regression tests fail, revert applied patches and flag finding for manual developer review.
- If target server is unavailable during closed-loop verification, mark verification as pending without blocking patch application.
- 如果候选补丁产生无效语法或类型错误,立即通过熔断器回滚变更。
- 如果回归测试失败,则撤销已应用的补丁,并将该发现标记为需要开发人员手动审核。
- 如果闭环验证期间目标服务器不可用,则将验证标记为待处理,但不阻止补丁应用。
Completion Criteria
完成标准
- All identified vulnerability findings mapped to remediation strategies.
- Unified diffs and patches synthesized for vulnerable targets.
- TDD regression test suite generated and passing in .
test/security/redteam-healed.test.ts - Cryptographic attestation recorded in .
.fable/heal-attestation.json - Remediation status recorded in .
.fable/LEDGER.md
- 所有已识别的漏洞发现均已映射到相应的修复策略。
- 已为存在漏洞的目标合成 unified diff 和补丁。
- 已在 中生成 TDD 回归测试套件且测试通过。
test/security/redteam-healed.test.ts - 密码学证明已记录到 。
.fable/heal-attestation.json - 修复状态已记录到 。
.fable/LEDGER.md