Conditions | 6 |
Paths | 8 |
Total Lines | 34 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | protected function doValidation(Response $response) |
||
20 | { |
||
21 | $crawler = new Crawler($response->getBody()); |
||
22 | $actionNodes = $crawler->filterXPath('//form[//input[@type="password"]]'); |
||
23 | |||
24 | $url = (string)$response->getUri(); |
||
25 | |||
26 | foreach ($actionNodes as $node) { |
||
27 | $action = $node->getAttribute('action'); |
||
28 | |||
29 | if (strpos($action, 'https://') === 0) { |
||
30 | continue; |
||
31 | } |
||
32 | |||
33 | $fullPath = $node->tagName; |
||
34 | $parent = $node->parentNode; |
||
35 | |||
36 | while ($parent = $parent->parentNode) { |
||
37 | if (property_exists($parent, 'tagName')) { |
||
38 | $fullPath = $parent->tagName . '/' . $fullPath; |
||
39 | } else { |
||
40 | break; |
||
41 | } |
||
42 | } |
||
43 | |||
44 | if (in_array($fullPath, $this->knownIdentifier)) { |
||
45 | continue; |
||
46 | } |
||
47 | |||
48 | $this->knownIdentifier[] = $fullPath; |
||
49 | |||
50 | $this->assert(strpos($url, 'https://') !== false, 'Password is transferred insecure using HTTP.'); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |