Skip to content

Commit

Permalink
IN CSRF hook, only lowercase the route path if the route isn't a regex
Browse files Browse the repository at this point in the history
  • Loading branch information
rachaelshaw committed Sep 8, 2019
1 parent 8242374 commit f7a0f04
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hooks/security/csrf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = function(sails) {
_.each(sortedRouteAddresses, function(address) {

var routeInfo = detectVerb(address);
var path = routeInfo.original.toLowerCase();
var path = routeInfo.original;
var verb = routeInfo.verb.toLowerCase();
var target = sails.router.explicitRoutes[address];

Expand All @@ -55,6 +55,7 @@ module.exports = function(sails) {
if (matches) {
regex = new RegExp(matches[1]);
} else {
path = path.toLowerCase();
regex = pathToRegexp(path);
}

Expand Down

0 comments on commit f7a0f04

Please sign in to comment.