Skip to content

Commit 6d371d0

Browse files
committed
fix: vulnerabilità minori
1 parent bc2d379 commit 6d371d0

5 files changed

Lines changed: 18 additions & 4 deletions

File tree

modules/anagrafiche/src/Anagrafica.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,12 @@ protected function geolocalizzazione()
489489
$apiKey = setting('Google Maps API key per Tecnici');
490490
$url = 'https://maps.googleapis.com/maps/api/geocode/json?address='.$indirizzo.'&key='.$apiKey;
491491

492+
// Validazione URL per prevenire SSRF
493+
$parsed_url = parse_url($url);
494+
if (!isset($parsed_url['host']) || $parsed_url['host'] !== 'maps.googleapis.com') {
495+
return false;
496+
}
497+
492498
$response = file_get_contents($url);
493499
$data = json_decode($response, true);
494500

modules/anagrafiche/src/Sede.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ protected function geolocalizzazione()
131131
$apiKey = setting('Google Maps API key per Tecnici');
132132
$url = 'https://maps.googleapis.com/maps/api/geocode/json?address='.$indirizzo.'&key='.$apiKey;
133133

134+
// Validazione URL per prevenire SSRF
135+
$parsed_url = parse_url($url);
136+
if (!isset($parsed_url['host']) || $parsed_url['host'] !== 'maps.googleapis.com') {
137+
return false;
138+
}
139+
134140
$response = file_get_contents($url);
135141
$data = json_decode($response, true);
136142

modules/custom_fields/actions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'id_plugin' => $plugin,
3131
'name' => post('name'),
3232
'html_name' => post('html_name'),
33-
'content' => $_POST['content'],
33+
'content' => post('content'),
3434
'on_add' => post('on_add'),
3535
'top' => post('top'),
3636
], ['id' => $id_record]);
@@ -47,7 +47,7 @@
4747
'id_module' => $module,
4848
'id_plugin' => $plugin,
4949
'name' => post('name_add'),
50-
'content' => $_POST['content_add'],
50+
'content' => post('content_add'),
5151
'html_name' => secure_random_string(8),
5252
]);
5353
$id_record = $dbo->lastInsertedID();

modules/emails/ajax/complete.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
switch ($resource) {
2626
// Elenco e-mail
2727
case 'get_email':
28-
$indirizzi_proposti = $_GET['indirizzi_proposti'];
28+
$indirizzi_proposti = filter('indirizzi_proposti');
2929
$where = '';
3030

3131
if ($indirizzi_proposti == 1) {
3232
$where .= 'AND an_tipianagrafiche_lang.title = "Cliente"';
3333
} elseif ($indirizzi_proposti == 2) {
3434
$where .= 'AND an_tipianagrafiche_lang.title = "Fornitore"';
35+
} else {
36+
$indirizzi_proposti = null;
3537
}
3638

3739
$results = [];

modules/newsletter/actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
$newsletter->completed_at = filter('completed_at');
4646

4747
$newsletter->subject = filter('subject');
48-
$newsletter->content = $_POST['content']; // post('content', true);
48+
$newsletter->content = post('content');
4949

5050
$newsletter->save();
5151

0 commit comments

Comments
 (0)