Class: Idxfence::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/idxfence/finding.rb

Overview

A single ActiveRecord uniqueness: true validation (application-layer only) with no matching database-level unique index to back it up -- meaning two concurrent requests can both pass the validation's SELECT ... WHERE check before either one's INSERT commits, landing a genuine duplicate row despite the validation "working." See DETAILS.md for the exact race and why only a DB-level unique index closes it.

code: "IX001" every finding uses this single code (one rule: an AR uniqueness validation with no matching DB unique index) model: the model class name, e.g. "User" table: the resolved table name the validation's column(s) were checked against, e.g. "users" column: the column the validation checks, e.g. "email" scope: Array of scope column(s), e.g. ["account_id"]; empty array for an unscoped validation file: path to the model source file line: line number of the validates/validates_uniqueness_of call message: a human-readable description

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#code ⇒ Object

Returns the value of attribute code

Returns:

  • (Object) —

    the current value of code



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def code
  @code
end

#column ⇒ Object

Returns the value of attribute column

Returns:

  • (Object) —

    the current value of column



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def column
  @column
end

#file ⇒ Object

Returns the value of attribute file

Returns:

  • (Object) —

    the current value of file



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def file
  @file
end

#line ⇒ Object

Returns the value of attribute line

Returns:

  • (Object) —

    the current value of line



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def line
  @line
end

#message ⇒ Object

Returns the value of attribute message

Returns:

  • (Object) —

    the current value of message



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def message
  @message
end

#model ⇒ Object

Returns the value of attribute model

Returns:

  • (Object) —

    the current value of model



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def model
  @model
end

#scope ⇒ Object

Returns the value of attribute scope

Returns:

  • (Object) —

    the current value of scope



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def scope
  @scope
end

#table ⇒ Object

Returns the value of attribute table

Returns:

  • (Object) —

    the current value of table



21
22
23
# File 'lib/idxfence/finding.rb', line 21

def table
  @table
end

Instance Method Details

#to_h ⇒ Object



22
23
24
# File 'lib/idxfence/finding.rb', line 22

def to_h
  { code: code, model: model, table: table, column: column, scope: scope, file: file, line: line, message: message }
end