Class: Hibp::Models::Breach

Inherits:
Object
  • Object
show all
Includes:
Helpers::AttributeAssignment
Defined in:
lib/hibp/models/breach.rb

Overview

Hibp::Models::Breach

Used to construct a "breach" model

A "breach" is an instance of a system having been compromised by an
attacker and the data disclosed.

For example, Adobe was a breach, Gawker was a breach etc.

A "breach" is an incident where data is inadvertently exposed in a vulnerable system,
usually due to insufficient access controls or security weaknesses in the software.

@see https://haveibeenpwned.com/FAQs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Breach

Returns a new instance of Breach.

Parameters:

  • attributes (Hash)
    • Attributes in a hash

Options Hash (attributes):

  • :name (String)

    - A name representing the breach which is unique across all other breaches. This value never changes and may be used to name dependent assets (such as images) but should not be shown directly to end users (see the “title” attribute instead).

  • :title (String)

    - A descriptive title for the breach suitable for displaying to end users. It’s unique across all breaches but individual values may change in the future (i.e. if another breach occurs against an organisation already in the system). If a stable value is required to reference the breach, refer to the “Name” attribute instead.

  • :domain (String)

    - The domain of the primary website the breach occurred on. This may be used for identifying other assets external systems may have for the site.

  • :breach_date (Date)

    - The date (with no time) the breach originally occurred on in ISO 8601 format. This is not always accurate — frequently breaches are discovered and reported long after the original incident. Use this attribute as a guide only.

  • :added_date (DateTime)

    - The date and time (precision to the minute) the breach was added to the system in ISO 8601 format.

  • :modified_date (DateTime)

    - The date and time (precision to the minute) the breach was modified in ISO 8601 format. This will only differ from the AddedDate attribute if other attributes represented here are changed or data in the breach itself is changed (i.e. additional data is identified and loaded). It is always either equal to or greater then the AddedDate attribute, never less than.

  • :pwn_count (Integer)

    - The total number of accounts loaded into the system. This is usually less than the total number reported by the media due to duplication or other data integrity issues in the source data.

  • :description (String)

    - Contains an overview of the breach represented in HTML markup. The description may include markup such as emphasis and strong tags as well as hyperlinks.

  • :data_classes (Array<String>)

    - This attribute describes the nature of the data compromised in the breach and contains an alphabetically ordered string array of impacted data classes.

  • :is_verified (Boolean)

    - Indicates that the breach is considered unverified. An unverified breach may not have been hacked from the indicated website. An unverified breach is still loaded into HIBP when there’s sufficient confidence that a significant portion of the data is legitimate.

  • :is_fabricated (Boolean)

    - Indicates that the breach is considered fabricated. A fabricated breach is unlikely to have been hacked from the indicated website and usually contains a large amount of manufactured data. However, it still contains legitimate email addresses and asserts that the account owners were compromised in the alleged breach.

  • :is_sensitive (Boolean)

    - Indicates if the breach is considered sensitive. The public API will not return any accounts for a breach flagged as sensitive.

  • :is_retired (Boolean)

    - Indicates if the breach has been retired. This data has been permanently removed and will not be returned by the API.

  • :is_spam_list (Boolean)

    - Indicates if the breach is considered a spam list. This flag has no impact on any other attributes but it means that the data has not come as a result of a security compromise.

  • :logo_path (String)

    - A URI that specifies where a logo for the breached service can be found. Logos are always in PNG format.

Raises:

  • (ArgumentError)
  • (UnknownAttributeError)


106
107
108
# File 'lib/hibp/models/breach.rb', line 106

def initialize(attributes)
  assign_attributes(attributes)
end

Instance Attribute Details

#added_dateObject

Returns the value of attribute added_date.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def added_date
  @added_date
end

#breach_dateObject

Returns the value of attribute breach_date.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def breach_date
  @breach_date
end

#data_classesObject

Returns the value of attribute data_classes.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def data_classes
  @data_classes
end

#descriptionObject

Returns the value of attribute description.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def description
  @description
end

#domainObject

Returns the value of attribute domain.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def domain
  @domain
end

#is_fabricatedObject

Returns the value of attribute is_fabricated.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def is_fabricated
  @is_fabricated
end

#is_retiredObject

Returns the value of attribute is_retired.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def is_retired
  @is_retired
end

#is_sensitiveObject

Returns the value of attribute is_sensitive.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def is_sensitive
  @is_sensitive
end

#is_spam_listObject

Returns the value of attribute is_spam_list.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def is_spam_list
  @is_spam_list
end

#is_verifiedObject

Returns the value of attribute is_verified.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def is_verified
  @is_verified
end

#logo_pathObject

Returns the value of attribute logo_path.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def logo_path
  @logo_path
end

#modified_dateObject

Returns the value of attribute modified_date.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def modified_date
  @modified_date
end

#nameObject

Returns the value of attribute name.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def name
  @name
end

#pwn_countObject

Returns the value of attribute pwn_count.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def pwn_count
  @pwn_count
end

#titleObject

Returns the value of attribute title.



22
23
24
# File 'lib/hibp/models/breach.rb', line 22

def title
  @title
end