/** * SMI-865: Quarantine Management System Database Schema * * Provides database schema for skill quarantine management: * - Quarantine table with severity levels and review status * - Indexes for efficient querying * - Migration support for existing databases * * Severity Categories: * - MALICIOUS: Permanent quarantine, security threat detected * - SUSPICIOUS: Manual review required before import * - RISKY: Can import with warnings displayed * - LOW_QUALITY: Can import with reduced quality score */ import type { Database as DatabaseType } from './database-interface.js'; /** * Severity levels for quarantined skills */ export type QuarantineSeverity = 'MALICIOUS' | 'SUSPICIOUS' | 'RISKY' | 'LOW_QUALITY'; /** * Review status for quarantined skills */ export type QuarantineReviewStatus = 'pending' | 'approved' | 'rejected'; /** * Quarantine severity descriptions and policies */ export declare const QUARANTINE_SEVERITY_POLICIES: { readonly MALICIOUS: { readonly level: 4; readonly description: "Permanent quarantine - security threat detected"; readonly allowImport: false; readonly requiresReview: true; readonly autoReject: false; }; readonly SUSPICIOUS: { readonly level: 3; readonly description: "Manual review required before import"; readonly allowImport: false; readonly requiresReview: true; readonly autoReject: false; }; readonly RISKY: { readonly level: 2; readonly description: "Can import with warnings displayed"; readonly allowImport: true; readonly requiresReview: false; readonly autoReject: false; }; readonly LOW_QUALITY: { readonly level: 1; readonly description: "Can import with reduced quality score"; readonly allowImport: true; readonly requiresReview: false; readonly autoReject: false; }; }; /** * SQL statement to create the quarantine table */ export declare const QUARANTINE_SCHEMA_SQL = "\n-- SMI-865: Quarantine table for skill security management\nCREATE TABLE IF NOT EXISTS quarantine (\n id TEXT PRIMARY KEY,\n skill_id TEXT NOT NULL,\n source TEXT NOT NULL,\n quarantine_reason TEXT NOT NULL,\n severity TEXT NOT NULL CHECK(severity IN ('MALICIOUS', 'SUSPICIOUS', 'RISKY', 'LOW_QUALITY')),\n detected_patterns TEXT DEFAULT '[]', -- JSON array of detected security patterns\n quarantine_date TEXT NOT NULL DEFAULT (datetime('now')),\n reviewed_by TEXT,\n review_status TEXT NOT NULL CHECK(review_status IN ('pending', 'approved', 'rejected')) DEFAULT 'pending',\n review_notes TEXT,\n review_date TEXT,\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n updated_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\n-- Indexes for efficient querying\nCREATE INDEX IF NOT EXISTS idx_quarantine_skill_id ON quarantine(skill_id);\nCREATE INDEX IF NOT EXISTS idx_quarantine_severity ON quarantine(severity);\nCREATE INDEX IF NOT EXISTS idx_quarantine_review_status ON quarantine(review_status);\nCREATE INDEX IF NOT EXISTS idx_quarantine_source ON quarantine(source);\nCREATE INDEX IF NOT EXISTS idx_quarantine_date ON quarantine(quarantine_date);\nCREATE INDEX IF NOT EXISTS idx_quarantine_reviewed_by ON quarantine(reviewed_by);\n"; /** * Initialize the quarantine schema in the database * * @param db - Database connection */ export declare function initializeQuarantineSchema(db: DatabaseType): void; /** * Check if the quarantine table exists * * @param db - Database connection * @returns True if quarantine table exists */ export declare function hasQuarantineTable(db: DatabaseType): boolean; /** * Run quarantine schema migration if needed * * @param db - Database connection * @returns True if migration was run */ export declare function migrateQuarantineSchema(db: DatabaseType): boolean; //# sourceMappingURL=quarantine-schema.d.ts.map