class_docstr: WSGI middleware validating security on response.
  
  It validates:
  - responses have Content-Type
  - responses have X-Content-Type-Options: nosniff
  - text/html responses have CSP header. It also validates whether the CSP
    headers pass basic requirement. e.g., default-src should be present, cannot
    use "*" directive, and others. For more complete list, please refer to
    _validate_csp_policies.
  
  Instances of this class are WSGI applications (see PEP 3333).
code: def _parse_serialized_csp(self, csp_text):
      # See https://www.w3.org/TR/CSP/#parse-serialized-policy.
      # Below Steps are based on the algorithm stated in above spec.
      # Deviations:
      # - it does not warn and ignore duplicative directive (Step 2.5)
  
      # Step 2
      csp_srcs = csp_text.split(";")
  
      policy = []
      for token in csp_srcs:
          # Step 2.1
          token = token.strip()
  
          if not token:
              # Step 2.2
              continue
  
          # Step 2.3
          token_frag = token.split(None, 1)
          name = token_frag[0]
  
          values = token_frag[1] if len(token_frag) == 2 else ""
  
          # Step 2.4
          name = name.lower()
  
          # Step 2.6
          value = values.split()
          # Step 2.7
          directive = Directive(name=name, value=value)
          # Step 2.8
          policy.append(directive)
  
      return policy
  
file_path: tensorboard/tensorboard/backend/security_validator.py
imports: import dataclasses
  from typing import Collection
  from werkzeug.datastructures import Headers
  from werkzeug import http
  from tensorboard.util import tb_logging
label_desc: Use image node_id 8 for calling the SecurityValidatorMiddleware obj's underlying member method code with example usage: obj._parse_serialized_csp(csp_text) and returns: policy