Class: FiberAudit::Static::Rules::DirectSocket

Inherits:
Base
  • Object
show all
Defined in:
lib/fiber_audit/static/rules/direct_socket.rb

Overview

FA1006 – Detects direct socket creation that may bypass scheduler-aware networking and block the scheduler thread.

Constant Summary collapse

TITLE =
'Direct socket creation'
CATEGORY =
:network
EXACT =
%w[
  TCPSocket TCPServer UDPSocket UNIXSocket UNIXServer Socket IPSocket
].freeze
MESSAGE =
'Direct socket use may bypass scheduler-aware networking ' \
'and block the scheduler thread.'
REMEDIATION =
'Use scheduler-aware networking APIs or verify the ' \
'socket operations cooperate with the active Fiber scheduler.'

Constants inherited from Base

Base::CONTEXT_CEILING

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

confidence, default_confidence, default_severity, description, id, #initialize, severity

Constructor Details

This class inherits a constructor from FiberAudit::Static::Rules::Base

Class Method Details

.categoryObject



33
# File 'lib/fiber_audit/static/rules/direct_socket.rb', line 33

def category = CATEGORY

.titleObject



32
# File 'lib/fiber_audit/static/rules/direct_socket.rb', line 32

def title = TITLE

Instance Method Details

#analyze(call_sites:) ⇒ Object



36
37
38
# File 'lib/fiber_audit/static/rules/direct_socket.rb', line 36

def analyze(call_sites:)
  call_sites.filter_map { |site| match(site) }
end