Skip to content

Commit

Permalink
add strict referer security level
Browse files Browse the repository at this point in the history
  • Loading branch information
jererc committed Feb 12, 2013
1 parent 0d1164b commit 802dcc6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions CloudKey.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

define('CLOUDKEY_SECLEVEL_NONE', 0);
define('CLOUDKEY_SECLEVEL_DELEGATE', 1 << 0);
define('CLOUDKEY_SECLEVEL_ASNUM', 1 << 1);
define('CLOUDKEY_SECLEVEL_IP', 1 << 2);
define('CLOUDKEY_SECLEVEL_NONE', 0);
define('CLOUDKEY_SECLEVEL_DELEGATE', 1 << 0);
define('CLOUDKEY_SECLEVEL_ASNUM', 1 << 1);
define('CLOUDKEY_SECLEVEL_IP', 1 << 2);
define('CLOUDKEY_SECLEVEL_USERAGENT', 1 << 3);
define('CLOUDKEY_SECLEVEL_USEONCE', 1 << 4);
define('CLOUDKEY_SECLEVEL_COUNTRY', 1 << 5);
define('CLOUDKEY_SECLEVEL_REFERER', 1 << 6);
define('CLOUDKEY_SECLEVEL_USEONCE', 1 << 4);
define('CLOUDKEY_SECLEVEL_COUNTRY', 1 << 5);
define('CLOUDKEY_SECLEVEL_REFERER', 1 << 6);
define('CLOUDKEY_SECLEVEL_REFERER_STRICT', 1 << 15);

class CloudKey
{
Expand Down Expand Up @@ -477,7 +478,7 @@ static public function sign_url($url, $secret, $seclevel=CLOUDKEY_SECLEVEL_NONE,
}
$public_secparams[] = 'cc=' . strtolower($countries);
}
if ($seclevel & CLOUDKEY_SECLEVEL_REFERER)
if ($seclevel & CLOUDKEY_SECLEVEL_REFERER || $seclevel & CLOUDKEY_SECLEVEL_REFERER_STRICT)
{
if (!isset($referers) || count($referers) === 0)
{
Expand Down

0 comments on commit 802dcc6

Please sign in to comment.