Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Plat: enforce strict validation on input fields #6003

Merged
merged 2 commits into from Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Next
No Plat: enforce strict validation on input fields
  • Loading branch information
yossipapi committed Sep 4, 2017
commit 7e00a578d6ba748f6d3bdc255a40a4a0a594e6f9
50 changes: 0 additions & 50 deletions admin_console/web/tools/AkamaiBroadcaster.php

This file was deleted.

23 changes: 0 additions & 23 deletions admin_console/web/tools/SimpleJWPlayer.php

This file was deleted.

23 changes: 0 additions & 23 deletions admin_console/web/tools/XmlJWPlayer.php

This file was deleted.

14 changes: 8 additions & 6 deletions admin_console/web/tools/bigRedButton.php
@@ -1,13 +1,15 @@
<?php

require_once (dirname(__FILE__) . '/safeGetInput.php');

if(!isset($_GET['partnerId']))
die('partnerId must be supplied in query string');

if(!isset($_GET['playerVersion']))
die('html5 lib version must be supplied in query string');

$partnerId = strip_tags($_GET['partnerId']);

$html5Version = strip_tags($_GET['playerVersion']);
$partnerId = safeGetInput('partnerId', '/[^0-9]/');
$html5Version = safeGetInput('playerVersion', '/[^v0-9.]/');
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie10 lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
Expand Down Expand Up @@ -305,15 +307,15 @@ function updateSystemTime()
</tr>
<tr>
<td>Admin Secret:</td>
<td><input type="text" id="txtSecret" value="<?php echo isset($_GET['secret']) ? strip_tags($_GET['secret']) : ''; ?>" />
<td><input type="text" id="txtSecret" value="<?php echo isset($_GET['secret']) ? safeGetInput('secret', '/[^A-Za-z0-9]/') : ''; ?>" />
</td>
<tr>
<td>Entry Id:</td>
<td><input type="text" id="txtEntryId" value="<?php echo isset($_GET['entryId']) ? strip_tags($_GET['entryId']) : ''; ?>" />
<td><input type="text" id="txtEntryId" value="<?php echo isset($_GET['entryId']) ? safeGetInput('entryId', '/[^a-z0-9_]/') : ''; ?>" />
</td>
<tr>
<td>uiConf Id:</td>
<td><input type="text" id="txtUiConfId" value="<?php echo isset($_GET['uiConfId']) ? strip_tags($_GET['uiConfId']) : ''; ?>" />
<td><input type="text" id="txtUiConfId" value="<?php echo isset($_GET['uiConfId']) ? safeGetInput('uiConfId', '/[^0-9]/') : ''; ?>" />
</td>
<tr>
<td colspan="2">
Expand Down
16 changes: 9 additions & 7 deletions admin_console/web/tools/bigRedButtonPtsPoc.php
@@ -1,13 +1,15 @@
<?php
<?php
require_once (dirname(__FILE__) . '/safeGetInput.php');

if(!isset($_GET['partnerId']))
die('partnerId must be supplied in query string');

if(!isset($_GET['playerVersion']))
die('html5 lib version must be supplied in query string');

$partnerId = strip_tags($_GET['partnerId']);
$partnerId = safeGetInput('partnerId', '/[^0-9]/');
$html5Version = safeGetInput('playerVersion', '/[^v0-9.]/');

$html5Version = strip_tags($_GET['playerVersion']);
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie10 lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
Expand Down Expand Up @@ -210,19 +212,19 @@ function sendAd(){
<table>
<tr style="display: none; ">
<td>Admin Secret:</td>
<td><input type="text" id="txtSecret" value="<?php echo isset($_GET['secret']) ? strip_tags($_GET['secret']) : ''; ?>" />
<td><input type="text" id="txtSecret" value="<?php echo isset($_GET['secret']) ? safeGetInput('secret', '/[^A-Za-z0-9]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td>Entry Id:</td>
<td><input type="text" id="txtEntryId" value="<?php echo isset($_GET['entryId']) ? strip_tags($_GET['entryId']) : ''; ?>" />
<td><input type="text" id="txtEntryId" value="<?php echo isset($_GET['entryId']) ? safeGetInput('entryId', '/[^a-z0-9_]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td>Admin uiConf Id:</td>
<td><input type="text" id="txtAdminUiConfId" value="<?php echo isset($_GET['adminUiConfId']) ? strip_tags($_GET['adminUiConfId']) : ''; ?>" />
<td><input type="text" id="txtAdminUiConfId" value="<?php echo isset($_GET['adminUiConfId']) ? safeGetInput('adminUiConfId', '/[^0-9]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td>User uiConf Id:</td>
<td><input type="text" id="txtUiConfId" value="<?php echo isset($_GET['uiConfId']) ? strip_tags($_GET['uiConfId']) : ''; ?>" />
<td><input type="text" id="txtUiConfId" value="<?php echo isset($_GET['uiConfId']) ? safeGetInput('uiConfId', '/[^0-9]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td colspan="2">
Expand Down
14 changes: 14 additions & 0 deletions admin_console/web/tools/safeGetInput.php
@@ -0,0 +1,14 @@
<?php

function safeGetInput($filedName, $pattern)
{
$fieldValue = $_GET[$filedName];
if (preg_match($pattern, $fieldValue))
{
return '';
}

return $fieldValue;
}

?>
16 changes: 9 additions & 7 deletions alpha/web/lib/bigRedButtonPtsPocHlsjs.php
@@ -1,13 +1,15 @@
<?php
<?php
require_once (dirname(__FILE__) . '/../../../admin_console/web/tools/safeGetInput.php');

if(!isset($_GET['partnerId']))
die('partnerId must be supplied in query string');

if(!isset($_GET['playerVersion']))
die('html5 lib version must be supplied in query string');

$partnerId = $_GET['partnerId'];
$partnerId = safeGetInput('partnerId', '/[^0-9]/');
$html5Version = safeGetInput('playerVersion', '/[^v0-9.]/');

$html5Version = $_GET['playerVersion'];
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie10 lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
Expand Down Expand Up @@ -212,19 +214,19 @@ function sendAd(){
<table>
<tr style="display: none; ">
<td>Admin Secret:</td>
<td><input type="text" id="txtSecret" value="<?php echo isset($_GET['secret']) ? $_GET['secret'] : ''; ?>" />
<td><input type="text" id="txtSecret" value="<?php echo isset($_GET['secret']) ? safeGetInput('secret', '/[^A-Za-z0-9]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td>Entry Id:</td>
<td><input type="text" id="txtEntryId" value="<?php echo isset($_GET['entryId']) ? $_GET['entryId'] : ''; ?>" />
<td><input type="text" id="txtEntryId" value="<?php echo isset($_GET['entryId']) ? safeGetInput('entryId', '/[^a-z0-9_]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td>Admin uiConf Id:</td>
<td><input type="text" id="txtAdminUiConfId" value="<?php echo isset($_GET['adminUiConfId']) ? $_GET['adminUiConfId'] : ''; ?>" />
<td><input type="text" id="txtAdminUiConfId" value="<?php echo isset($_GET['adminUiConfId']) ? safeGetInput('adminUiConfId', '/[^0-9]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td>User uiConf Id:</td>
<td><input type="text" id="txtUiConfId" value="<?php echo isset($_GET['uiConfId']) ? $_GET['uiConfId'] : ''; ?>" />
<td><input type="text" id="txtUiConfId" value="<?php echo isset($_GET['uiConfId']) ? safeGetInput('uiConfId', '/[^0-9]/') : ''; ?>" />
</td>
<tr style="display: none; ">
<td colspan="2">
Expand Down