Framework Support
Kovar generates framework-specific fix suggestions for security findings. Each framework has its own code patterns for setting headers, configuring cookies, and applying security middleware.
Supported Frameworks
Section titled “Supported Frameworks”| Framework | Key | Typical fix location |
|---|---|---|
| Express | "express" | Middleware function |
| Fastify | "fastify" | Plugin or hook |
| Next.js | "next" | next.config.js headers or middleware |
| Koa | "koa" | Middleware function |
| Hono | "hono" | Middleware function |
| Generic | "generic" | Plain HTTP header setting |
Express
Section titled “Express”import { generateRemediation } from "@orlalabs/kovar/core";
const remediation = generateRemediation(findings, { framework: "express", language: "typescript",});Example output for a missing HSTS header:
// suggestion.codeapp.use((req, res, next) => { res.set("Strict-Transport-Security", "max-age=31536000; includeSubDomains"); next();});Next.js
Section titled “Next.js”const remediation = generateRemediation(findings, { framework: "next", language: "typescript",});Example output for a missing HSTS header:
// suggestion.codeheaders: async () => [{ source: "/(.*)", headers: [{ key: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" }]}]Fastify
Section titled “Fastify”const remediation = generateRemediation(findings, { framework: "fastify", language: "typescript",});const remediation = generateRemediation(findings, { framework: "koa", language: "typescript",});const remediation = generateRemediation(findings, { framework: "hono", language: "typescript",});Framework Detection
Section titled “Framework Detection”If you omit the framework option, it defaults to "generic". To auto-detect based on your package.json dependencies, use the standalone detectFramework() utility:
import { detectFramework, generateRemediation } from "@orlalabs/kovar/core";
const framework = detectFramework(); // reads package.json, returns best matchconst remediation = generateRemediation(findings, { framework, language: "typescript" });The detection priority order is:
- Next.js
- Hono
- Fastify
- Koa
- Express
- Generic (fallback)
Related
Section titled “Related”- Auto-Remediation — how remediation works and the
RemediationSuggestiontype. - Standalone API — use
generateRemediation()in scripts.