Skip to content

Commit

Permalink
fix: dont allow urls with double slashes in pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongliang02 committed Jan 14, 2025
1 parent 9d6f03b commit 2251a6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/validators/src/url/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export const toSchema = (options: ParsedUrlValidatorOptions) => {
}
}

// don't allow pathname with double slashes
if (url.pathname.replace(/\\/g, '/').startsWith('//')) {
return false
}

// don't allow dynamic routes
if (isDynamicRoute(url)) {
return false
Expand Down

0 comments on commit 2251a6a

Please sign in to comment.