|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* ***************************************************************************** |
|
4
|
|
|
* Contributions to this work were made on behalf of the GÉANT project, a |
|
5
|
|
|
* project that has received funding from the European Union’s Framework |
|
6
|
|
|
* Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus), |
|
7
|
|
|
* Horizon 2020 research and innovation programme under Grant Agreements No. |
|
8
|
|
|
* 691567 (GN4-1) and No. 731122 (GN4-2). |
|
9
|
|
|
* On behalf of the aforementioned projects, GEANT Association is the sole owner |
|
10
|
|
|
* of the copyright in all material which was developed by a member of the GÉANT |
|
11
|
|
|
* project. GÉANT Vereniging (Association) is registered with the Chamber of |
|
12
|
|
|
* Commerce in Amsterdam with registration number 40535155 and operates in the |
|
13
|
|
|
* UK as a branch of GÉANT Vereniging. |
|
14
|
|
|
* |
|
15
|
|
|
* Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. |
|
16
|
|
|
* UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK |
|
17
|
|
|
* |
|
18
|
|
|
* License: see the web/copyright.inc.php file in the file structure or |
|
19
|
|
|
* <base_url>/copyright.php after deploying the software |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* This page edits a federation. |
|
24
|
|
|
* |
|
25
|
|
|
* @author Stefan Winter <[email protected]> |
|
26
|
|
|
*/ |
|
27
|
|
|
?> |
|
28
|
|
|
<?php |
|
29
|
|
|
require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
30
|
|
|
|
|
31
|
|
|
$auth = new \web\lib\admin\Authentication(); |
|
32
|
|
|
$deco = new \web\lib\admin\PageDecoration(); |
|
33
|
|
|
$validator = new \web\lib\common\InputValidation(); |
|
34
|
|
|
$uiElements = new web\lib\admin\UIElements(); |
|
35
|
|
|
|
|
36
|
|
|
$auth->authenticate(); |
|
37
|
|
|
|
|
38
|
|
|
$fedPost = $_POST['fed_id']; |
|
39
|
|
|
|
|
40
|
|
|
$wizard = new \web\lib\admin\Wizard(false); |
|
41
|
|
|
$wizard->setMessages(); |
|
42
|
|
|
|
|
43
|
|
|
[$my_fed, $editMode] = $validator->existingFederationInt($fedPost, $_SESSION['user']); |
|
44
|
|
|
$fed_options = $my_fed->getAttributes(); |
|
45
|
|
|
$availableFedOptions = \web\lib\admin\OptionDisplay::enumerateOptionsToDisplay("fed", $my_fed->tld); |
|
46
|
|
|
$wizard->setOptionsHelp($availableFedOptions); |
|
47
|
|
|
$wizard->setMessages(); |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/// product name (eduroam CAT), then term used for "federation", then actual name of federation. |
|
52
|
|
|
echo $deco->defaultPagePrelude(sprintf(_("%s: Editing %s '%s'"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureFed, $my_fed->name)); |
|
53
|
|
|
?> |
|
54
|
|
|
<script src="js/XHR.js" type="text/javascript"></script> |
|
55
|
|
|
<script src="js/option_expand.js" type="text/javascript"></script> |
|
56
|
|
|
<script type="text/javascript" src="../external/jquery/jquery-ui.js"></script> |
|
57
|
|
|
<link rel="stylesheet" type="text/css" href="../external/jquery/jquery-ui.css" /> |
|
58
|
|
|
<script type="text/javascript" src="js/wizard.js"></script> |
|
59
|
|
|
<link rel='stylesheet' type='text/css' href='css/wizard.css.php' /> |
|
60
|
|
|
<?php |
|
61
|
|
|
if ($editMode == 'readonly') { |
|
62
|
|
|
print('<style>' |
|
63
|
|
|
. 'button.newoption {visibility: hidden}' |
|
64
|
|
|
. 'input {pointer-events: none} ' |
|
65
|
|
|
. '.ui-sortable-handle {pointer-events: none}' |
|
66
|
|
|
. '</style>'); |
|
67
|
|
|
} |
|
68
|
|
|
?> |
|
69
|
|
|
</head> |
|
70
|
|
|
<body> |
|
71
|
|
|
|
|
72
|
|
|
<?php echo $deco->productheader("FEDERATION"); ?> |
|
73
|
|
|
<div id="wizard_help_window"><img id="wizard_menu_close" src="../resources/images/icons/button_cancel.png" ALT="Close"/><div></div></div> |
|
74
|
|
|
<h1> |
|
75
|
|
|
<?php |
|
76
|
|
|
/// nomenclature for federation, then actual federation name |
|
77
|
|
|
printf(_("Editing %s information for '%s'"), $uiElements->nomenclatureFed, $my_fed->name); |
|
78
|
|
|
?> |
|
79
|
|
|
</h1> |
|
80
|
|
|
<div class='infobox'> |
|
81
|
|
|
<h2><?php $tablecaption = sprintf(_("%s Properties"),$uiElements->nomenclatureFed); echo $tablecaption?></h2> |
|
82
|
|
|
<table> |
|
83
|
|
|
<caption><?php echo $tablecaption;?></caption> |
|
84
|
|
|
<tr> |
|
85
|
|
|
<th class="wai-invisible" scope="col"><?php echo _("Property Type");?></th> |
|
86
|
|
|
<th class="wai-invisible" scope="col"><?php echo _("Language if applicable");?></th> |
|
87
|
|
|
<th class="wai-invisible" scope="col"><?php echo _("Property Value");?></th> |
|
88
|
|
|
</tr> |
|
89
|
|
|
<tr> |
|
90
|
|
|
<td><?php echo _("Country:"); ?></td> |
|
91
|
|
|
<td></td> |
|
92
|
|
|
<td><strong><?php echo $my_fed->name; ?></strong></td> |
|
93
|
|
|
</tr> |
|
94
|
|
|
<?php echo $uiElements->infoblock($fed_options, "fed", "FED"); ?> |
|
95
|
|
|
</table> |
|
96
|
|
|
</div> |
|
97
|
|
|
<?php |
|
98
|
|
|
echo "<form enctype='multipart/form-data' action='edit_federation_result.php?fed_id=$my_fed->tld" . "' method='post' accept-charset='UTF-8'> |
|
99
|
|
|
<input type='hidden' name='MAX_FILE_SIZE' value='" . \config\Master::MAX_UPLOAD_SIZE . "'>"; |
|
100
|
|
|
?> |
|
101
|
|
|
<fieldset class="option_container"> |
|
102
|
|
|
<legend><strong><?php echo sprintf(_("%s Properties"),$uiElements->nomenclatureFed); ?></strong></legend> |
|
103
|
|
|
<?php |
|
104
|
|
|
$options = [ |
|
105
|
|
|
'level' => 'fed', |
|
106
|
|
|
'fed_id'=> $my_fed->tld |
|
107
|
|
|
]; |
|
108
|
|
|
echo $wizard->displayHelp("fed_general", $options); |
|
109
|
|
|
$optionDisplay = new \web\lib\admin\OptionDisplay($fed_options, \core\Options::LEVEL_FED); |
|
110
|
|
|
echo $optionDisplay->prefilledOptionTable("fed", $my_fed->tld); |
|
111
|
|
|
?> |
|
112
|
|
|
<button type='button' class='newoption' onclick='getXML("fed", "<?php echo $my_fed->tld ?>")'><?php echo _("Add new option"); ?></button> |
|
113
|
|
|
</fieldset> |
|
114
|
|
|
<?php |
|
115
|
|
|
echo "<div>"; |
|
116
|
|
|
if ($editMode === 'fullaccess') { |
|
117
|
|
|
echo "<button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_SAVE . "'>" . _("Save data") . "</button>"; |
|
|
|
|
|
|
118
|
|
|
$discardLabel = _("Discard changes"); |
|
119
|
|
|
} else { |
|
120
|
|
|
$discardLabel = _("Return"); |
|
121
|
|
|
} |
|
122
|
|
|
echo "<button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_federation.php?fed_id=$fedPost\"'>" . $discardLabel . "</button></div></form>"; |
|
123
|
|
|
echo $deco->footer(); |
|
124
|
|
|
|
'<button type='submit' n...ve data') . '</button>'can contain request data and is used in output context(s) leading to a potential security vulnerability.3 paths for user data to reach this point
$protocol . '://' . $hostname . $port . $_SERVER['REQUEST_URI']is returned in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 823$protocol . '://' . $hostname . $port . $_SERVER['REQUEST_URI']is returnedin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 823
$httpUtils->getSelfURL()is assigned to$returnToin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Auth/Simple.php on line 137
substr(), and$this->getBaseURL() . $url_path . substr($_SERVER['REQUEST_URI'], $uri_pos + strlen($url_path))is returned in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 826substr(), and$this->getBaseURL() . $url_path . substr($_SERVER['REQUEST_URI'], $uri_pos + strlen($url_path))is returnedin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 826
$httpUtils->getSelfURL()is assigned to$returnToin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Auth/Simple.php on line 137
$_SERVER['HTTP_HOST']is assigned to$currentin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 113$_SERVER['HTTP_HOST']is assigned to$currentin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 113
$currentis returnedin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 131
$this->getServerHost()is assigned to$hostnamein vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 820
$protocol . '://' . $hostname . $port . $_SERVER['REQUEST_URI']is returnedin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 823
$httpUtils->getSelfURL()is assigned to$returnToin vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Auth/Simple.php on line 137
Preventing Cross-Site-Scripting Attacks
Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.
In order to prevent this, make sure to escape all user-provided data:
General Strategies to prevent injection
In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:
if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) { throw new \InvalidArgumentException('This input is not allowed.'); }For numeric data, we recommend to explicitly cast the data: