From 7bee2ada975463c6d45e83f9ed315a938cc52d96 Mon Sep 17 00:00:00 2001 From: Robertson Reis Date: Tue, 2 Sep 2025 18:16:10 +0200 Subject: [PATCH 1/3] Fixed sonar Issues --- .../_components/EmailWordlistGenerator.tsx | 91 +++++++++++++------ src/app/_components/EthicsNotice.tsx | 2 +- src/app/_lib/emailWordlist.ts | 2 +- src/app/about/page.tsx | 60 ++++++------ 4 files changed, 93 insertions(+), 62 deletions(-) diff --git a/src/app/_components/EmailWordlistGenerator.tsx b/src/app/_components/EmailWordlistGenerator.tsx index 32ad1a5..678c917 100644 --- a/src/app/_components/EmailWordlistGenerator.tsx +++ b/src/app/_components/EmailWordlistGenerator.tsx @@ -1,29 +1,56 @@ "use client" -import { useState } from 'react' +import { useId, useState } from 'react' import { generateEmails, generateWordlist, generateUsernames, preview, limits, EmailWordlistInput } from '../_lib/emailWordlist' import { isValidDomain } from '../_lib/validation' import EthicsNotice from './EthicsNotice' const defaultProviders = ['gmail.com', 'hotmail.com', 'yahoo.com'] -// OSINT Tooltip Component -const OSINTTooltip = ({ children, tip }: { children: React.ReactNode, tip: string }) => { +// OSINT Tooltip Component (accessible) +const OSINTTooltip = ({ children, tip }: { children: React.ReactNode; tip: string }) => { const [show, setShow] = useState(false) + const tooltipId = useId() + + const showTip = () => setShow(true) + const hideTip = () => setShow(false) + const onKeyDown: React.KeyboardEventHandler = (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + setShow((s) => !s) + } + if (e.key === 'Escape') hideTip() + } + return (
-
setShow(true)} - onMouseLeave={() => setShow(false)} +
{children}
- {show && ( -
-
🔍 OSINT Tip:
- {tip} -
- )} +
) } @@ -246,7 +273,11 @@ const EmailWordlistGenerator = () => { {/* Real-time Stats */}
-
{Object.values(form).filter(v => v && v.toString().trim()).length}
+
{Object.values(form).filter(v => { + if (Array.isArray(v)) return v.length > 0 + if (typeof v === 'string') return v.trim().length > 0 + return v !== undefined && v !== null + }).length}
Fields
@@ -255,7 +286,7 @@ const EmailWordlistGenerator = () => {
- {result ? `${result.emails.length + result.passwords.length + result.usernames.length}` : '0'} + {(result?.emails.length ?? 0) + (result?.passwords.length ?? 0) + (result?.usernames.length ?? 0)}
Generated
@@ -278,7 +309,7 @@ const EmailWordlistGenerator = () => { { { { { { { { {