Class: SiteInspector::Endpoint::Headers
- Inherits:
-
Check
- Object
- Check
- SiteInspector::Endpoint::Headers
show all
- Defined in:
- lib/site-inspector/checks/headers.rb
Instance Attribute Summary
Attributes inherited from Check
#endpoint
Instance Method Summary
collapse
Methods inherited from Check
enabled=, enabled?, #host, #initialize, #inspect, #name, name, #request, #response
Instance Method Details
#[](header) ⇒ Object
53
54
55
|
# File 'lib/site-inspector/checks/headers.rb', line 53
def []()
[]
end
|
#all ⇒ Object
Also known as:
Returns an array of hashes of downcased key/value header pairs (or an empty hash)
48
49
50
|
# File 'lib/site-inspector/checks/headers.rb', line 48
def all
@all ||= response&. ? response..transform_keys(&:downcase) : {}
end
|
#click_jacking_protection ⇒ Object
30
31
32
|
# File 'lib/site-inspector/checks/headers.rb', line 30
def click_jacking_protection
['x-frame-options']
end
|
#click_jacking_protection? ⇒ Boolean
15
16
17
|
# File 'lib/site-inspector/checks/headers.rb', line 15
def click_jacking_protection?
!!click_jacking_protection
end
|
#content_security_policy ⇒ Object
26
27
28
|
# File 'lib/site-inspector/checks/headers.rb', line 26
def content_security_policy
['content-security-policy']
end
|
#content_security_policy? ⇒ Boolean
11
12
13
|
# File 'lib/site-inspector/checks/headers.rb', line 11
def content_security_policy?
!!content_security_policy
end
|
#server ⇒ Object
34
35
36
|
# File 'lib/site-inspector/checks/headers.rb', line 34
def server
['server']
end
|
#strict_transport_security ⇒ Object
22
23
24
|
# File 'lib/site-inspector/checks/headers.rb', line 22
def strict_transport_security
['strict-transport-security']
end
|
#strict_transport_security? ⇒ Boolean
7
8
9
|
# File 'lib/site-inspector/checks/headers.rb', line 7
def strict_transport_security?
!!strict_transport_security
end
|
#to_h ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/site-inspector/checks/headers.rb', line 57
def to_h
{
strict_transport_security: strict_transport_security || false,
content_security_policy: content_security_policy || false,
click_jacking_protection: click_jacking_protection || false,
server: server,
xss_protection: xss_protection || false
}
end
|
#xss_protection ⇒ Object
38
39
40
|
# File 'lib/site-inspector/checks/headers.rb', line 38
def xss_protection
['x-xss-protection']
end
|
#xss_protection? ⇒ Boolean
more specific checks than presence of headers
43
44
45
|
# File 'lib/site-inspector/checks/headers.rb', line 43
def xss_protection?
xss_protection == '1; mode=block'
end
|