def __init__(self): self.name = 'strict-transport-security' self.options = { 'includeSubDomains': COUNT_HEADER_OPTION.format(self.name, 'includeSubDomains'), 'max-age': COUNT_HEADER_OPTION.format(self.name, 'max-age'), 'total': COUNT_HEADER_BY_NAME % self.name }
def __init__(self): self.name = 'public-key-pins' self.options = { 'pin-sha256': COUNT_HEADER_OPTION.format(self.name, 'pin-sha256'), 'max-age': COUNT_HEADER_OPTION.format(self.name, 'max-age'), 'includeSubDomains': COUNT_HEADER_OPTION.format(self.name, 'includeSubDomains'), 'report-uri': COUNT_HEADER_OPTION.format(self.name, 'report-uri'), 'total': COUNT_HEADER_BY_NAME % self.name }
def __init__(self): self.name = 'x-xss-protection' self.options = { '0': COUNT_HEADER_OPTION.format(self.name, '0'), '0-mode-block': COUNT_HEADER_OPTION.format(self.name, '%0%mode=block%'), '1': COUNT_HEADER_OPTION.format(self.name, '1'), '1-mode-block': COUNT_HEADER_OPTION.format(self.name, '%1%mode=block%'), 'report': COUNT_HEADER_OPTION.format(self.name, 'report'), 'other': QTD_XSS_OTHER, 'total': COUNT_HEADER_BY_NAME % self.name }
def __init__(self): self.name = 'x-content-type-options' self.options = { 'nosniff': COUNT_HEADER_OPTION.format(self.name, 'nosniff'), 'other': QTD_XCTO_OTHER, 'total': (COUNT_HEADER_BY_NAME % self.name) }
def __init__(self): self.name = 'x-frame-options' self.options = { 'deny': COUNT_HEADER_OPTION_SIMPLE.format(self.name, 'deny'), 'sameorigin': COUNT_HEADER_OPTION_SIMPLE.format(self.name, 'sameorigin'), 'allow-from': COUNT_HEADER_OPTION.format(self.name, '%allow-from%'), 'other': QTD_XFO_OTHER, 'total': COUNT_HEADER_BY_NAME % self.name }
def __configure_properties(self): [ self.options.update({ self.__format_option(header_option): COUNT_HEADER_OPTION.format(self.name, header_option) }) for header_option in self.header_options ] self.options.update( {'total': COUNT_HEADER_BY_NAME.format(header_name=self.name)}) self.__has_extra_options()
def __init__(self): self.name = 'content-security-policy' self.options = { 'report-uri': COUNT_HEADER_OPTION.format(self.name, 'report-uri'), 'default-src': COUNT_HEADER_OPTION.format(self.name, 'default-src'), 'script-nonce': COUNT_HEADER_OPTION.format(self.name, 'script-nonce'), 'upgrade-insecure-requests': COUNT_HEADER_OPTION.format(self.name, 'upgrade-insecure-requests'), 'media-src': COUNT_HEADER_OPTION.format(self.name, 'media-src'), 'report-to': COUNT_HEADER_OPTION.format(self.name, 'report-to'), 'reflected-xss': COUNT_HEADER_OPTION.format(self.name, 'reflected-xss'), 'style-src': COUNT_HEADER_OPTION.format(self.name, 'style-src'), 'frame-src': COUNT_HEADER_OPTION.format(self.name, 'frame-src'), 'block-all-mixed-content': COUNT_HEADER_OPTION.format(self.name, 'block-all-mixed-content'), 'child-src': COUNT_HEADER_OPTION.format(self.name, 'child-src'), 'form-action': COUNT_HEADER_OPTION.format(self.name, 'form-action'), 'base-uri': COUNT_HEADER_OPTION.format(self.name, 'base-uri'), 'img-src': COUNT_HEADER_OPTION.format(self.name, 'img-src'), 'frame-ancestors': COUNT_HEADER_OPTION.format(self.name, 'frame-ancestors'), 'manifest-src': COUNT_HEADER_OPTION.format(self.name, 'manifest-src'), 'referrer': COUNT_HEADER_OPTION.format(self.name, 'referrer'), 'sandbox': COUNT_HEADER_OPTION.format(self.name, 'sandbox'), 'plugin-types': COUNT_HEADER_OPTION.format(self.name, 'plugin-types'), 'object-src': COUNT_HEADER_OPTION.format(self.name, 'object-src'), 'connect-src': COUNT_HEADER_OPTION.format(self.name, 'connect-src'), 'font-src': COUNT_HEADER_OPTION.format(self.name, 'font-src'), 'script-src': COUNT_HEADER_OPTION.format(self.name, 'script-src'), 'total': COUNT_HEADER_BY_NAME % self.name }
def total_by_options(self): csp_options_total = {} for option in self.options(): csp_options_total[option] = COUNT_HEADER_OPTION.format( self.name, option) return csp_options_total