Skip to content

Commit

Permalink
open redirect vulnerability fixes (#201)
Browse files Browse the repository at this point in the history
* open redirect vulnerability fix for opengraph

* open redirect vulnerability fix for twitter cards

* open redirect vulnerability fix for setTitle

* fixed preg replace

* Update OpenGraph.php

* Update TwitterCards.php
  • Loading branch information
jnbn authored Apr 2, 2020
1 parent 445c0bf commit ca27cd0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/SEOTools/OpenGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ protected function eachProperties(
*/
protected function makeTag($key = null, $value = null, $ogPrefix = false)
{
$value = str_replace(['http-equiv=', 'url='], '', $value);
return sprintf(
'<meta property="%s%s" content="%s" />%s',
$ogPrefix ? $this->og_prefix : '',
Expand Down
3 changes: 3 additions & 0 deletions src/SEOTools/SEOMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ public function generate($minify = false)
*/
public function setTitle($title, $appendDefault = true)
{
// open redirect vulnerability fix
$title = str_replace(['http-equiv=', 'url='], '', $title);

// clean title
$title = strip_tags($title);

Expand Down
1 change: 1 addition & 0 deletions src/SEOTools/TwitterCards.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ protected function eachValue(array $values, $prefix = null)
*/
private function makeTag($key, $value)
{
$value = str_replace(['http-equiv=', 'url='], '', $value);
return '<meta name="'.$this->prefix.strip_tags($key).'" content="'.strip_tags($value).'" />';
}

Expand Down

0 comments on commit ca27cd0

Please # to comment.