/**
 * Business Logic Vulnerability Types
 *
 * Types for detecting BOLA, IDOR, BFLA, and other
 * authorization/business logic vulnerabilities.
 *
 * @module scanners/logic/types
 */
/**
 * CWE mappings for logic vulnerabilities
 */
export const LOGIC_VULN_CWE_MAP = {
    "bola": ["CWE-639", "CWE-284"],
    "idor": ["CWE-639", "CWE-284", "CWE-285"],
    "bfla": ["CWE-285", "CWE-863"],
    "mass-assignment": ["CWE-915"],
    "race-condition-auth": ["CWE-362", "CWE-367"],
    "privilege-escalation": ["CWE-269", "CWE-250"],
    "missing-auth": ["CWE-306"],
    "missing-authz": ["CWE-862"],
    "direct-db-access": ["CWE-639", "CWE-284"],
    "horizontal-priv-esc": ["CWE-639"],
    "vertical-priv-esc": ["CWE-269"],
};
/**
 * OWASP references for logic vulnerabilities
 */
export const LOGIC_VULN_OWASP_MAP = {
    "bola": ["OWASP API1:2023", "OWASP A01:2021"],
    "idor": ["OWASP API1:2023", "OWASP A01:2021"],
    "bfla": ["OWASP API5:2023", "OWASP A01:2021"],
    "mass-assignment": ["OWASP API6:2023", "OWASP A08:2021"],
    "race-condition-auth": ["OWASP API4:2023"],
    "privilege-escalation": ["OWASP API5:2023", "OWASP A01:2021"],
    "missing-auth": ["OWASP API2:2023", "OWASP A07:2021"],
    "missing-authz": ["OWASP API1:2023", "OWASP A01:2021"],
    "direct-db-access": ["OWASP API1:2023"],
    "horizontal-priv-esc": ["OWASP API1:2023"],
    "vertical-priv-esc": ["OWASP API5:2023"],
};
/**
 * Default severity for each vulnerability type
 */
export const LOGIC_VULN_SEVERITY_MAP = {
    "bola": "high",
    "idor": "high",
    "bfla": "high",
    "mass-assignment": "medium",
    "race-condition-auth": "high",
    "privilege-escalation": "critical",
    "missing-auth": "critical",
    "missing-authz": "high",
    "direct-db-access": "high",
    "horizontal-priv-esc": "high",
    "vertical-priv-esc": "critical",
};
/**
 * Patterns for detecting framework types
 */
export const FRAMEWORK_DETECTION_PATTERNS = {
    nextjs: {
        packageNames: ["next"],
        filePatterns: [/next\.config\.(js|mjs|ts)$/, /pages\/api\//, /app\/api\//],
        codePatterns: [/NextApiRequest|NextRequest/],
    },
    express: {
        packageNames: ["express"],
        filePatterns: [/routes?\//],
        codePatterns: [/express\(\)|Router\(\)|app\.(get|post|put|delete|patch)/],
    },
    fastify: {
        packageNames: ["fastify"],
        filePatterns: [/routes?\//],
        codePatterns: [/fastify\.(get|post|put|delete|patch)/],
    },
    koa: {
        packageNames: ["koa"],
        filePatterns: [/routes?\//],
        codePatterns: [/new Koa\(\)|router\.(get|post|put|delete)/],
    },
    hapi: {
        packageNames: ["@hapi/hapi"],
        filePatterns: [/routes?\//],
        codePatterns: [/Hapi\.server\(|server\.route\(/],
    },
    nestjs: {
        packageNames: ["@nestjs/core"],
        filePatterns: [/\.controller\.ts$/, /\.module\.ts$/],
        codePatterns: [/@Controller|@Get|@Post|@Put|@Delete/],
    },
    django: {
        packageNames: ["django"],
        filePatterns: [/urls\.py$/, /views\.py$/],
        codePatterns: [/path\(|re_path\(|@api_view/],
    },
    flask: {
        packageNames: ["flask"],
        filePatterns: [/routes?\//],
        codePatterns: [/@app\.route|Flask\(/],
    },
    fastapi: {
        packageNames: ["fastapi"],
        filePatterns: [/routers?\//],
        codePatterns: [/FastAPI\(|@app\.(get|post|put|delete)/],
    },
    rails: {
        packageNames: ["rails"],
        filePatterns: [/routes\.rb$/, /controllers\//],
        codePatterns: [/resources\s+:|get\s+'|post\s+'|Rails\.application/],
    },
    spring: {
        packageNames: ["spring-boot"],
        filePatterns: [/Controller\.java$/, /RestController/],
        codePatterns: [/@RestController|@GetMapping|@PostMapping/],
    },
    laravel: {
        packageNames: ["laravel/framework"],
        filePatterns: [/routes\/web\.php$/, /routes\/api\.php$/],
        codePatterns: [/Route::(get|post|put|delete)/],
    },
    gin: {
        packageNames: ["github.com/gin-gonic/gin"],
        filePatterns: [/routes?\//],
        codePatterns: [/gin\.(Default|New)\(|r\.(GET|POST|PUT|DELETE)/],
    },
    echo: {
        packageNames: ["github.com/labstack/echo"],
        filePatterns: [/routes?\//],
        codePatterns: [/echo\.New\(|e\.(GET|POST|PUT|DELETE)/],
    },
    fiber: {
        packageNames: ["github.com/gofiber/fiber"],
        filePatterns: [/routes?\//],
        codePatterns: [/fiber\.New\(|app\.(Get|Post|Put|Delete)/],
    },
    auto: {
        packageNames: [],
        filePatterns: [],
        codePatterns: [],
    },
};
//# sourceMappingURL=types.js.map