URL submission: tighten validation (max length, reject loopback/private IPs) #24
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
App\Livewire\UrlSubmissionForm::submit()validates with['required', 'url:http,https']. Two gaps:pages.url(which istext, no inherent cap).http://127.0.0.1,http://192.168.x.x,http://10.x.x.x,http://[::1]all passurl:http,https. Inert in v0.1 (we don't fetch yet), but becomes SSRF when the crawler lands (ticket #12).Acceptance
max:2048to the URL validation rule (covers 99.9% of legit URLs; defends against pathological inputs)127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16(link-local)::1), link-local (fe80::/10), unique-local (fc00::/7)localhosthostname literalUrlDiscoveredListenerwrite site (extracted URLs from fediverse posts could also point at private addresses)https://1.1.1.1) are still accepted (judgment call: probably yes for v0.1, can revisit)Notes
spatie/urlor a similar lib rather than rolling host parsing by hand —parse_urlis famously misleading.