@havoc-security/scanner
v0.2.4
Published
HAVOC scanning engine. Free to use; free to use under BSL 1.1.
Maintainers
Readme
@havoc-security/scanner
The scanning engine behind @havoc-security/cli.
Parses Laravel PHP into an AST and runs framework-aware analyzers over it.
Most people want the CLI, not this package:
npx @havoc-security/cli scanUse this directly only if you are embedding HAVOC in your own tooling.
Usage
import { scanProject, DEFAULT_CONFIG } from '@havoc-security/scanner';
const result = await scanProject('/path/to/laravel-app', DEFAULT_CONFIG);
console.log(result.grade); // 'A' … 'F'
console.log(result.findings.length);
console.log(result.coverage.routeAuthPercent);
console.log(result.metadata.durationMs);Scanning a 1,398-file Laravel application takes roughly 1.6 seconds.
Lower-level entry point
scan() takes files you have already parsed, which is useful when you control
discovery:
import { scan, PhpParser, RouteParser, DEFAULT_CONFIG } from '@havoc-security/scanner';Analyzers
Fifteen, exported individually from the package root so you can compose your own
set: AuthorizationCoverageAnalyzer, MassAssignmentAnalyzer,
SqlInjectionAnalyzer, XssSurfaceAnalyzer, IdorAnalyzer,
PrivilegeEscalationAnalyzer, CredentialExposureAnalyzer,
SessionSecurityAnalyzer, FileUploadAnalyzer, RateLimitAnalyzer,
EncryptionAnalyzer, InsecureDeserializationAnalyzer, OpenRedirectAnalyzer,
SecurityHeaderAnalyzer, DependencyAuditAnalyzer.
Each implements the Analyzer interface (name, description, analyze()), so
you can add your own alongside them.
The two coverage numbers are different questions
result.authorizationCoverage — { coveredActions, totalActions } — is the
headline metric: controller actions with a detectable authorization check
(inline authorize()/Gate, a policy-backed FormRequest, or can: middleware).
result.coverage.routeAuthPercent is the share of routes behind
authentication middleware. Authentication is not authorization, and on a real
project the two numbers differ widely. coverage.coveragePercent is a
deprecated alias of routeAuthPercent, kept so the two spellings cannot drift —
do not read it as the headline figure.
Licence
Business Source License 1.1 — free to use, not open source. See
LICENSE.md.
