Fixed: basePath self→static binding, namespace detection, event wiring,
SQLite cache, file cache driver. All Mod Boot classes converted to
$listens pattern for lifecycle event discovery.
Working endpoints:
- /v1/explorer/info — live chain height, difficulty, aliases
- /v1/explorer/stats — formatted chain statistics
- /v1/names/directory — alias directory grouped by type
- /v1/names/available/{name} — name availability check
- /v1/names/lookup/{name} — name details
Co-Authored-By: Charon <charon@lethean.io>
2.1 KiB
2.1 KiB
Core\Input
Pre-boot input sanitisation. Strips dangerous control characters from $_GET and $_POST before Laravel even creates the Request object.
Key Classes
| Class | Purpose |
|---|---|
Input |
Static capture() method -- sanitises superglobals then delegates to Request::capture() |
Sanitiser |
Configurable filter pipeline: Unicode NFC normalisation, control char stripping, HTML filtering, presets, max length, transformation hooks |
Sanitiser Pipeline
Execution order per string value:
- Before hooks (global, then field-specific)
- Unicode NFC normalisation (via
intlextension) - Control character stripping (
FILTER_UNSAFE_RAW+FILTER_FLAG_STRIP_LOW) - HTML tag filtering (strip_tags with allowed tags)
- Preset application (email, url, phone, alpha, alphanumeric, numeric, slug)
- Additional schema-defined
filter_varfilters - Max length enforcement (
mb_substr) - After hooks (global, then field-specific)
- Audit logging (if enabled and value changed)
Public API
// Immutable builder pattern (returns cloned instance)
$s = (new Sanitiser)
->richText() // allow safe HTML tags
->maxLength(1000) // truncate to 1000 chars
->email('email_field') // apply email preset to specific field
->slug('url_slug') // apply slug preset
->beforeFilter(fn($v, $f) => trim($v))
->transformField('username', fn($v) => strtolower($v));
$clean = $s->filter(['email_field' => $raw, 'url_slug' => $raw2]);
Conventions
- Sanitiser sanitises, Laravel validates. This is explicitly called out in the class docblock.
- Immutable: all
with*/ fluent methods returnclone $this. - Presets are static and extensible via
Sanitiser::registerPreset(). - The
*wildcard key in schema applies to all fields as a default. - Field-specific schema merges over global (
*) schema.
Tests
Pest tests at Tests/Unit/InputFilteringTest.php cover: clean passthrough, control char stripping, full Unicode preservation (CJK, Arabic, Russian, emojis), and edge cases.