Skip to content

Commit 8ad0e5e

Browse files
committed
fix(security): unencoded username in api route construction
The username is inserted directly into `/api/gravatar/${props.username}`. A crafted username containing path separators or reserved URL characters can change the effective request path and potentially hit unintended endpoints. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
1 parent ae8981e commit 8ad0e5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/components/User/Avatar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const textClass = computed(() => {
3131
}
3232
})
3333
34-
const { data: gravatarUrl } = useLazyFetch(() => `/api/gravatar/${props.username}`, {
34+
const { data: gravatarUrl } = useLazyFetch(() => `/api/gravatar/${encodeURIComponent(props.username)}`, {
3535
transform: res => (res.hash ? `/_avatar/${res.hash}?s=128&d=404` : null),
3636
getCachedData(key, nuxtApp) {
3737
return nuxtApp.static.data[key] ?? nuxtApp.payload.data[key]

0 commit comments

Comments
 (0)