def unsafe_eval_enabled(response):
 non_report_only_policies = retrieve_csp_policies(response)
 report_only_policies = retrieve_csp_policies(response, True)
 policies_all = merge_policies_dict(non_report_only_policies, report_only_policies)
 if (len(policies_all) > 0):
  for directive_name in policies_all:
   if (directive_name.lower() != CSP_DIRECTIVE_SCRIPT):
    continue
   for directive_value in policies_all[directive_name]:
    if (directive_value.strip().lower() == CSP_DIRECTIVE_VALUE_UNSAFE_EVAL):
     return True
 return False

def unsafe_eval_enabled ( response ) : non_report_only_policies = retrieve_csp_policies ( response ) report_only_policies = retrieve_csp_policies ( response , True ) policies_all = merge_policies_dict ( non_report_only_policies , report_only_policies ) if ( len ( policies_all ) > 0 ) : for directive_name in policies_all : if ( directive_name . lower ( ) != CSP_DIRECTIVE_SCRIPT ) : continue for directive_value in policies_all [ directive_name ] : if ( directive_value . strip ( ) . lower ( ) == CSP_DIRECTIVE_VALUE_UNSAFE_EVAL ) : return True return False
method to detect if csp policies are specified for script .