/**
 * NIST AI Risk Management Framework (AI RMF) Compliance
 *
 * Maps security findings to NIST AI RMF 1.0 controls.
 * Includes GenAI Profile (NIST AI 600-1) extensions.
 *
 * @see https://www.nist.gov/itl/ai-risk-management-framework
 * @see https://airc.nist.gov/AI_RMF_Knowledge_Base/AI_RMF
 * @module compliance/frameworks/nist-ai-rmf
 */
/**
 * NIST AI RMF Controls
 *
 * Based on NIST AI RMF 1.0 (January 2023) with GenAI Profile extensions.
 * Controls are organized by the four core functions: GOVERN, MAP, MEASURE, MANAGE.
 */
export const NIST_AI_RMF_CONTROLS = [
    // ============================================================================
    // GOVERN: Cultivate a culture of risk management
    // ============================================================================
    {
        id: "GOVERN-1.1",
        framework: "NIST-AI-RMF",
        category: "Governance",
        title: "AI Risk Management Policies",
        description: "Legal and regulatory requirements involving AI are understood, managed, and documented. Organizational policies and procedures are established to address AI-specific risks.",
        keywords: [
            "policy",
            "governance",
            "compliance",
            "regulatory",
            "ai risk",
            "documentation",
        ],
        findingCategories: [
            "security-misconfiguration",
            "logging-failure",
        ],
        severityThreshold: "low",
    },
    {
        id: "GOVERN-1.2",
        framework: "NIST-AI-RMF",
        category: "Governance",
        title: "AI Risk Accountability",
        description: "The characteristics of trustworthy AI are integrated into organizational policies, processes, procedures, and practices. Roles and responsibilities for AI risk management are defined.",
        keywords: [
            "accountability",
            "roles",
            "responsibilities",
            "trustworthy ai",
            "organizational",
        ],
        findingCategories: [
            "excessive-agency",
            "overscoped-permission",
        ],
        severityThreshold: "medium",
    },
    {
        id: "GOVERN-1.3",
        framework: "NIST-AI-RMF",
        category: "Governance",
        title: "AI System Documentation",
        description: "Processes, procedures, and practices are in place to determine the needed level of risk management activities based on the organization's risk tolerance.",
        keywords: [
            "documentation",
            "risk tolerance",
            "processes",
            "procedures",
        ],
        findingCategories: [
            "manifest-drift",
            "tool-drift",
        ],
        severityThreshold: "low",
    },
    {
        id: "GOVERN-1.4",
        framework: "NIST-AI-RMF",
        category: "Governance",
        title: "AI Risk Culture",
        description: "The risk management process and its outcomes are established through transparent policies, procedures, and other controls based on organizational risk priorities.",
        keywords: [
            "risk culture",
            "transparency",
            "risk priorities",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "GOVERN-1.5",
        framework: "NIST-AI-RMF",
        category: "Governance",
        title: "Ongoing Monitoring",
        description: "Ongoing monitoring and periodic review of the risk management process and its outcomes are planned and organizational roles and responsibilities are clearly defined.",
        keywords: [
            "monitoring",
            "periodic review",
            "risk management",
        ],
        findingCategories: [
            "logging-failure",
            "consensus-manipulation",
        ],
        severityThreshold: "medium",
    },
    {
        id: "GOVERN-1.6",
        framework: "NIST-AI-RMF",
        category: "Governance",
        title: "Risk Management Integration",
        description: "Mechanisms are in place to inventory AI systems and are resourced according to organizational risk priorities. AI risk management is integrated into broader enterprise risk.",
        keywords: [
            "inventory",
            "enterprise risk",
            "integration",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    // ============================================================================
    // MAP: Contextualize risks in real-world settings
    // ============================================================================
    {
        id: "MAP-1.1",
        framework: "NIST-AI-RMF",
        category: "Context Mapping",
        title: "Intended Purpose Definition",
        description: "Intended purposes, potentially beneficial uses, context of use, and deployment setting of the AI system are documented. This includes assumptions about users, tasks, and operational environments.",
        keywords: [
            "purpose",
            "deployment",
            "context",
            "use case",
        ],
        findingCategories: [
            "excessive-agency",
        ],
        severityThreshold: "low",
    },
    {
        id: "MAP-1.2",
        framework: "NIST-AI-RMF",
        category: "Context Mapping",
        title: "Interdependency Analysis",
        description: "Inter-dependencies among AI components, systems, and human actors are mapped. This includes data dependencies, model dependencies, and integration points.",
        keywords: [
            "dependencies",
            "integration",
            "components",
        ],
        findingCategories: [
            "supply-chain-vuln",
            "dependency-vuln",
            "exfil-path",
        ],
        severityThreshold: "medium",
    },
    {
        id: "MAP-2.1",
        framework: "NIST-AI-RMF",
        category: "Stakeholder Mapping",
        title: "Stakeholder Identification",
        description: "The specific tasks and methods used to implement the tasks that the AI system will support are defined. Scientific validity of methods is documented.",
        keywords: [
            "stakeholders",
            "tasks",
            "methods",
            "validity",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MAP-2.2",
        framework: "NIST-AI-RMF",
        category: "Stakeholder Mapping",
        title: "Human Oversight Requirements",
        description: "Information about the AI system's knowledge limits and how system outputs may be utilized is documented. Human oversight requirements are established.",
        keywords: [
            "human oversight",
            "knowledge limits",
            "outputs",
        ],
        findingCategories: [
            "overreliance",
            "excessive-agency",
        ],
        severityThreshold: "medium",
    },
    {
        id: "MAP-3.1",
        framework: "NIST-AI-RMF",
        category: "Risk Identification",
        title: "Potential Negative Impacts",
        description: "Potential negative impacts of AI systems — to individuals, groups, communities, organizations, and society — are documented. Potential costs from problematic outputs are evaluated.",
        keywords: [
            "negative impacts",
            "harm",
            "costs",
            "problematic outputs",
        ],
        findingCategories: [
            "prompt-injection",
            "insecure-output",
            "sensitive-disclosure",
        ],
        severityThreshold: "high",
    },
    {
        id: "MAP-3.2",
        framework: "NIST-AI-RMF",
        category: "Risk Identification",
        title: "Likelihood and Magnitude Assessment",
        description: "Likelihood and magnitude of each identified impact based on expected use, past uses, or similar AI systems, including downstream system impacts, are assessed.",
        keywords: [
            "likelihood",
            "magnitude",
            "impact assessment",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MAP-4.1",
        framework: "NIST-AI-RMF",
        category: "Benefits and Costs",
        title: "Deployment Decision Framework",
        description: "Approaches for mapping, measuring, and managing AI risks take into account learning from incidents, errors, and near-misses.",
        keywords: [
            "incidents",
            "learning",
            "near-misses",
        ],
        findingCategories: [
            "logging-failure",
        ],
        severityThreshold: "medium",
    },
    // ============================================================================
    // MEASURE: Analyze, assess, benchmark, and monitor AI risk
    // ============================================================================
    {
        id: "MEASURE-1.1",
        framework: "NIST-AI-RMF",
        category: "Risk Measurement",
        title: "Risk Metrics Definition",
        description: "Approaches and metrics for measurement of AI risks are defined. Measurement includes quantitative, qualitative, or mixed-method tools, techniques, and methodologies.",
        keywords: [
            "metrics",
            "measurement",
            "quantitative",
            "qualitative",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MEASURE-1.2",
        framework: "NIST-AI-RMF",
        category: "Risk Measurement",
        title: "Risk Assessment Methodology",
        description: "Appropriateness of AI metrics and effectiveness of existing controls are regularly assessed. Metrics are documented and used to inform risk management decisions.",
        keywords: [
            "assessment",
            "effectiveness",
            "controls",
        ],
        findingCategories: [
            "security-misconfiguration",
        ],
        severityThreshold: "medium",
    },
    {
        id: "MEASURE-2.1",
        framework: "NIST-AI-RMF",
        category: "Trustworthiness Testing",
        title: "Trustworthiness Evaluation",
        description: "Test sets, metrics, and details about the tools used during the evaluation are documented. Testing includes robustness, security, privacy, and fairness evaluation.",
        keywords: [
            "testing",
            "evaluation",
            "trustworthiness",
            "robustness",
        ],
        findingCategories: [
            "prompt-injection",
            "model-denial-of-service",
        ],
        severityThreshold: "high",
    },
    {
        id: "MEASURE-2.2",
        framework: "NIST-AI-RMF",
        category: "Trustworthiness Testing",
        title: "Security Testing",
        description: "Evaluations are conducted regularly to assess and benchmark AI system trustworthiness characteristics, including security, privacy, and accuracy.",
        keywords: [
            "security testing",
            "benchmarking",
            "regular evaluation",
        ],
        findingCategories: [
            "prompt-injection",
            "insecure-plugin",
            "missing-sandbox",
        ],
        severityThreshold: "high",
    },
    {
        id: "MEASURE-2.3",
        framework: "NIST-AI-RMF",
        category: "Trustworthiness Testing",
        title: "Adversarial Testing",
        description: "AI system performance or assurance criteria are measured qualitatively or quantitatively through adversarial testing. Red team exercises assess system resilience.",
        keywords: [
            "adversarial",
            "red team",
            "resilience",
            "attack simulation",
        ],
        findingCategories: [
            "prompt-injection",
            "insecure-output",
            "model-theft",
        ],
        severityThreshold: "high",
    },
    {
        id: "MEASURE-3.1",
        framework: "NIST-AI-RMF",
        category: "External Input",
        title: "Feedback Mechanisms",
        description: "Feedback about efficacy of measurement is gathered and integrated into system improvements. Mechanisms exist for stakeholders to report issues.",
        keywords: [
            "feedback",
            "stakeholder input",
            "reporting",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MEASURE-4.1",
        framework: "NIST-AI-RMF",
        category: "Continuous Monitoring",
        title: "Deployment Monitoring",
        description: "Measurement approaches for identifying AI risks are connected to deployment, operation, and monitoring procedures. Continuous monitoring is implemented.",
        keywords: [
            "monitoring",
            "deployment",
            "operations",
        ],
        findingCategories: [
            "manifest-drift",
            "tool-drift",
            "unsigned-change",
        ],
        severityThreshold: "medium",
    },
    // ============================================================================
    // MANAGE: Allocate risk resources to mapped and measured risks
    // ============================================================================
    {
        id: "MANAGE-1.1",
        framework: "NIST-AI-RMF",
        category: "Risk Prioritization",
        title: "Risk Prioritization",
        description: "A determination is made as to whether the AI system achieves its intended purposes and supports the goals of risk management. Risks are prioritized for action.",
        keywords: [
            "prioritization",
            "intended purpose",
            "risk action",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MANAGE-1.2",
        framework: "NIST-AI-RMF",
        category: "Risk Prioritization",
        title: "Treatment Options",
        description: "Treatment of documented AI risks is prioritized based on impact, likelihood, and available resources. Mitigation options are evaluated.",
        keywords: [
            "treatment",
            "mitigation",
            "resources",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MANAGE-2.1",
        framework: "NIST-AI-RMF",
        category: "Risk Response",
        title: "Risk Treatment Implementation",
        description: "Resources are allocated for risk treatment, including mitigation, transfer, acceptance, or avoidance. Implementation timelines are established.",
        keywords: [
            "treatment",
            "resources",
            "implementation",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MANAGE-2.2",
        framework: "NIST-AI-RMF",
        category: "Risk Response",
        title: "Third-Party Risk Management",
        description: "Mechanisms are in place and applied to sustain the value of deployed AI systems. Third-party AI risks are managed through contracts and agreements.",
        keywords: [
            "third-party",
            "contracts",
            "vendor management",
        ],
        findingCategories: [
            "supply-chain-vuln",
            "insecure-plugin",
        ],
        severityThreshold: "high",
    },
    {
        id: "MANAGE-3.1",
        framework: "NIST-AI-RMF",
        category: "Communication",
        title: "Risk Communication",
        description: "AI risks are communicated internally and externally. Stakeholders are informed about relevant AI system capabilities, limitations, and risks.",
        keywords: [
            "communication",
            "transparency",
            "stakeholders",
        ],
        findingCategories: [],
        severityThreshold: "low",
    },
    {
        id: "MANAGE-4.1",
        framework: "NIST-AI-RMF",
        category: "Incident Response",
        title: "Incident Response Planning",
        description: "Post-deployment AI system monitoring plans are established. Mechanisms are established to track identified risks over time.",
        keywords: [
            "incident response",
            "monitoring",
            "tracking",
        ],
        findingCategories: [
            "logging-failure",
        ],
        severityThreshold: "medium",
    },
    {
        id: "MANAGE-4.2",
        framework: "NIST-AI-RMF",
        category: "Incident Response",
        title: "Incident Response Execution",
        description: "Measurable activities are routinely performed during the AI system's lifecycle. Responses to incidents are documented and lessons learned are incorporated.",
        keywords: [
            "incident response",
            "lifecycle",
            "lessons learned",
        ],
        findingCategories: [],
        severityThreshold: "medium",
    },
    // ============================================================================
    // GenAI Profile Extensions (NIST AI 600-1)
    // ============================================================================
    {
        id: "GenAI-1.1",
        framework: "NIST-AI-RMF",
        category: "GenAI Governance",
        title: "Generative AI Content Provenance",
        description: "Systems are in place to track the provenance of AI-generated content. Content watermarking and authentication mechanisms are implemented.",
        keywords: [
            "provenance",
            "watermarking",
            "content authentication",
            "generative ai",
        ],
        findingCategories: [
            "unsigned-change",
            "integrity-failure",
        ],
        severityThreshold: "medium",
    },
    {
        id: "GenAI-1.2",
        framework: "NIST-AI-RMF",
        category: "GenAI Governance",
        title: "GenAI Usage Policies",
        description: "Policies governing the use of generative AI are documented. Acceptable use, prohibited uses, and escalation procedures are defined.",
        keywords: [
            "usage policies",
            "acceptable use",
            "generative ai",
        ],
        findingCategories: [
            "excessive-agency",
            "overreliance",
        ],
        severityThreshold: "low",
    },
    {
        id: "GenAI-2.1",
        framework: "NIST-AI-RMF",
        category: "GenAI Security",
        title: "Prompt Injection Prevention",
        description: "Controls are implemented to prevent prompt injection attacks. Input validation, output filtering, and privilege separation are applied.",
        keywords: [
            "prompt injection",
            "input validation",
            "output filtering",
        ],
        findingCategories: [
            "prompt-injection",
            "injection",
        ],
        severityThreshold: "critical",
    },
    {
        id: "GenAI-2.2",
        framework: "NIST-AI-RMF",
        category: "GenAI Security",
        title: "Model Output Validation",
        description: "All model outputs are validated before use in downstream systems. Context-aware sanitization is applied based on output destination.",
        keywords: [
            "output validation",
            "sanitization",
            "downstream systems",
        ],
        findingCategories: [
            "insecure-output",
            "xss",
            "sql-injection",
            "command-injection",
        ],
        severityThreshold: "high",
    },
    {
        id: "GenAI-3.1",
        framework: "NIST-AI-RMF",
        category: "GenAI Privacy",
        title: "Sensitive Data Protection",
        description: "Controls prevent disclosure of sensitive information through model outputs. PII detection and masking are implemented.",
        keywords: [
            "sensitive data",
            "pii",
            "data protection",
            "disclosure",
        ],
        findingCategories: [
            "sensitive-disclosure",
            "pii-exposure",
            "exfil-path",
        ],
        severityThreshold: "high",
    },
    {
        id: "GenAI-3.2",
        framework: "NIST-AI-RMF",
        category: "GenAI Privacy",
        title: "Training Data Privacy",
        description: "Privacy-preserving techniques are applied during model training. Differential privacy and data anonymization are considered.",
        keywords: [
            "training data",
            "privacy",
            "anonymization",
        ],
        findingCategories: [
            "training-data-poisoning",
            "pii-exposure",
        ],
        severityThreshold: "medium",
    },
    {
        id: "GenAI-4.1",
        framework: "NIST-AI-RMF",
        category: "GenAI Reliability",
        title: "Hallucination Mitigation",
        description: "Controls are in place to detect and mitigate model hallucinations. Fact-checking, grounding, and confidence scoring are implemented.",
        keywords: [
            "hallucination",
            "fact-checking",
            "grounding",
            "confidence",
        ],
        findingCategories: [
            "overreliance",
        ],
        severityThreshold: "medium",
    },
    {
        id: "GenAI-4.2",
        framework: "NIST-AI-RMF",
        category: "GenAI Reliability",
        title: "Tool Use Safety",
        description: "Controls govern the safe use of tools and plugins by generative AI systems. Permission scoping, sandboxing, and monitoring are applied.",
        keywords: [
            "tool use",
            "plugins",
            "sandboxing",
            "permissions",
        ],
        findingCategories: [
            "insecure-plugin",
            "excessive-agency",
            "missing-sandbox",
            "overscoped-permission",
        ],
        severityThreshold: "high",
    },
    {
        id: "GenAI-4.3",
        framework: "NIST-AI-RMF",
        category: "GenAI Reliability",
        title: "Multi-Agent Safety",
        description: "Controls ensure safe operation of multi-agent systems. Consensus mechanisms, agent isolation, and cascade prevention are implemented.",
        keywords: [
            "multi-agent",
            "consensus",
            "agent safety",
            "cascade",
        ],
        findingCategories: [
            "consensus-manipulation",
            "excessive-agency",
        ],
        severityThreshold: "high",
    },
];
/**
 * Get all NIST AI RMF controls
 */
export function getNISTAIRMFControls() {
    return NIST_AI_RMF_CONTROLS;
}
/**
 * Get NIST AI RMF control by ID
 */
export function getNISTAIRMFControlById(id) {
    return NIST_AI_RMF_CONTROLS.find((c) => c.id === id);
}
/**
 * Get NIST AI RMF controls by function (GOVERN, MAP, MEASURE, MANAGE)
 */
export function getNISTAIRMFControlsByFunction(func) {
    return NIST_AI_RMF_CONTROLS.filter((c) => c.id.startsWith(func));
}
/**
 * Get NIST AI RMF controls by category
 */
export function getNISTAIRMFControlsByCategory(category) {
    return NIST_AI_RMF_CONTROLS.filter((c) => c.category === category);
}
/**
 * Get all NIST AI RMF categories
 */
export function getNISTAIRMFCategories() {
    return [...new Set(NIST_AI_RMF_CONTROLS.map((c) => c.category))];
}
/**
 * Get GenAI Profile controls only
 */
export function getGenAIProfileControls() {
    return NIST_AI_RMF_CONTROLS.filter((c) => c.id.startsWith("GenAI"));
}
/**
 * Get all NIST AI RMF functions
 */
export function getNISTAIRMFFunctions() {
    return ["GOVERN", "MAP", "MEASURE", "MANAGE"];
}
//# sourceMappingURL=nist-ai-rmf.js.map