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 90c7b6d commit 9d47120
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 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() ?>">
<?php elseif ($meta->isHTTPEquiv()): ?>
<meta http-equiv="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<meta charset="<?= $this->escapeAttr($meta->content()) ?>">
<?php elseif ($meta->isHTTPEquiv()) : ?>
<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 9d47120

Please # to comment.