You are here

function seckit_update_7106 in Security Kit 7

If no CSP has been configured, enable unlimited_csp_reports by default.

File

./seckit.install, line 149
Install/update/uninstall actions for SecKit.

Code

function seckit_update_7106() {

  // Unlimited CSP reports are likely to be necessary during the initial
  // development of a content security policy, but this should be treated as
  // an override of the default value of zero.
  // As per seckit_install(), but catching the case when SecKit is already
  // enabled but no CSP policy has yet been configured.
  $options = _seckit_get_options();
  $defaults = _seckit_get_options_defaults();
  if ($options['seckit_xss']['csp'] == $defaults['seckit_xss']['csp']) {
    $seckit_advanced = variable_get('seckit_advanced', array());
    $seckit_advanced['unlimited_csp_reports'] = 1;
    variable_set('seckit_advanced', $seckit_advanced);
  }
}