Skip to content

Validation ​

Every fetched or loaded IP set passes through validation before it becomes trusted by Laravel.

Goals ​

  1. Prevent accidentally trusting the entire Internet
  2. Reject empty or corrupt payloads
  3. Ensure updates are atomic and reversible on failure
  4. Detect unexpected drift via checksums and change-percent guards

Non-global rejection ​

EdgeTrust refuses ranges that would trust all traffic, including:

  • 0.0.0.0/0
  • ::/0

Controlled by validation.reject_non_global (default true). Custom ranges can optionally allow non-global checks via reject_non_global_custom.

Minimum prefix counts ​

Each provider can require a minimum number of valid prefixes so a truncated upstream payload fails loudly:

php
'validation' => [
    'min_prefixes_default' => 1,
    'min_prefixes' => [
        'cloudflare' => 5,
        'aws_cloudfront' => 10,
        'fastly' => 3,
        'bunny' => 10,
        'google_cloud' => 10,
        'arvancloud' => 1,
    ],
],

Change-percent guards ​

Large unexpected swings in prefix count relative to the previous archive / cache can be rejected:

php
'max_change_percent_default' => 50.0,
'max_change_percent' => [
    // 'cloudflare' => 40.0,
],

Use --force on edge-trust:sync / edge-trust:update to bypass these guards when you intentionally accept a large shift.

Checksums ​

When archives.verify_checksums is enabled, EdgeTrust verifies digest metadata for bundled archives. Mismatched checksums abort the load.

Atomic updates ​

Validated data is written carefully so readers never observe a half-written archive. If validation or the write fails, EdgeTrust preserves the previous archive / last-known-good data.

Manual validation ​

bash
php artisan edge-trust:validate
php artisan edge-trust:validate --provider=arvancloud

Runs validation against currently resolved ranges. Useful in CI and after manual edits.

Failure behavior ​

EventResult
Invalid CIDR syntaxRange rejected / update aborted
Global range detectedUpdate aborted (when configured)
Below min prefix countUpdate aborted
Change percent exceededUpdate aborted (unless --force)
Checksum mismatchArchive load aborted
Network / HTTP error (runtime)No overwrite; hybrid falls back

More operational detail: Security.

Released under the MIT License.