// security/detectors.ts — SPEC-058b Section G
// Signal constants and detector functions for auth, file upload, and API presence.
export const AUTH_SIGNALS = [
    'jwt',
    'oauth',
    'passport',
    'keycloak',
    'auth0',
    'clerk',
    'supabase',
    'session',
    'cookie-session',
    'express-session',
    'next-auth',
    'lucia',
    'better-auth',
];
export const UPLOAD_SIGNALS = [
    'multer',
    'formidable',
    'busboy',
    'sharp',
    'jimp',
    'imagemagick',
    'file-upload',
    'multipart',
];
export function detectAuth(knowledge) {
    const stackLower = knowledge.stack.map((s) => s.toLowerCase());
    for (const sig of AUTH_SIGNALS) {
        if (stackLower.some((s) => s.includes(sig))) {
            return sig;
        }
    }
    return null;
}
export function detectFileUpload(knowledge) {
    const stackLower = knowledge.stack.map((s) => s.toLowerCase());
    for (const sig of UPLOAD_SIGNALS) {
        if (stackLower.some((s) => s.includes(sig))) {
            return sig;
        }
    }
    return null;
}
export function hasPublicApi(knowledge) {
    if (knowledge.apiContracts.length > 0) {
        return true;
    }
    return knowledge.apps.some((a) => a.type === 'backend');
}
export function isSecurityTestProject(knowledge) {
    if (detectAuth(knowledge) !== null) {
        return true;
    }
    if (hasPublicApi(knowledge)) {
        return true;
    }
    return knowledge.apps.some((a) => a.type === 'backend' || a.type === 'frontend');
}
//# sourceMappingURL=detectors.js.map