Shield: Add input sanitization and length validation to Contact form

Added `sanitizeInput` utility to escape HTML characters.
Updated `Contact.tsx` to sanitize inputs before sending via `emailjs`.
Added max length validation for Name (100), Subject (200), and Message (5000).
Updated tests to cover sanitization and validation logic, including adding `cleanup()` to prevent test leakage.
This commit is contained in:
google-labs-jules[bot]
2026-01-24 10:05:33 +00:00
parent 77fd62447c
commit 6801682c2e
4 changed files with 98 additions and 6 deletions

4
.jules/sentinel.md Normal file
View File

@@ -0,0 +1,4 @@
## 2025-02-12 - Missing Test Cleanup
**Vulnerability:** Tests in `src/pages/__tests__/Contact.test.tsx` were failing with duplicate elements because `cleanup()` was not being called between tests.
**Learning:** `testing-library/react` usually handles cleanup automatically, but in this environment/setup, explicit `cleanup()` and `document.body.innerHTML = ''` in `afterEach` is required to prevent DOM state leakage.
**Prevention:** Always include explicit `cleanup()` in `afterEach` blocks when writing component tests in this repository.