Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/zf-fr/zfr-eb-worker
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed Aug 30, 2017
2 parents 4b3efd1 + 353cad4 commit cf0dfb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Middleware/WorkerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private function assertLocalhost(ServerRequestInterface $request)
$remoteAddr = $serverParams['REMOTE_ADDR'] ?? 'unknown IP address';

// If request is not originating from localhost or from Docker local IP, we throw an RuntimeException
if (!in_array($remoteAddr, self::LOCALHOST_ADDRESSES) && !fnmatch('172.1*.*', $remoteAddr)) {
if (!in_array($remoteAddr, self::LOCALHOST_ADDRESSES) && !fnmatch('172.*', $remoteAddr)) {
throw new RuntimeException(sprintf(
'Worker requests must come from localhost, request originated from %s given',
$remoteAddr
Expand Down
2 changes: 2 additions & 0 deletions test/Middleware/WorkerMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public function provideIpAddresses(): array
['127.0.0.1', true],
['::1', true],
['172.17.42.1', true],
['172.20.42.1', true],
['172.18.42.1', true],
['172.17.0.1', true],
['189.55.56.131', false]
];
Expand Down

0 comments on commit cf0dfb2

Please sign in to comment.