Class: SentinelRb::Analyzers::DangerousTools

Inherits:
Base
  • Object
show all
Defined in:
lib/sentinel_rb/analyzers/dangerous_tools.rb

Overview

A5: Dangerous Tools Detection Detects prompts that reference potentially dangerous tools, techniques, or requests

Instance Attribute Summary

Attributes inherited from Base

#client, #config, #prompt

Instance Method Summary collapse

Constructor Details

#initialize(prompt, config, client) ⇒ DangerousTools

Returns a new instance of DangerousTools.



10
11
12
13
14
15
# File 'lib/sentinel_rb/analyzers/dangerous_tools.rb', line 10

def initialize(prompt, config, client)
  super
  @dangerous_keywords = config["dangerous_keywords"] || default_dangerous_keywords
  @weapon_keywords = config["weapon_keywords"] || default_weapon_keywords
  @cyber_keywords = config["cyber_keywords"] || default_cyber_keywords
end

Instance Method Details

#analyze(prompt) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/sentinel_rb/analyzers/dangerous_tools.rb', line 21

def analyze(prompt)
  findings = []

  # Check for weapon/explosive creation requests
  findings.concat(check_weapon_creation(prompt))

  # Check for cyber attack tools/techniques
  findings.concat(check_cyber_attacks(prompt))

  # Check for illegal substance creation
  findings.concat(check_illegal_substances(prompt))

  # Check for financial fraud techniques
  findings.concat(check_financial_fraud(prompt))

  # Check for identity theft/privacy violations
  findings.concat(check_privacy_violations(prompt))

  findings
end

#callObject



17
18
19
# File 'lib/sentinel_rb/analyzers/dangerous_tools.rb', line 17

def call
  analyze(@prompt)
end