krakenjs / lusca

Application security for express apps.
Other
1.79k stars 139 forks source link

CSRF blacklist and whitelist not working as expected for multiple endpoints. #128

Closed gladchinda closed 5 years ago

gladchinda commented 6 years ago

I am currently working with a package that uses lusca for CSRF protection and discovered that blacklisting and whitelisting does not work as expected when I pass an array of more than 1 endpoints. However, if a string or an array with just 1 endpoint is passed, it works as expected.

Here is a simple scenario from my app:

This works as expected

expressApp.use(lusca.csrf({
  blacklist: ['/hooks/user_created']
}));

This doesn't work as expected

expressApp.use(lusca.csrf({
  blacklist: [
    '/hooks/user_created',
    '/hooks/user_profile_updated',
    '/hooks/email_delivered'
  ]
}));
linkRace commented 5 years ago

Fixed in #121