All files / src/utils implementationUtils.ts

75.67% Statements 28/37
73.52% Branches 25/34
100% Functions 3/3
75.67% Lines 28/37

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110                          57x 19x   1x       16x   1x   1x           38x 19x   1x       15x   2x   1x             19x   1x   1x   15x   1x   1x                         30x   2x       26x   1x   1x                         30x   2x       25x   2x   1x          
import { SecurityLevel } from "../types/cia";
 
/**
 * Gets implementation description for a CIA component at a specific security level
 *
 * @param component - The CIA component (confidentiality, integrity, availability)
 * @param level - The security level
 * @returns Human-readable implementation description
 */
export function getImplementationDescription(
  component: "confidentiality" | "integrity" | "availability",
  level: SecurityLevel
): string {
  if (component === "confidentiality") {
    switch (level) {
      case "None":
        return "No data protection controls needed";
      case "Low":
        return "Basic access controls and authentication";
      case "Moderate":
        return "Role-based access and encryption for sensitive data";
      case "High":
        return "Comprehensive encryption and access controls";
      case "Very High":
        return "Maximum protection with advanced encryption and zero-trust";
      default:
        return "Standard data protection controls";
    }
  }
 
  if (component === "integrity") {
    switch (level) {
      case "None":
        return "No data validation controls needed";
      case "Low":
        return "Basic input validation and error checking";
      case "Moderate":
        return "Data validation and cryptographic checksums";
      case "High":
        return "Digital signatures and strong validation";
      case "Very High":
        return "Formal verification and immutable audit trails";
      default:
        return "Standard data integrity controls";
    }
  }
 
  // availability
  switch (level) {
    case "None":
      return "No uptime guarantees or redundancy";
    case "Low":
      return "Basic backup and recovery procedures";
    case "Moderate":
      return "Redundant components and standard backups";
    case "High":
      return "High availability clustering and failover";
    case "Very High":
      return "Multi-site redundancy and continuous availability";
    default:
      return "Standard availability controls";
  }
}
 
/**
 * Gets validation level text for integrity security level
 *
 * @param level - The security level
 * @returns Human-readable validation level
 */
export function getIntegrityValidationLevel(level: SecurityLevel): string {
  switch (level) {
    case "None":
      return "Unverified";
    case "Low":
      return "Basic Validation";
    case "Moderate":
      return "Validated";
    case "High":
      return "Strongly Validated";
    case "Very High":
      return "Formally Verified";
    default:
      return "Unknown";
  }
}
 
/**
 * Gets uptime target text for availability security level
 *
 * @param level - The security level
 * @returns Human-readable uptime target
 */
export function getAvailabilityUptimeTarget(level: SecurityLevel): string {
  switch (level) {
    case "None":
      return "No guarantee";
    case "Low":
      return "95%";
    case "Moderate":
      return "99%";
    case "High":
      return "99.9%";
    case "Very High":
      return "99.999%";
    default:
      return "Unknown";
  }
}