cd662141e0
Introduces a new `validate` module to centralize input validation for web requests. This module contains functions to check the shape and format of various user-supplied strings before they are processed by the main application logic. Specifically, this commit adds validation for: - Login slugs: Ensures slugs conform to a strict pattern (lowercase alphanumerics, `_`, `-`) to prevent path traversal and other attacks. - Magic link tokens: Validates token length and character set to ensure they are URL-safe and within expected bounds. - Recorded at timestamps: Enforces a strict RFC3339 format with second granularity (`YYYY-MM-DDTHH:MM:SSZ`) to prevent filename parsing issues and ensure consistent data grouping. These validators are integrated into the `handle_login_submit`, `handle_consume` (magic link), and `handle_upload` routes. This change enhances security by preventing malformed inputs from reaching sensitive parts of the application and improves robustness by catching data format errors early. Unit and integration tests have been added to verify the functionality of these validators and their integration into the respective endpoints.