🔒️(frontend) validate emoji in notifications to prevent forbidden emoji
Add validation for emoji received through notifications to ensure participants cannot send forbidden emoji characters. Improves security by filtering potentially problematic content before display.
This commit is contained in:
committed by
aleb_the_flash
parent
c576a75660
commit
4955f3eea7
@@ -7,7 +7,10 @@ import { NotificationDuration } from './NotificationDuration'
|
||||
import { Div } from '@/primitives'
|
||||
import { ChatMessage, isMobileBrowser } from '@livekit/components-core'
|
||||
import { useNotificationSound } from '@/features/notifications/hooks/useSoundNotification'
|
||||
import { Reaction } from '@/features/rooms/livekit/components/controls/ReactionsToggle'
|
||||
import {
|
||||
EMOJIS,
|
||||
Reaction,
|
||||
} from '@/features/rooms/livekit/components/controls/ReactionsToggle'
|
||||
import {
|
||||
ANIMATION_DURATION,
|
||||
ReactionPortals,
|
||||
@@ -44,7 +47,7 @@ export const MainNotificationToast = () => {
|
||||
}, [room, triggerNotificationSound])
|
||||
|
||||
const handleEmoji = (emoji: string, participant: Participant) => {
|
||||
if (!emoji) return
|
||||
if (!emoji || !EMOJIS.includes(emoji)) return
|
||||
const id = instanceIdRef.current++
|
||||
setReactions((prev) => [
|
||||
...prev,
|
||||
|
||||
@@ -13,7 +13,8 @@ import {
|
||||
import { Toolbar as RACToolbar } from 'react-aria-components'
|
||||
import { Participant } from 'livekit-client'
|
||||
|
||||
const EMOJIS = ['👍', '👎', '👏', '❤️', '😂', '😮', '🎉']
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export const EMOJIS = ['👍', '👎', '👏', '❤️', '😂', '😮', '🎉']
|
||||
|
||||
export interface Reaction {
|
||||
id: number
|
||||
@@ -144,7 +145,6 @@ export const ReactionsToggle = () => {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ReactionPortals reactions={reactions} />
|
||||
</>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user