private function handleDirectiveViolationReport()
 {
     $allowing = Arrays::getRecursive($this->config, 'violation-reports.csp.uri');
     if (!is_null($allowing)) {
         $this->addValue('report', array($allowing));
     }
 }
Exemple #2
0
 /**
  * @param $component
  * @return bool
  */
 public function canApply($component, $config = null)
 {
     $config = is_null($config) ? $this->config : $config;
     $include = (array) Arrays::getRecursive($config, (string) $component . ".include");
     $exclude = (array) Arrays::getRecursive($config, (string) $component . ".exclude");
     $controller = $this->routeMatch->getParam('controller');
     $action = $this->routeMatch->getParam('action');
     if (in_array($controller, $include)) {
         return true;
     }
     if (in_array($controller, $exclude)) {
         return false;
     }
     return true;
 }
Exemple #3
0
 /**
  *
  */
 public function getRequestDirectives()
 {
     if ($this->verifier->canApply('xss')) {
         $xss = (array) Arrays::getRecursive($this->config, 'xss');
         if (!empty($xss)) {
             $con = new ContentSecurityPolicy($xss);
             $con->setVerifier($this->verifier);
             $con->setComponent('xss');
             $con->execute();
             $response = $this->serviceLocator->get('Response');
             $response->getHeaders()->addHeader($con);
         }
     }
     if (array_key_exists('cross-origin', $this->config)) {
         $cors = new Cors($this->serviceLocator);
     }
 }
 public function testGetRecursiveKeyNotExists()
 {
     $res = Arrays::getRecursive($this->arr, 'violation-reports.csp.uri');
     $this->assertNull($res);
 }