Browse Source

Disable failure on hash mismatch until it can be proven to work reliably

Jordi Boggiano 12 years ago
parent
commit
338127ff9c
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/Composer/Repository/ComposerRepository.php

+ 8 - 1
src/Composer/Repository/ComposerRepository.php

@@ -414,7 +414,14 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
                 $data = $json->read();
                 $encoded = json_encode($data);
                 if ($sha256 && $sha256 !== hash('sha256', $encoded)) {
-                    throw new \UnexpectedValueException('The contents of '.$filename.' do not match its signature, this may be due to a temporary glitch or a man-in-the-middle attack, aborting for safety. Please try running Composer again.');
+                    if ($retries) {
+                        usleep(100);
+
+                        continue;
+                    }
+
+                    // TODO throw SecurityException and abort once we are sure this can not happen accidentally
+                    $this->io->write('<warning>The contents of '.$filename.' do not match its signature, this may be due to a temporary glitch or a man-in-the-middle attack. Please report this.</warning>');
                 }
                 $this->cache->write($cacheKey, $encoded);