Skip to content

Commit

Permalink
fix(security): specific case for domain (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdimitris authored May 13, 2022
1 parent 045419b commit ef1d0db
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ export function getCreateSecurityClientRoute() {
}
const domainPattern = new RegExp('^(?!-)[A-Za-z0-9-]+([\\-\\.]{1}[a-z0-9]+)*\\.[A-Za-z]{2,6}$');
let comparedDomain = domain;
if (domain.includes('*'))
if (domain.includes('*')) {
comparedDomain = comparedDomain.split('*.')[1];
if (!domainPattern.test(comparedDomain)) throw new ConduitError('INVALID_ARGUMENTS', 400, 'Invalid domain argument');
}
if (!domainPattern.test(comparedDomain) && domain !== '*') throw new ConduitError('INVALID_ARGUMENTS', 400, 'Invalid domain argument');
}
let client = await Client.getInstance().create({
clientId,
Expand Down

0 comments on commit ef1d0db

Please sign in to comment.