pwn 0.5.435 → 0.5.437

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/pwn/config.rb +101 -3
  4. data/lib/pwn/plugins/repl.rb +2 -2
  5. data/lib/pwn/plugins/vault.rb +15 -6
  6. data/lib/pwn/reports/sast.rb +50 -57
  7. data/lib/pwn/sast/amqp_connect_as_guest.rb +17 -1
  8. data/lib/pwn/sast/apache_file_system_util_api.rb +17 -1
  9. data/lib/pwn/sast/aws.rb +17 -1
  10. data/lib/pwn/sast/banned_function_calls_c.rb +17 -1
  11. data/lib/pwn/sast/base64.rb +17 -1
  12. data/lib/pwn/sast/beef_hook.rb +17 -1
  13. data/lib/pwn/sast/cmd_execution_java.rb +17 -1
  14. data/lib/pwn/sast/cmd_execution_python.rb +17 -1
  15. data/lib/pwn/sast/cmd_execution_ruby.rb +17 -1
  16. data/lib/pwn/sast/cmd_execution_scala.rb +17 -1
  17. data/lib/pwn/sast/csrf.rb +17 -1
  18. data/lib/pwn/sast/deserial_java.rb +17 -1
  19. data/lib/pwn/sast/emoticon.rb +17 -1
  20. data/lib/pwn/sast/eval.rb +17 -1
  21. data/lib/pwn/sast/factory.rb +17 -1
  22. data/lib/pwn/sast/http_authorization_header.rb +17 -1
  23. data/lib/pwn/sast/inner_html.rb +17 -1
  24. data/lib/pwn/sast/keystore.rb +17 -1
  25. data/lib/pwn/sast/local_storage.rb +17 -1
  26. data/lib/pwn/sast/location_hash.rb +17 -1
  27. data/lib/pwn/sast/log4j.rb +17 -1
  28. data/lib/pwn/sast/logger.rb +17 -1
  29. data/lib/pwn/sast/md5.rb +17 -1
  30. data/lib/pwn/sast/outer_html.rb +17 -1
  31. data/lib/pwn/sast/padding_oracle.rb +17 -1
  32. data/lib/pwn/sast/password.rb +17 -1
  33. data/lib/pwn/sast/php_input_mechanisms.rb +17 -1
  34. data/lib/pwn/sast/php_type_juggling.rb +17 -1
  35. data/lib/pwn/sast/pom_version.rb +17 -1
  36. data/lib/pwn/sast/port.rb +17 -1
  37. data/lib/pwn/sast/post_message.rb +17 -1
  38. data/lib/pwn/sast/private_key.rb +17 -1
  39. data/lib/pwn/sast/redirect.rb +17 -1
  40. data/lib/pwn/sast/redos.rb +17 -1
  41. data/lib/pwn/sast/shell.rb +17 -1
  42. data/lib/pwn/sast/signature.rb +17 -1
  43. data/lib/pwn/sast/sql.rb +17 -1
  44. data/lib/pwn/sast/ssl.rb +17 -1
  45. data/lib/pwn/sast/sudo.rb +17 -1
  46. data/lib/pwn/sast/task_tag.rb +17 -1
  47. data/lib/pwn/sast/throw_errors.rb +17 -1
  48. data/lib/pwn/sast/token.rb +17 -1
  49. data/lib/pwn/sast/type_script_type_juggling.rb +17 -1
  50. data/lib/pwn/sast/version.rb +17 -1
  51. data/lib/pwn/sast/window_location_hash.rb +17 -1
  52. data/lib/pwn/version.rb +1 -1
  53. data/lib/pwn.rb +3 -1
  54. data/spec/lib/pwn/config_spec.rb +0 -5
  55. metadata +1 -1
data/lib/pwn/sast/csrf.rb CHANGED
@@ -75,10 +75,26 @@ module PWN
75
75
  end
76
76
  author ||= 'N/A'
77
77
 
78
+ ai_instrospection = PWN::Env[:ai][:introspection]
79
+ ai_analysis = nil
80
+ if ai_instrospection
81
+ request = {
82
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
83
+ line_no: line_no,
84
+ source_code_snippet: contents
85
+ }.to_json
86
+ response = PWN::AI::Introspection.reflect(request: request)
87
+ if response.is_a?(Hash)
88
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
89
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
90
+ end
91
+ end
92
+
78
93
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
79
94
  line_no: line_no,
80
95
  contents: contents,
81
- author: author
96
+ author: author,
97
+ ai_analysis: ai_analysis
82
98
  )
83
99
 
84
100
  current_count += 2
@@ -83,10 +83,26 @@ module PWN
83
83
  end
84
84
  author ||= 'N/A'
85
85
 
86
+ ai_instrospection = PWN::Env[:ai][:introspection]
87
+ ai_analysis = nil
88
+ if ai_instrospection
89
+ request = {
90
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
91
+ line_no: line_no,
92
+ source_code_snippet: contents
93
+ }.to_json
94
+ response = PWN::AI::Introspection.reflect(request: request)
95
+ if response.is_a?(Hash)
96
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
97
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
98
+ end
99
+ end
100
+
86
101
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
87
102
  line_no: line_no,
88
103
  contents: contents,
89
- author: author
104
+ author: author,
105
+ ai_analysis: ai_analysis
90
106
  )
91
107
 
92
108
  current_count += 2
@@ -81,10 +81,26 @@ module PWN
81
81
  end
82
82
  author ||= 'N/A'
83
83
 
84
+ ai_instrospection = PWN::Env[:ai][:introspection]
85
+ ai_analysis = nil
86
+ if ai_instrospection
87
+ request = {
88
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
89
+ line_no: line_no,
90
+ source_code_snippet: contents
91
+ }.to_json
92
+ response = PWN::AI::Introspection.reflect(request: request)
93
+ if response.is_a?(Hash)
94
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
95
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
96
+ end
97
+ end
98
+
84
99
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
85
100
  line_no: line_no,
86
101
  contents: contents,
87
- author: author
102
+ author: author,
103
+ ai_analysis: ai_analysis
88
104
  )
89
105
 
90
106
  current_count += 2
data/lib/pwn/sast/eval.rb CHANGED
@@ -75,10 +75,26 @@ module PWN
75
75
  end
76
76
  author ||= 'N/A'
77
77
 
78
+ ai_instrospection = PWN::Env[:ai][:introspection]
79
+ ai_analysis = nil
80
+ if ai_instrospection
81
+ request = {
82
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
83
+ line_no: line_no,
84
+ source_code_snippet: contents
85
+ }.to_json
86
+ response = PWN::AI::Introspection.reflect(request: request)
87
+ if response.is_a?(Hash)
88
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
89
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
90
+ end
91
+ end
92
+
78
93
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
79
94
  line_no: line_no,
80
95
  contents: contents,
81
- author: author
96
+ author: author,
97
+ ai_analysis: ai_analysis
82
98
  )
83
99
 
84
100
  current_count += 2
@@ -78,10 +78,26 @@ module PWN
78
78
  end
79
79
  author ||= 'N/A'
80
80
 
81
+ ai_instrospection = PWN::Env[:ai][:introspection]
82
+ ai_analysis = nil
83
+ if ai_instrospection
84
+ request = {
85
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
86
+ line_no: line_no,
87
+ source_code_snippet: contents
88
+ }.to_json
89
+ response = PWN::AI::Introspection.reflect(request: request)
90
+ if response.is_a?(Hash)
91
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
92
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
93
+ end
94
+ end
95
+
81
96
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
82
97
  line_no: line_no,
83
98
  contents: contents,
84
- author: author
99
+ author: author,
100
+ ai_analysis: ai_analysis
85
101
  )
86
102
 
87
103
  current_count += 2
@@ -83,10 +83,26 @@ module PWN
83
83
  end
84
84
  author ||= 'N/A'
85
85
 
86
+ ai_instrospection = PWN::Env[:ai][:introspection]
87
+ ai_analysis = nil
88
+ if ai_instrospection
89
+ request = {
90
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
91
+ line_no: line_no,
92
+ source_code_snippet: contents
93
+ }.to_json
94
+ response = PWN::AI::Introspection.reflect(request: request)
95
+ if response.is_a?(Hash)
96
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
97
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
98
+ end
99
+ end
100
+
86
101
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
87
102
  line_no: line_no,
88
103
  contents: contents,
89
- author: author
104
+ author: author,
105
+ ai_analysis: ai_analysis
90
106
  )
91
107
 
92
108
  current_count += 2
@@ -75,10 +75,26 @@ module PWN
75
75
  end
76
76
  author ||= 'N/A'
77
77
 
78
+ ai_instrospection = PWN::Env[:ai][:introspection]
79
+ ai_analysis = nil
80
+ if ai_instrospection
81
+ request = {
82
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
83
+ line_no: line_no,
84
+ source_code_snippet: contents
85
+ }.to_json
86
+ response = PWN::AI::Introspection.reflect(request: request)
87
+ if response.is_a?(Hash)
88
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
89
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
90
+ end
91
+ end
92
+
78
93
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
79
94
  line_no: line_no,
80
95
  contents: contents,
81
- author: author
96
+ author: author,
97
+ ai_analysis: ai_analysis
82
98
  )
83
99
 
84
100
  current_count += 2
@@ -74,10 +74,26 @@ module PWN
74
74
  end
75
75
  author ||= 'N/A'
76
76
 
77
+ ai_instrospection = PWN::Env[:ai][:introspection]
78
+ ai_analysis = nil
79
+ if ai_instrospection
80
+ request = {
81
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
82
+ line_no: line_no,
83
+ source_code_snippet: contents
84
+ }.to_json
85
+ response = PWN::AI::Introspection.reflect(request: request)
86
+ if response.is_a?(Hash)
87
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
88
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
89
+ end
90
+ end
91
+
77
92
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
78
93
  line_no: line_no,
79
94
  contents: contents,
80
- author: author
95
+ author: author,
96
+ ai_analysis: ai_analysis
81
97
  )
82
98
 
83
99
  current_count += 2
@@ -76,10 +76,26 @@ module PWN
76
76
  end
77
77
  author ||= 'N/A'
78
78
 
79
+ ai_instrospection = PWN::Env[:ai][:introspection]
80
+ ai_analysis = nil
81
+ if ai_instrospection
82
+ request = {
83
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
84
+ line_no: line_no,
85
+ source_code_snippet: contents
86
+ }.to_json
87
+ response = PWN::AI::Introspection.reflect(request: request)
88
+ if response.is_a?(Hash)
89
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
90
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
91
+ end
92
+ end
93
+
79
94
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
80
95
  line_no: line_no,
81
96
  contents: contents,
82
- author: author
97
+ author: author,
98
+ ai_analysis: ai_analysis
83
99
  )
84
100
 
85
101
  current_count += 2
@@ -75,10 +75,26 @@ module PWN
75
75
  end
76
76
  author ||= 'N/A'
77
77
 
78
+ ai_instrospection = PWN::Env[:ai][:introspection]
79
+ ai_analysis = nil
80
+ if ai_instrospection
81
+ request = {
82
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
83
+ line_no: line_no,
84
+ source_code_snippet: contents
85
+ }.to_json
86
+ response = PWN::AI::Introspection.reflect(request: request)
87
+ if response.is_a?(Hash)
88
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
89
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
90
+ end
91
+ end
92
+
78
93
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
79
94
  line_no: line_no,
80
95
  contents: contents,
81
- author: author
96
+ author: author,
97
+ ai_analysis: ai_analysis
82
98
  )
83
99
 
84
100
  current_count += 2
@@ -74,10 +74,26 @@ module PWN
74
74
  end
75
75
  author ||= 'N/A'
76
76
 
77
+ ai_instrospection = PWN::Env[:ai][:introspection]
78
+ ai_analysis = nil
79
+ if ai_instrospection
80
+ request = {
81
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
82
+ line_no: line_no,
83
+ source_code_snippet: contents
84
+ }.to_json
85
+ response = PWN::AI::Introspection.reflect(request: request)
86
+ if response.is_a?(Hash)
87
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
88
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
89
+ end
90
+ end
91
+
77
92
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
78
93
  line_no: line_no,
79
94
  contents: contents,
80
- author: author
95
+ author: author,
96
+ ai_analysis: ai_analysis
81
97
  )
82
98
 
83
99
  current_count += 2
@@ -89,10 +89,26 @@ module PWN
89
89
  end
90
90
  author ||= 'N/A'
91
91
 
92
+ ai_instrospection = PWN::Env[:ai][:introspection]
93
+ ai_analysis = nil
94
+ if ai_instrospection
95
+ request = {
96
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
97
+ line_no: line_no,
98
+ source_code_snippet: contents
99
+ }.to_json
100
+ response = PWN::AI::Introspection.reflect(request: request)
101
+ if response.is_a?(Hash)
102
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
103
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
104
+ end
105
+ end
106
+
92
107
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
93
108
  line_no: line_no,
94
109
  contents: contents,
95
- author: author
110
+ author: author,
111
+ ai_analysis: ai_analysis
96
112
  )
97
113
 
98
114
  current_count += 2
data/lib/pwn/sast/md5.rb CHANGED
@@ -74,10 +74,26 @@ module PWN
74
74
  end
75
75
  author ||= 'N/A'
76
76
 
77
+ ai_instrospection = PWN::Env[:ai][:introspection]
78
+ ai_analysis = nil
79
+ if ai_instrospection
80
+ request = {
81
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
82
+ line_no: line_no,
83
+ source_code_snippet: contents
84
+ }.to_json
85
+ response = PWN::AI::Introspection.reflect(request: request)
86
+ if response.is_a?(Hash)
87
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
88
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
89
+ end
90
+ end
91
+
77
92
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
78
93
  line_no: line_no,
79
94
  contents: contents,
80
- author: author
95
+ author: author,
96
+ ai_analysis: ai_analysis
81
97
  )
82
98
 
83
99
  current_count += 2
@@ -75,10 +75,26 @@ module PWN
75
75
  end
76
76
  author ||= 'N/A'
77
77
 
78
+ ai_instrospection = PWN::Env[:ai][:introspection]
79
+ ai_analysis = nil
80
+ if ai_instrospection
81
+ request = {
82
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
83
+ line_no: line_no,
84
+ source_code_snippet: contents
85
+ }.to_json
86
+ response = PWN::AI::Introspection.reflect(request: request)
87
+ if response.is_a?(Hash)
88
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
89
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
90
+ end
91
+ end
92
+
78
93
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
79
94
  line_no: line_no,
80
95
  contents: contents,
81
- author: author
96
+ author: author,
97
+ ai_analysis: ai_analysis
82
98
  )
83
99
 
84
100
  current_count += 2
@@ -74,10 +74,26 @@ module PWN
74
74
  end
75
75
  author ||= 'N/A'
76
76
 
77
+ ai_instrospection = PWN::Env[:ai][:introspection]
78
+ ai_analysis = nil
79
+ if ai_instrospection
80
+ request = {
81
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
82
+ line_no: line_no,
83
+ source_code_snippet: contents
84
+ }.to_json
85
+ response = PWN::AI::Introspection.reflect(request: request)
86
+ if response.is_a?(Hash)
87
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
88
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
89
+ end
90
+ end
91
+
77
92
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
78
93
  line_no: line_no,
79
94
  contents: contents,
80
- author: author
95
+ author: author,
96
+ ai_analysis: ai_analysis
81
97
  )
82
98
 
83
99
  current_count += 2
@@ -78,10 +78,26 @@ module PWN
78
78
  end
79
79
  author ||= 'N/A'
80
80
 
81
+ ai_instrospection = PWN::Env[:ai][:introspection]
82
+ ai_analysis = nil
83
+ if ai_instrospection
84
+ request = {
85
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
86
+ line_no: line_no,
87
+ source_code_snippet: contents
88
+ }.to_json
89
+ response = PWN::AI::Introspection.reflect(request: request)
90
+ if response.is_a?(Hash)
91
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
92
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
93
+ end
94
+ end
95
+
81
96
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
82
97
  line_no: line_no,
83
98
  contents: contents,
84
- author: author
99
+ author: author,
100
+ ai_analysis: ai_analysis
85
101
  )
86
102
 
87
103
  current_count += 2
@@ -80,10 +80,26 @@ module PWN
80
80
  end
81
81
  author ||= 'N/A'
82
82
 
83
+ ai_instrospection = PWN::Env[:ai][:introspection]
84
+ ai_analysis = nil
85
+ if ai_instrospection
86
+ request = {
87
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
88
+ line_no: line_no,
89
+ source_code_snippet: contents
90
+ }.to_json
91
+ response = PWN::AI::Introspection.reflect(request: request)
92
+ if response.is_a?(Hash)
93
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
94
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
95
+ end
96
+ end
97
+
83
98
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
84
99
  line_no: line_no,
85
100
  contents: contents,
86
- author: author
101
+ author: author,
102
+ ai_analysis: ai_analysis
87
103
  )
88
104
 
89
105
  current_count += 2
@@ -78,10 +78,26 @@ module PWN
78
78
  end
79
79
  author ||= 'N/A'
80
80
 
81
+ ai_instrospection = PWN::Env[:ai][:introspection]
82
+ ai_analysis = nil
83
+ if ai_instrospection
84
+ request = {
85
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
86
+ line_no: line_no,
87
+ source_code_snippet: contents
88
+ }.to_json
89
+ response = PWN::AI::Introspection.reflect(request: request)
90
+ if response.is_a?(Hash)
91
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
92
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
93
+ end
94
+ end
95
+
81
96
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
82
97
  line_no: line_no,
83
98
  contents: contents,
84
- author: author
99
+ author: author,
100
+ ai_analysis: ai_analysis
85
101
  )
86
102
 
87
103
  current_count += 2
@@ -77,10 +77,26 @@ module PWN
77
77
  end
78
78
  author ||= 'N/A'
79
79
 
80
+ ai_instrospection = PWN::Env[:ai][:introspection]
81
+ ai_analysis = nil
82
+ if ai_instrospection
83
+ request = {
84
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
85
+ line_no: line_no,
86
+ source_code_snippet: contents
87
+ }.to_json
88
+ response = PWN::AI::Introspection.reflect(request: request)
89
+ if response.is_a?(Hash)
90
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
91
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
92
+ end
93
+ end
94
+
80
95
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
81
96
  line_no: line_no,
82
97
  contents: contents,
83
- author: author
98
+ author: author,
99
+ ai_analysis: ai_analysis
84
100
  )
85
101
 
86
102
  current_count += 2
data/lib/pwn/sast/port.rb CHANGED
@@ -81,10 +81,26 @@ module PWN
81
81
  end
82
82
  author ||= 'N/A'
83
83
 
84
+ ai_instrospection = PWN::Env[:ai][:introspection]
85
+ ai_analysis = nil
86
+ if ai_instrospection
87
+ request = {
88
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
89
+ line_no: line_no,
90
+ source_code_snippet: contents
91
+ }.to_json
92
+ response = PWN::AI::Introspection.reflect(request: request)
93
+ if response.is_a?(Hash)
94
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
95
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
96
+ end
97
+ end
98
+
84
99
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
85
100
  line_no: line_no,
86
101
  contents: contents,
87
- author: author
102
+ author: author,
103
+ ai_analysis: ai_analysis
88
104
  )
89
105
 
90
106
  current_count += 2
@@ -75,10 +75,26 @@ module PWN
75
75
  end
76
76
  author ||= 'N/A'
77
77
 
78
+ ai_instrospection = PWN::Env[:ai][:introspection]
79
+ ai_analysis = nil
80
+ if ai_instrospection
81
+ request = {
82
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
83
+ line_no: line_no,
84
+ source_code_snippet: contents
85
+ }.to_json
86
+ response = PWN::AI::Introspection.reflect(request: request)
87
+ if response.is_a?(Hash)
88
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
89
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
90
+ end
91
+ end
92
+
78
93
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
79
94
  line_no: line_no,
80
95
  contents: contents,
81
- author: author
96
+ author: author,
97
+ ai_analysis: ai_analysis
82
98
  )
83
99
 
84
100
  current_count += 2
@@ -74,10 +74,26 @@ module PWN
74
74
  end
75
75
  author ||= 'N/A'
76
76
 
77
+ ai_instrospection = PWN::Env[:ai][:introspection]
78
+ ai_analysis = nil
79
+ if ai_instrospection
80
+ request = {
81
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
82
+ line_no: line_no,
83
+ source_code_snippet: contents
84
+ }.to_json
85
+ response = PWN::AI::Introspection.reflect(request: request)
86
+ if response.is_a?(Hash)
87
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
88
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
89
+ end
90
+ end
91
+
77
92
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
78
93
  line_no: line_no,
79
94
  contents: contents,
80
- author: author
95
+ author: author,
96
+ ai_analysis: ai_analysis
81
97
  )
82
98
 
83
99
  current_count += 2
@@ -76,10 +76,26 @@ module PWN
76
76
  end
77
77
  author ||= 'N/A'
78
78
 
79
+ ai_instrospection = PWN::Env[:ai][:introspection]
80
+ ai_analysis = nil
81
+ if ai_instrospection
82
+ request = {
83
+ scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
84
+ line_no: line_no,
85
+ source_code_snippet: contents
86
+ }.to_json
87
+ response = PWN::AI::Introspection.reflect(request: request)
88
+ if response.is_a?(Hash)
89
+ ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
90
+ ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
91
+ end
92
+ end
93
+
79
94
  hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
80
95
  line_no: line_no,
81
96
  contents: contents,
82
- author: author
97
+ author: author,
98
+ ai_analysis: ai_analysis
83
99
  )
84
100
 
85
101
  current_count += 2