<commit_before>module HackerOne
  module Client
    class Weakness
      class << self
        def extract_cwe_number(cwe)
          fail StandardError::ArgumentError unless cwe.upcase.start_with?('CWE-')

          cwe.split('CWE-').last.to_i
        end
      end

      OWASP_TOP_10_2013_TO_CWE = {
        'A1-Injection' => [77, 78, 88, 89, 90, 91, 564],
        'A2-AuthSession' =>
          [287, 613, 522, 256, 384, 472, 346, 441, 523, 620, 640, 319, 311],
        'A3-XSS' => [79],
        'A4-IDOR' => [639, 99, 22],
        'A5-SecurityMisconfiguration' => [16, 2, 215, 548, 209],
        'A6-DataExposure' => [312, 319, 310, 326, 320, 311, 325, 328, 327],
        'A7-MissingAccessControl' => [285, 287],
        'A8-CSRF' => [352, 642, 613, 346, 441],
        'A9-ComponentsWithKnownVulnerabilities' => [],
        'A10-Redirects' => [601],
      }.freeze

      OWASP_DEFAULT = 'A0-Other'.freeze

      def initialize(weakness)
        @attributes = weakness
      end

      def to_owasp
        OWASP_TOP_10_2013_TO_CWE.map do |owasp, cwes|<commit_msg>Renamed OWASP captions<commit_after>module HackerOne
  module Client
    class Weakness
      class << self
        def extract_cwe_number(cwe)
          fail StandardError::ArgumentError unless cwe.upcase.start_with?('CWE-')

          cwe.split('CWE-').last.to_i
        end
      end

      OWASP_TOP_10_2013_TO_CWE = {
        'A1-Injection' => [77, 78, 88, 89, 90, 91, 564],
        'A2-AuthSession' =>
          [287, 613, 522, 256, 384, 472, 346, 441, 523, 620, 640, 319, 311],
        'A3-XSS' => [79],
        'A4-DirectObjRef' => [639, 99, 22],
        'A5-Misconfig' => [16, 2, 215, 548, 209],
        'A6-DataExposure' => [312, 319, 310, 326, 320, 311, 325, 328, 327],
        'A7-MissingACL' => [285, 287],
        'A8-CSRF' => [352, 642, 613, 346, 441],
        'A9-KnownVuln' => [],
        'A10-Redirects' => [601],
      }.freeze

      OWASP_DEFAULT = 'A0-Other'.freeze

      def initialize(weakness)
        @attributes = weakness
      end

      def to_owasp
        OWASP_TOP_10_2013_TO_CWE.map do |owasp, cwes|
{'fraction_non_alphanumeric': 0.15135649690623512, 'fraction_numerical': 0.14278914802475012, 'mean_word_length': 2.218989280245023, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4870081', 'n_tokens_mistral': 1058, 'n_tokens_neox': 773, 'n_words': 177}