Skip to content

Commit

Permalink
Session: encode HTML entities in error
Browse files Browse the repository at this point in the history
Without this, it's possible to self-XSS by trying to set a session id to
something like `</script><svg/onload='alert("xss")'>`.
  • Loading branch information
mmcclimon authored and jjn1056 committed Dec 6, 2018
1 parent 2790acd commit 88d1b59
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Catalyst/Plugin/Session.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use Catalyst::Exception ();
use Digest ();
use overload ();
use Object::Signature ();
use HTML::Entities ();
use Carp;
use List::Util qw/ max /;

Expand Down Expand Up @@ -480,6 +481,7 @@ sub _load_sessionid {
$c->_sessionid($sid);
return $sid;
} else {
$sid = HTML::Entities::encode_entities($sid);
my $err = "Tried to set invalid session ID '$sid'";
$c->log->error($err);
Catalyst::Exception->throw($err);
Expand Down

0 comments on commit 88d1b59

Please sign in to comment.