Module: PWN::AI::Agent::SAST

Defined in:
lib/pwn/ai/agent/sast.rb

Overview

This module is an AI agent designed to analyze SAST antipatterns within source code repositories. It identifies common coding mistakes, security vulnerabilities, and areas for improvement in code quality. The agent generates an EPSS score for each identified issue, indicating the likelihood of exploitation. It provides detailed explanations of the issues found, along with recommendations for remediation and best practices to enhance code security and maintainability.

Class Method Summary collapse

Class Method Details

.analyze(opts = {}) ⇒ Object

Supported Method Parameters

ai_analysis = PWN::AI::Agent::SAST.analyze(

request: 'required - A string containing the source code snippet to be analyzed for SAST antipatterns and vulnerabilities.'

)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pwn/ai/agent/sast.rb', line 13

public_class_method def self.analyze(opts = {})
  request = opts[:request]
  raise 'ERROR: request parameter is required' if request.nil? || request.empty?

  system_role_content = 'Your sole purpose is to analyze source code snippets and generate an Exploit Prediction Scoring System (EPSS) score between 0% - 100%.  Just generate a score unless score is >= 75% in which a PoC and code fix should also be included.'

  PWN::AI::Introspection.reflect_on(
    system_role_content: system_role_content,
    request: request,
    suppress_pii_warning: true
  )
rescue StandardError => e
  raise e.backtrace
end

.authorsObject

Author(s)

0day Inc. <[email protected]>



30
31
32
33
34
# File 'lib/pwn/ai/agent/sast.rb', line 30

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



38
39
40
41
42
43
44
45
46
# File 'lib/pwn/ai/agent/sast.rb', line 38

public_class_method def self.help
  puts "USAGE:
    ai_analysis = PWN::AI::Agent::SAST.analyze(
      request: 'required - A string containing the source code snippet to be analyzed for SAST antipatterns and vulnerabilities.'
    )

    #{self}.authors
  "
end