appirio-tech / tc-core-library-js

6 stars 9 forks source link

Verify `validIssuers` without taking into account the trailing slash #14

Open maxceem opened 6 years ago

maxceem commented 6 years ago

Currently, if we define validIssuers=['https://topcoder-newauth.auth0.com'] while inside tokeniss="https://topcoder-newauth.auth0.com/" the issuer verification will fail. Because in validIssuers we defined URL without trailing slash, while inside token iss is defined as URL with trailing slash.

Also, probably possbile the reverse situation, when iss will be defined without trailing slash, and validIssuers will be defined with trailing slash.

When tc-core-library-js is used as dependency of other service it could be hard to understand where issues comes from as it could be not clear from the first sight why verification failed if URL looks same. I think it would be nice to enhance the verification process so it ignores the trailing slash. So far I don't see security issues if such enhancements is implemented.

Lines where we verify validIssuers: