Skip to content

Commit fd779ba

Browse files
fix: replace Math.random() with crypto.randomUUID() for secure ID generation
- Replace Date.now() + Math.random() with crypto.randomUUID() in useToast hook - Use cryptographically secure random number generator to satisfy SonarQube security hotspot - crypto.randomUUID() is available in all modern browsers and provides proper UUIDs
1 parent d6fd553 commit fd779ba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/EductionPortal/Tasks/useToast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function useToast() {
44
const [toasts, setToasts] = useState([]);
55

66
const addToast = useCallback((message, type = 'success', duration = 3000) => {
7-
const id = Date.now() + Math.random();
7+
const id = crypto.randomUUID();
88
const newToast = { id, message, type, duration };
99

1010
setToasts(prev => [...prev, newToast]);

0 commit comments

Comments
 (0)