Skip to content

Commit

Permalink
Removing all instances of php_self to stop the spam
Browse files Browse the repository at this point in the history
I'm tired of getting the reports about supposedly xss vulnerabilities without any proofs of concept.  Since the bulk of our forms don't require an action to be specified I just removed them.  The remaining php_self instances were replaced with script_name.  Hopefully now the useless vulnerability scanners will stop
  • Loading branch information
wilpig committed Oct 2, 2016
1 parent d47816b commit f7658f8
Show file tree
Hide file tree
Showing 33 changed files with 52 additions and 52 deletions.
8 changes: 4 additions & 4 deletions bulk_importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$_SESSION['inputfile'] = $targetFile;

echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['PHP_SELF'] . "?stage=headers'>";
echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['SCRIPT_NAME'] . "?stage=headers'>";
exit;
} elseif ( isset( $_REQUEST['stage'] ) && $_REQUEST['stage'] == 'headers' ) {
//
Expand All @@ -61,7 +61,7 @@
$content = "<h3>" . __("Pick the appropriate column header (line 1) for each field name listed below." ) . "</h3>";
$content .= "<h3>" . __("Mouse over each field for help text.") . "</h3>";

$content .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">
$content .= '<form method="POST">
<input type="hidden" name="stage" value="validate">
<div class="table">';

Expand Down Expand Up @@ -305,7 +305,7 @@
if ( ! $valid ) {
$content .= $tmpCon . "</ul>";
} else {
$content = '<form action="' . $_SERVER['PHP_SELF']. '" method="POST">';
$content = '<form method="POST">';
$content .= "<h3>" . __( "The file has passed validation. Press the Process button to import." ) . "</h3>";
$content .= "<input type=\"hidden\" name=\"stage\" value=\"process\">\n";
foreach( array( "DataCenterID", "Cabinet", "Position", "Label", "Height", "Manufacturer", "Model", "Hostname", "SerialNo", "AssetTag", "ESX", "BackSide", "HalfDepth", "Reservation", "InstallDate", "Owner", "PrimaryContact", "CustomTags" ) as $mapVar ) {
Expand Down Expand Up @@ -467,7 +467,7 @@
// No parameters were passed with the URL, so this is the top level, where
// we need to ask for the user to specify a file to upload.
//
$content = '<form action="' . $_SERVER['PHP_SELF']. '" method="POST" ENCTYPE="multipart/form-data">';
$content = '<form method="POST" ENCTYPE="multipart/form-data">';
$content .= '<div class="table">
<div>
<div>' . __("Select file to upload:") . '
Expand Down
8 changes: 4 additions & 4 deletions bulk_moves.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$_SESSION['inputfile'] = $targetFile;

echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['PHP_SELF'] . "?stage=headers'>";
echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['SCRIPT_NAME'] . "?stage=headers'>";
exit;
} elseif ( isset( $_REQUEST['stage'] ) && $_REQUEST['stage'] == 'headers' ) {
//
Expand All @@ -61,7 +61,7 @@
$content = "<h3>" . __("Pick the appropriate column header (line 1) for each field name listed below." ) . "</h3>";
$content .= "<h3>" . __("Mouse over each field for help text.") . "</h3>";

$content .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">
$content .= '<form method="POST">
<input type="hidden" name="stage" value="validate">
<div class="table">';

Expand Down Expand Up @@ -248,7 +248,7 @@
if ( $rowError ) {
$content .= $tmpCon . "</ul>";
} else {
$content = '<form action="' . $_SERVER['PHP_SELF']. '" method="POST">';
$content = '<form method="POST">';
$content .= "<h3>" . __( "The file has passed validation. Press the Process button to import." ) . "</h3>";
$content .= "<input type=\"hidden\" name=\"stage\" value=\"process\">\n";
foreach( array( "DeviceID", "DataCenterID", "Cabinet", "Position", "ProcessDate", "KeyField" ) as $mapVar ) {
Expand Down Expand Up @@ -382,7 +382,7 @@
// No parameters were passed with the URL, so this is the top level, where
// we need to ask for the user to specify a file to upload.
//
$content = '<form action="' . $_SERVER['PHP_SELF']. '" method="POST" ENCTYPE="multipart/form-data">';
$content = '<form method="POST" ENCTYPE="multipart/form-data">';
$content .= '<div class="table">
<div>
<div>' . __("Select file to upload:") . '
Expand Down
6 changes: 3 additions & 3 deletions bulk_network.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$_SESSION['inputfile'] = $targetFile;

echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['PHP_SELF'] . "?stage=headers'>";
echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['SCRIPT_NAME'] . "?stage=headers'>";
exit;
} elseif ( isset( $_REQUEST['stage'] ) && $_REQUEST['stage'] == 'headers' ) {
//
Expand All @@ -61,7 +61,7 @@
$content = "<h3>" . __("Pick the appropriate column header (line 1) for each field name listed below." ) . "</h3>";
$content .= "<h3>" . __("Mouse over each field for help text.") . "</h3>";

$content .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">
$content .= '<form method="POST">
<input type="hidden" name="stage" value="process">
<div class="table">';

Expand Down Expand Up @@ -287,7 +287,7 @@
// No parameters were passed with the URL, so this is the top level, where
// we need to ask for the user to specify a file to upload.
//
$content = '<form action="' . $_SERVER['PHP_SELF']. '" method="POST" ENCTYPE="multipart/form-data">';
$content = '<form method="POST" ENCTYPE="multipart/form-data">';
$content .= '<div class="table">
<div>
<div>' . __("Select file to upload:") . '
Expand Down
6 changes: 3 additions & 3 deletions bulk_power.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$_SESSION['inputfile'] = $targetFile;

echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['PHP_SELF'] . "?stage=headers'>";
echo "<meta http-equiv='refresh' content='0; url=" . $_SERVER['SCRIPT_NAME'] . "?stage=headers'>";
exit;
} elseif ( isset( $_REQUEST['stage'] ) && $_REQUEST['stage'] == 'headers' ) {
//
Expand All @@ -61,7 +61,7 @@
$content = "<h3>" . __("Pick the appropriate column header (line 1) for each field name listed below." ) . "</h3>";
$content .= "<h3>" . __("Mouse over each field for help text.") . "</h3>";

$content .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">
$content .= '<form method="POST">
<input type="hidden" name="stage" value="process">
<div class="table">';

Expand Down Expand Up @@ -263,7 +263,7 @@
// No parameters were passed with the URL, so this is the top level, where
// we need to ask for the user to specify a file to upload.
//
$content = '<form action="' . $_SERVER['PHP_SELF']. '" method="POST" ENCTYPE="multipart/form-data">';
$content = '<form method="POST" ENCTYPE="multipart/form-data">';
$content .= '<div class="table">
<div>
<div>' . __("Select file to upload:") . '
Expand Down
2 changes: 1 addition & 1 deletion cabrow.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function opentree(){
echo '<div class="main">
<h3>',$status,'</h3>
<div class="center"><div>
<form action="',$_SERVER["PHP_SELF"].$formpatch,'" method="POST">
<form action="',$_SERVER["SCRIPT_NAME"].$formpatch,'" method="POST">
<div class="table">
<div>
<div><label for="cabrowid">',__("Row"),'</label></div>
Expand Down
2 changes: 1 addition & 1 deletion cdu_templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
echo '<div class="main">
<h3>',$status,'</h3>
<div class="center"><div>
<form action="',$_SERVER["PHP_SELF"],'" method="POST">
<form method="POST">
<div class="table">
<div>
<div><label for="templateid">',__("Template"),'</label></div>
Expand Down
2 changes: 1 addition & 1 deletion configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ function uploadifive() {
echo '<div class="main">
<div class="center"><div>
<h3></h3><h3 id="messages"></h3>
<form enctype="multipart/form-data" action="',$_SERVER["PHP_SELF"],'" method="POST">
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="Version" value="',$config->ParameterArray["Version"],'">
<div id="configtabs">
Expand Down
2 changes: 1 addition & 1 deletion datacenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function cambio_container(){
echo '<div class="main">
<h3>',$status,'</h3>
<div class="center"><div>
<form id="datacenterform" action="',$_SERVER["PHP_SELF"],'" method="POST">
<form id="datacenterform" method="POST">
<div class="table">
<div>
<div><label for="datacenterid">',__("Data Center ID"),'</label></div>
Expand Down
2 changes: 1 addition & 1 deletion dept_groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function array_obj_diff($array1,$array2){
<body id="deptgroup">
<div class="centermargin">
<?php
echo '<form action="',$_SERVER["PHP_SELF"],'" method="POST">
echo '<form method="POST">
<input type="hidden" name="deptid" value="',$dept->DeptID,'">
<h3>',__("Group to Administer"),': ',$dept->Name,'<button type="submit" value="Submit" name="action">',__("Submit"),'</button></h3>
<div>
Expand Down
2 changes: 1 addition & 1 deletion escalations.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
echo '<div class="main">
<h3>',$status,'</h3>
<div class="center"><div>
<form action="',$_SERVER["PHP_SELF"],'" method="POST">
<form method="POST">
<div class="table">
<div>
<div><label for="escalationid">',__("Escalation Rule"),'</label></div>
Expand Down
8 changes: 4 additions & 4 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ function BuildFileList(){
<h3>Data Center Department Detail</h3>
<?php echo $nodept; ?>
<div class="center"><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?dept&preflight-ok" method="POST">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>?dept&preflight-ok" method="POST">
<div class="table centermargin">
<div>
<div>Department</div>
Expand Down Expand Up @@ -1428,7 +1428,7 @@ function BuildFileList(){
<h3>Data Center Detail</h3>
<?php echo $nodc; ?>
<div class="center"><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?dc&preflight-ok" method="POST">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>?dc&preflight-ok" method="POST">
<div class="table">
<div>
<div><label for="datacenterid">Data Center ID</label></div>
Expand Down Expand Up @@ -1519,7 +1519,7 @@ function BuildFileList(){
<h3>Data Center Cabinet Inventory</h3>
<?php echo $nodccab; ?>
<div class='center'><div>
<form action='<?php echo $_SERVER['PHP_SELF']; ?>?cab&preflight-ok' method='POST'>
<form action='<?php echo $_SERVER['SCRIPT_NAME']; ?>?cab&preflight-ok' method='POST'>
<?php echo '
<div class="table">
<div>
Expand Down Expand Up @@ -1619,7 +1619,7 @@ function BuildFileList(){
<h3>Installation Complete</h3>
<?php echo $nodccab; ?>
<div class='center'><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?ldap&preflight-ok" method="POST">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>?ldap&preflight-ok" method="POST">
<?php
echo '<div id="ldap">
<h3>',__("LDAP Authentication and Authorization Configuration"),'</h3>
Expand Down
2 changes: 1 addition & 1 deletion mapmaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function uselessie(){

<div class="table">
<div class="title"><?php echo __("Coordinates"); ?></div>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST">
<form method="POST">
<div class="table">
<input type="hidden" name="cabinetid" value="<?php printf( "%d", $cab->CabinetID ); ?>">
<div>
Expand Down
4 changes: 2 additions & 2 deletions misc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ function buildnavmenu($ma,&$tl){
if(isset($devMode)&&$devMode){
// Development mode, so don't apply the upgrades
}else{
if(file_exists("install.php") && basename($_SERVER['PHP_SELF'])!="install.php" ){
if(file_exists("install.php") && basename($_SERVER['SCRIPT_NAME'])!="install.php" ){
// new installs need to run the install first.
header("Location: ".redirect('install.php'));
exit;
Expand All @@ -813,7 +813,7 @@ function buildnavmenu($ma,&$tl){
}

if( AUTHENTICATION=="LDAP" && !isset($_SESSION['userid']) && php_sapi_name()!="cli" && !isset($loginPage)) {
$savedurl = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
$savedurl = $_SERVER['SCRIPT_NAME'] . "?" . $_SERVER['QUERY_STRING'];
setcookie( 'targeturl', $savedurl, time()+60 );
header("Location: ".redirect('login_ldap.php'));
exit;
Expand Down
4 changes: 2 additions & 2 deletions pathmaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function displayjson($array){
$path.="\t<tr>\n\t\t<td colspan=6>&nbsp;</td>\n\t</tr></table>";

//Implement Form
$path.= "<form action=\"{$_SERVER["PHP_SELF"]}\" method=\"POST\">\n";
$path.= "<form method=\"POST\">\n";
$path.= "<br>\n";
$path.= "<div>\n";
//PATH INFO
Expand Down Expand Up @@ -485,7 +485,7 @@ function displayjson($array){
echo '<div class="main">
<h3>',$status,'</h3>
<div class="center"><div><div>
<form action="',$_SERVER["PHP_SELF"],'" method="POST">
<form method="POST">
<table id=crit_busc>
<tr><td>
<fieldset class=crit_busc>
Expand Down
2 changes: 1 addition & 1 deletion paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ function builddclist($id=null){
<tr><td>
<fieldset class="crit_busc">
<legend>'.__("Search by path identifier").'</legend>
<form action="',$_SERVER["PHP_SELF"],'" method="POST">
<form method="POST">
<div class="table">
<br>
<div>
Expand Down
2 changes: 1 addition & 1 deletion people_depts.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function array_obj_diff($array1,$array2){
<body id="deptgroup">
<div class="centermargin">
<?php
echo '<form action="',$_SERVER["PHP_SELF"],'" method="POST">
echo '<form method="POST">
<input type="hidden" name="personid" value="',$person->PersonID,'">
<h3>',__("Department Membership"),': ',$dept->Name,'<button type="submit" value="Submit" name="action">',__("Submit"),'</button></h3>
<div>
Expand Down
2 changes: 1 addition & 1 deletion project_members.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<body id="projectgroup">
<div class="centermargin">
<?php
echo '<form id="projectform" action="',$_SERVER["PHP_SELF"],'" method="POST">
echo '<form id="projectform" method="POST">
<input type="hidden" name="projectid" id="projectid" value="',$proj->ProjectID,'">
<h3>',__("Project to Administer"),': ',$proj->ProjectName,'</h3>
<select name="datacenterid" id="datacenterid" width="200px"><option value="0">Choose a Data Center</option>';
Expand Down
4 changes: 2 additions & 2 deletions rackrequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
Please allow up to 2 business days for requests to be completed.'),$req->Label)."</p>
<p>".sprintf(__('Your Request ID is %1$d and you may view the request online at'),$req->RequestID)."
<a href=\"https://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?requestid=$req->RequestID\">
<a href=\"https://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}?requestid=$req->RequestID\">
".__("this link")."</a>.</p>
</body></html>";
Expand Down Expand Up @@ -335,7 +335,7 @@

echo '<div class="center"><div>
<div id="positionselector"></div>
<form name="deviceform" id="deviceform" action="',$_SERVER["PHP_SELF"],$formfix,'" method="POST">
<form name="deviceform" id="deviceform" action="',$_SERVER["SCRIPT_NAME"],$formfix,'" method="POST">
<input type="hidden" name="requestid" value="',$req->RequestID,'">';

echo '<div class="table">
Expand Down
4 changes: 2 additions & 2 deletions report_audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Header() {
$endDate = date( "M d, Y" );

$this->pdfconfig = new Config();
$this->Link( 10, 8, 100, 20, 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] );
$this->Link( 10, 8, 100, 20, 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] );
if ( file_exists( 'images/' . $this->pdfconfig->ParameterArray['PDFLogoFile'] )) {
$this->Image( 'images/' . $this->pdfconfig->ParameterArray['PDFLogoFile'],10,8,100);
}
Expand Down Expand Up @@ -177,7 +177,7 @@ function _putcatalog()
?>
<div class="main">
<div class="center"><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="auditform">
<form method="post" id="auditform">
<div class="table">
<div>
<div><label for="datacenterid">Data Center:</label></div>
Expand Down
4 changes: 2 additions & 2 deletions report_audit_frequency.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PDF extends FPDF {

function Header() {
$this->pdfconfig = new Config();
$this->Link( 10, 8, 100, 20, 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] );
$this->Link( 10, 8, 100, 20, 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] );
if ( file_exists( 'images/' . $this->pdfconfig->ParameterArray['PDFLogoFile'] )) {
$this->Image( 'images/' . $this->pdfconfig->ParameterArray['PDFLogoFile'],10,8,100);
}
Expand Down Expand Up @@ -162,7 +162,7 @@ function _putcatalog()
?>
<div class="main">
<div class="center"><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="auditform">
<form method="post" id="auditform">
<div class="table">
<div>
<div><label for="datacenterid">Data Center:</label></div>
Expand Down
2 changes: 1 addition & 1 deletion report_cabinets.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<?php include( 'sidebar.inc.php' ); ?>
<div class="main">
<div class="center"><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="panelform">
<form method="post" id="panelform">

<?php
if(@$_REQUEST['datacenterid'] == 0) {
Expand Down
2 changes: 1 addition & 1 deletion report_department.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function PDF(){

function Header() {
$this->pdfconfig = new Config();
$this->Link( 10, 8, 100, 20, 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] );
$this->Link( 10, 8, 100, 20, 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] );
if ( file_exists( 'images/' . $this->pdfconfig->ParameterArray['PDFLogoFile'] )) {
$this->Image( 'images/' . $this->pdfconfig->ParameterArray['PDFLogoFile'],10,8,100);
}
Expand Down
2 changes: 1 addition & 1 deletion report_outage_simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="main">
<h2>openDCIM</h2>
<h3>Outage Impact Simulation</h3>
<form action="<?php printf( "%s", $_SERVER['PHP_SELF'] ); ?>" method="post">
<form method="post">
<table align="center" border=0>
<?php
if ( @$_REQUEST['datacenterid'] == 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion report_panel_schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<?php include( 'sidebar.inc.php' ); ?>
<div class="main">
<div class="center"><div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="panelform">
<form method="post" id="panelform">

<?php
if ( @$_REQUEST['datacenterid'] == 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion report_project_outage_simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="main">
<h2>openDCIM</h2>
<h3>Outage Impact Simulation</h3>
<form action="<?php printf( "%s", $_SERVER['PHP_SELF'] ); ?>" method="post">
<form method="post">
<table align="center" border=0>
<?php
if ( @$_REQUEST['datacenterid'] == 0 ) {
Expand Down
Loading

0 comments on commit f7658f8

Please sign in to comment.