Add bulk-run actions and per-source rate limiting

Run-all buttons (per target and per investigation) queue every applicable,
not-already-in-flight source via a new FindingDispatcher, re-attempting
prior failures automatically. RunFinding now applies a per-source
RateLimited queue middleware so a bulk run can't hammer the free public
APIs (ip-api, crt.sh, whois, sherlock, theharvester) it depends on;
$tries raised to 30 to survive rate-limiter releases, with a failed()
handler so exhausted retries still resolve the Finding instead of leaving
it stuck pending.

Also fixes CrtShRunner treating crt.sh's intermittent 404/502 (a known
flaky free service) as fatal on the first try — added a bounded retry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
cedry2k1992
2026-07-20 11:29:26 +03:00
co-authored by Claude Sonnet 5
parent 853686f3f3
commit e4fa57c3d6
13 changed files with 387 additions and 5 deletions
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Investigation;
use App\Models\Source;
use App\Osint\FindingDispatcher;
use App\Osint\RunnerRegistry;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -72,4 +73,18 @@ class InvestigationController extends Controller
return redirect()->route('investigations.index');
}
public function runAll(Request $request, Investigation $investigation, FindingDispatcher $dispatcher): RedirectResponse
{
$this->authorize('update', $investigation);
$queued = $investigation->targets->sum(
fn ($target) => $dispatcher->dispatchAllApplicable($target, $request->user())
);
return redirect()->route('investigations.show', $investigation)
->with('status', $queued > 0
? "Queued {$queued} lookup(s) across all targets..."
: 'Nothing to queue — already up to date.');
}
}
+15
View File
@@ -7,6 +7,7 @@ use App\Models\Finding;
use App\Models\Investigation;
use App\Models\Source;
use App\Models\Target;
use App\Osint\FindingDispatcher;
use App\Osint\RunnerRegistry;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -74,4 +75,18 @@ class TargetController extends Controller
return redirect()->route('investigations.show', $investigation)
->with('status', "Running {$source->name} against {$target->value}...");
}
public function runAll(Request $request, Investigation $investigation, Target $target, FindingDispatcher $dispatcher): RedirectResponse
{
$this->authorize('update', $investigation);
abort_if($target->investigation_id !== $investigation->id, 404);
$queued = $dispatcher->dispatchAllApplicable($target, $request->user());
return redirect()->route('investigations.show', $investigation)
->with('status', $queued > 0
? "Queued {$queued} lookup(s) for {$target->value}..."
: "Nothing to queue for {$target->value} — already up to date.");
}
}