Closes the last coverage gap for org (person remains intentionally unaddressed — no good free/non-scraping option exists). Unlike the other 8 sources, OpenCorporates now requires an API token even on its free tier (confirmed: keyless request gets 401). RunnerRegistry::has() checks services.opencorporates.token is configured before exposing the source as runnable, so it degrades to "not yet integrated" in the UI rather than a broken Run button, until OPENCORPORATES_API_TOKEN is set. Also fixes a real bug hit while building this: a RunnerRegistry::REQUIRES class constant mapping source key to a closure crashed on file load (PHP class constants can't hold closures) — inlined the one check instead of building an abstraction for a single case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
|
use Illuminate\Support\Facades\RateLimiter;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Self-imposed limits so bulk-running lookups doesn't hammer the
|
|
// free public infrastructure these runners depend on. ip-api.com's
|
|
// limit (45/min) is theirs; the rest are courtesy limits of ours.
|
|
RateLimiter::for('osint-runner:ip-api', fn () => Limit::perMinute(45));
|
|
RateLimiter::for('osint-runner:crtsh', fn () => Limit::perMinute(30));
|
|
RateLimiter::for('osint-runner:whois', fn () => Limit::perMinute(20));
|
|
RateLimiter::for('osint-runner:sherlock', fn () => Limit::perMinute(10));
|
|
RateLimiter::for('osint-runner:theharvester', fn () => Limit::perMinute(5));
|
|
RateLimiter::for('osint-runner:holehe', fn () => Limit::perMinute(15));
|
|
RateLimiter::for('osint-runner:gravatar', fn () => Limit::perMinute(45));
|
|
RateLimiter::for('osint-runner:dns', fn () => Limit::perMinute(60));
|
|
|
|
// OpenCorporates' free tier is 50 requests/day, 200/month — this
|
|
// matches their real quota (not a courtesy limit) to protect the
|
|
// configured token from getting exhausted or suspended.
|
|
RateLimiter::for('osint-runner:opencorporates', fn () => Limit::perDay(50));
|
|
}
|
|
}
|