Skip to content

Commit

Permalink
Validate version/repo/arch in auth.php
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidePrincipi committed Jun 27, 2019
1 parent 5fd6204 commit bd952d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions porthos/root/srv/porthos/script/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
// Disable the Content-Type header in PHP, so that nginx x-accel can add its own
ini_set('default_mimetype', FALSE);

// Mask any repo that does not belong to the site:
if(! in_array($uri['repo'], $config['repositories'])) {
// Mask any repo/version/arch that does not belong to the site:
if(! in_array($uri['repo'], $config['repositories'])
|| ! in_array($uri['version'], $config['versions'])
|| ! in_array($uri['arch'], $config['arches'])) {
exit_http(404);
}

Expand Down Expand Up @@ -86,6 +88,8 @@
'msg_severity' => 'notice',
'server_id' => $_SERVER['PHP_AUTH_USER'],
'repo' => $uri['repo'],
'version' => $uri['version'],
'arch' => $uri['arch'],
'tier_id' => $uri['prefix'] == 'autoupdate' ? NULL : $tier_id,
'tier_auto' => isset($hash),
'tls' => isset($_SERVER['HTTPS']),
Expand Down

0 comments on commit bd952d4

Please sign in to comment.