Security hardening release addressing CodeQL and Dependabot alerts: - Fix stack trace exposure in error responses - Add SSRF protection with DNS resolution checking - Implement proper URL hostname validation (replaces substring matching) - Add centralized path sanitization to prevent path traversal - Fix ReDoS vulnerability in email validation regex - Improve HTML sanitization in validation utilities - Fix capability wildcard matching in auth utilities - Update glob dependency to address CVE - Add CodeQL suppression comments for verified false positives 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
753 B
TypeScript
30 lines
753 B
TypeScript
import * as React from "react"
|
|
import toast from 'react-hot-toast'
|
|
|
|
interface ToastOptions {
|
|
title?: string;
|
|
description?: string;
|
|
variant?: "default" | "destructive";
|
|
}
|
|
|
|
// Simple wrapper around react-hot-toast to match the expected interface
|
|
export function useToast() {
|
|
const toastFunction = (options: ToastOptions | string) => {
|
|
if (typeof options === 'string') {
|
|
return toast(options);
|
|
}
|
|
|
|
const { title, description, variant } = options;
|
|
const message = title && description ? `${title}: ${description}` : title || description || '';
|
|
|
|
if (variant === 'destructive') {
|
|
return toast.error(message);
|
|
} else {
|
|
return toast.success(message);
|
|
}
|
|
};
|
|
|
|
return {
|
|
toast: toastFunction
|
|
}
|
|
} |