Class: Sqreen::Attack

Inherits:
Event
  • Object
show all
Defined in:
lib/sqreen/events/attack.rb

Overview

Attack When creating a new attack, it gets automatically pushed to the event’s queue. XXX: TURNS OUT THIS CLASS IS ACTUALLY NOT USED ANYMORE Framework.observe is used instead with unstructured attack details

Instance Attribute Summary

Attributes inherited from Event

#payload

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#initialize, #to_s

Constructor Details

This class inherits a constructor from Sqreen::Event

Class Method Details

.record(payload) ⇒ Object



17
18
19
20
# File 'lib/sqreen/events/attack.rb', line 17

def self.record(payload)
  attack = Attack.new(payload)
  attack.enqueue
end

Instance Method Details

#attack_typeObject



51
52
53
54
# File 'lib/sqreen/events/attack.rb', line 51

def attack_type
  return nil unless payload['rule']
  payload['rule']['attack_type']
end

#backtraceObject



61
62
63
64
# File 'lib/sqreen/events/attack.rb', line 61

def backtrace
  return nil unless payload['context']
  payload['context']['backtrace']
end

#beta?Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/sqreen/events/attack.rb', line 41

def beta?
  return nil unless payload['rule']
  payload['rule']['beta'] ? true : false
end

#block?Boolean

Returns:

  • (Boolean)


46
47
48
49
# File 'lib/sqreen/events/attack.rb', line 46

def block?
  return nil unless payload['rule']
  payload['rule']['block'] ? true : false
end

#datadog_span_idObject



70
71
72
# File 'lib/sqreen/events/attack.rb', line 70

def datadog_span_id
  payload['context']['datadog_span_id']
end

#datadog_trace_idObject



66
67
68
# File 'lib/sqreen/events/attack.rb', line 66

def datadog_trace_id
  payload['context']['datadog_trace_id']
end

#enqueueObject



74
75
76
# File 'lib/sqreen/events/attack.rb', line 74

def enqueue
  Sqreen.queue.push(self)
end

#infosObject



22
23
24
# File 'lib/sqreen/events/attack.rb', line 22

def infos
  payload['infos']
end

#rule_nameObject



31
32
33
34
# File 'lib/sqreen/events/attack.rb', line 31

def rule_name
  return nil unless payload['rule']
  payload['rule']['name']
end

#rulespack_idObject



26
27
28
29
# File 'lib/sqreen/events/attack.rb', line 26

def rulespack_id
  return nil unless payload['rule']
  payload['rule']['rulespack_id']
end

#test?Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/sqreen/events/attack.rb', line 36

def test?
  return nil unless payload['rule']
  payload['rule']['test'] ? true : false
end

#timeObject



56
57
58
59
# File 'lib/sqreen/events/attack.rb', line 56

def time
  return nil unless payload['local']
  payload['local']['time']
end