Skip to content

Commit

Permalink
fix(server): block bypassing absolute URL with leading whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Dec 8, 2023
1 parent 8c26a7a commit 72762a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/server/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineEventHandler(async (event): Promise<any> => {
} = _body

// Check if the path is an absolute URL
if (/^https?:\/\//.test(path)) {
if (new URL(path, 'http://localhost').origin !== 'http://localhost') {
throw createError({
statusCode: 400,
statusMessage: 'Absolute URLs are not allowed',
Expand Down

0 comments on commit 72762a2

Please sign in to comment.