import Link from 'next/link'; import { useState } from 'react'; import { useHints } from '../contexts/HintContext'; export default function Home() { const [search, setSearch] = useState(''); const [searchResults, setSearchResults] = useState(''); const { hintsVisible } = useHints(); const products = [ { id: 1, name: 'Professional Hammer', price: 89, image: '/assets/hammer.png', description: 'Heavy-duty forging hammer perfect for metalworking and blacksmithing projects.' }, { id: 2, name: 'Steel Anvil', price: 299, image: '/assets/anvil.png', description: 'Solid steel anvil for precise metalworking. Essential tool for any blacksmith.' }, { id: 3, name: 'Heat-Resistant Gloves', price: 45, image: '/assets/gloves.png', description: 'Premium heat-resistant gloves for safe handling of hot materials and tools.' }, { id: 4, name: 'Forging Tongs', price: 65, image: '/assets/tongs.png', description: 'Precision forging tongs for gripping and manipulating hot metal pieces.' } ]; const handleSearch = () => { // XSS Vulnerability - Direct HTML injection without sanitization setSearchResults(`

Search results for: ${search}

Found ${products.filter(p => p.name.toLowerCase().includes(search.toLowerCase())).length} products

`); }; return (
{/* Hero Section */}

Hacksmith Tools

Professional blacksmithing and metalworking tools for craftsmen

{/* Search Bar with XSS Vulnerability */}
setSearch(e.target.value)} placeholder={hintsVisible ? "Search tools... (Try: )" : "Search tools..."} className={`input-field flex-1 ${hintsVisible ? 'border-red-500/30 focus:border-red-500' : ''}`} />
{/* XSS Vulnerability - Dangerous innerHTML */} {searchResults && (
)} {/* Subtle hint when hint mode is on */} {hintsVisible && (
⚠ Input not sanitized
)}
{/* Products Grid */}

Our Tools

{products.map((product) => (
{product.name}

{product.name}

{product.description}

${product.price} View Details →
))}
{/* Security Notice */} {hintsVisible && (

⚠ Security Notice

This application contains intentional vulnerabilities for educational purposes:

  • • XSS vulnerability in search functionality
  • • IDOR vulnerability in product URLs
  • • LFI vulnerability in product details
)}
); }