Skip to content

Commit 8ba2020

Browse files
AngelFQCclaude
andauthored
Security: escape language original name to prevent stored XSS
Refs GHSA-j9jg-h6cw-jj7v The admin language list rendered the stored original_name directly inside an input value attribute (and a label / table cell) without HTML-attribute encoding, so a name containing a double quote could break out of the value attribute and inject an event handler that runs in another admin's browser. Encode the value with htmlspecialchars(..., ENT_QUOTES, 'UTF-8') at every render point of original_name. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3bc465d commit 8ba2020

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

public/main/admin/languages.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,16 @@
282282
$checked = ' checked="checked" ';
283283
}
284284

285+
$originalName = htmlspecialchars($row['original_name'], ENT_QUOTES, 'UTF-8');
285286
$row_td[] = '
286287
<input type="hidden" name="edit_id" value="'.$id.'" />
287-
<input type="text" name="txt_name" value="'.$row['original_name'].'" />
288+
<input type="text" name="txt_name" value="'.$originalName.'" />
288289
<input type="checkbox" '.$checked.' name="platformlanguage" id="platformlanguage" value="'.$row['isocode'].'" />
289-
<label for="platformlanguage">'.sprintf(get_lang('%s as platform language'), $row['original_name']).'</label>
290+
<label for="platformlanguage">'.sprintf(get_lang('%s as platform language'), $originalName).'</label>
290291
<input class="btn btn--primary" type="submit" name="Submit" value="'.get_lang('Validate').'" />
291292
<a name="value" />';
292293
} else {
293-
$row_td[] = $row['original_name'];
294+
$row_td[] = htmlspecialchars($row['original_name'], ENT_QUOTES, 'UTF-8');
294295
}
295296

296297
$row_td[] = $row['english_name'].' ('.$row['isocode'].')';

0 commit comments

Comments
 (0)