Skip to content

Commit

Permalink
Escape meta attributes to avoid XSS injection
Browse files Browse the repository at this point in the history
  • Loading branch information
giuscris committed Jun 7, 2024
1 parent 257150a commit f531201
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/templates/partials/meta.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php foreach ($page->metadata() as $meta) : ?>
<?php if ($meta->isCharset()) : ?>
<meta charset="<?= $meta->content() ?>">
<meta charset="<?= $this->escapeAttr($meta->content()) ?>">
<?php elseif ($meta->isHTTPEquiv()) : ?>
<meta http-equiv="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<meta http-equiv="<?= $this->escapeAttr($meta->name()) ?>" content="<?= $this->escapeAttr($meta->content()) ?>">
<?php else : ?>
<meta <?= $meta->prefix() === 'og' ? 'property' : 'name' ?>="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<meta <?= $meta->prefix() === 'og' ? 'property' : 'name' ?>="<?= $this->escapeAttr($meta->name()) ?>" content="<?= $this->escapeAttr($meta->content()) ?>">
<?php endif ?>
<?php endforeach ?>

0 comments on commit f531201

Please sign in to comment.