Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 3c63c9d

Browse files
authored
validate more form input for feedback (#694)
1 parent bd46e95 commit 3c63c9d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/actions/sendFeedback.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export async function sendFeedback(prevState: any, formData: FormData) {
1717
return { message: 'Not available on production' }
1818
}
1919

20+
// validate url and user agent
21+
if (!ua || !url.toString().startsWith('/docs')) {
22+
return { message: 'invalid' }
23+
}
24+
2025
// validate answer
2126
if (!['yes', 'no', 'feedback'].includes(answer?.toString())) {
2227
return { message: 'invalid' }

0 commit comments

Comments
 (0)