Class: AWSCDK::CloudFront::ResponseHeadersXSSProtection

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/response_headers_xss_protection.rb

Overview

Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header’s value.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(override:, protection:, mode_block: nil, report_uri: nil) ⇒ ResponseHeadersXSSProtection

Returns a new instance of ResponseHeadersXSSProtection.

Parameters:

  • override (Boolean)

    A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

  • protection (Boolean)

    A Boolean that determines the value of the X-XSS-Protection HTTP response header.

  • mode_block (Boolean, nil) (defaults to: nil)

    A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

  • report_uri (String, nil) (defaults to: nil)

    A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.



11
12
13
14
15
16
17
18
19
20
# File 'cloud_front/response_headers_xss_protection.rb', line 11

def initialize(override:, protection:, mode_block: nil, report_uri: nil)
  @override = override
  Jsii::Type.check_type(@override, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "override")
  @protection = protection
  Jsii::Type.check_type(@protection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "protection")
  @mode_block = mode_block
  Jsii::Type.check_type(@mode_block, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "modeBlock") unless @mode_block.nil?
  @report_uri = report_uri
  Jsii::Type.check_type(@report_uri, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "reportUri") unless @report_uri.nil?
end

Instance Attribute Details

#mode_blockBoolean? (readonly)

Note:

Default: false

A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

Returns:

  • (Boolean, nil)


37
38
39
# File 'cloud_front/response_headers_xss_protection.rb', line 37

def mode_block
  @mode_block
end

#overrideBoolean (readonly)

A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

Returns:

  • (Boolean)


25
26
27
# File 'cloud_front/response_headers_xss_protection.rb', line 25

def override
  @override
end

#protectionBoolean (readonly)

A Boolean that determines the value of the X-XSS-Protection HTTP response header.

When this setting is true, the value of the X-XSS-Protection header is 1. When this setting is false, the value of the X-XSS-Protection header is 0.

Returns:

  • (Boolean)


32
33
34
# File 'cloud_front/response_headers_xss_protection.rb', line 32

def protection
  @protection
end

#report_uriString? (readonly)

Note:

Default: - no report uri

A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

You cannot specify a ReportUri when ModeBlock is true.

Returns:

  • (String, nil)


44
45
46
# File 'cloud_front/response_headers_xss_protection.rb', line 44

def report_uri
  @report_uri
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
53
# File 'cloud_front/response_headers_xss_protection.rb', line 46

def self.jsii_properties
  {
    :override => "override",
    :protection => "protection",
    :mode_block => "modeBlock",
    :report_uri => "reportUri",
  }
end

Instance Method Details

#to_jsiiObject



55
56
57
58
59
60
61
62
63
64
# File 'cloud_front/response_headers_xss_protection.rb', line 55

def to_jsii
  result = {}
  result.merge!({
    "override" => @override,
    "protection" => @protection,
    "modeBlock" => @mode_block,
    "reportUri" => @report_uri,
  })
  result.compact
end