Expand description
Killer — a fast, extensible code quality and security analysis engine.
This library crate exposes the analysis engine so it can be embedded and
tested independently of the killer command-line binary.
§Overview
Static analysis — the killer scan pipeline:
scannerwalks a directory, detects languages, and loads file contents.analyzerdefines theanalyzer::Ruletrait and runs rules over files.rulescontains the built-in security and quality rules.reportturns findings into a scored terminal, JSON, Markdown, or HTML report.configloads.killer.tomlsettings.
The .klr language and test framework — killer test:
klris the language itself: parser, AST, interpreter, the parallel runner, and the static rule engine. The lexer behindklr::parseis an internal detail and is not exposed.attacksholds the executors, including a zero-dependency HTTP client behind theattacks::http::HttpClienttrait.suitesexposes the six built-in suites, embedded at compile time.resultsmodels a test run and persists it under.killer/results/.fuzzis the mutation-generator catalog shared by.klrmutateand thekiller fuzzcommand.
Project analysis and workflow — everything else:
graphbuilds a structural import/dependency graph (not a data-flow one).dependenciesinventories declared dependencies from local manifests across six ecosystems — no CVE or advisory lookup.compliancemaps detected findings onto OWASP Top 10 (2021) and CWE.intelligencerecords score snapshots and computes the trend.gitparsesgit diffoutput forreview, which analyzes only the lines a change touched.ciprovides the gate helpers behindkiller ci/killer github enable.watchis a dependency-free polling file watcher.explainis the knowledge base behindkiller explain <ISSUE_ID>.
§API stability
The enums that model an open set are #[non_exhaustive]
(analyzer::Severity, analyzer::Category, scanner::Language,
results::Verdict, dependencies::Ecosystem,
compliance::CategoryStatus, git::DiffTarget, fuzz::HitOutcome,
and the AST’s klr::ast::Value and klr::ast::Expectation). Match them
with a wildcard arm and fold it into the conservative branch: a Verdict
you do not recognize has not been shown secure.
analyzer::Finding and klr::ast::Attack are #[non_exhaustive] too,
because both are going to gain fields; build them with
analyzer::Finding::new and klr::ast::Attack::empty.
analyzer::Rule is deliberately unsealed so third-party rules keep
working: only id and check are required, and any method added later will
also carry a default body.
§Example
use std::path::Path;
use killer::{analyzer::Analyzer, config::Config, report::Report, scanner};
let root = Path::new(".");
let config = Config::load(root).unwrap();
let scan = scanner::scan(root, &config);
let findings = Analyzer::with_default_rules(&config).analyze(&scan);
let report = Report::new("demo".into(), scan.stats, findings);
print!("{}", report.render_terminal());Modules§
- analyzer
- The analysis core: the
Ruletrait, theFindingtype, and theAnalyzerthat runs a set of rules over scanned files. - attacks
- Attack executors: the transport (HTTP) and domain-specific helpers
(filesystem, database) used by the
.klrinterpreter to carry out and evaluate attacks. - ci
- CI/CD Guardian helpers.
- compliance
- The compliance-mapping engine behind
killer compliance. - config
- Configuration loaded from a
.killer.tomlfile at the scan root. - dependencies
- The dependency-intelligence engine behind
killer dependencies. - explain
- The knowledge base behind
killer explain <ISSUE_ID>. - fuzz
- Fuzz generators — the shared mutation catalog behind the
.klrmutateconstruct and thekiller fuzzcommand. - git
- A thin wrapper over
gitfor the code-review engine. - graph
- The project graph engine.
- intelligence
- The Project Intelligence Engine.
- klr
- The Killer Rule Language (
.klr). - report
- Report generation and terminal rendering.
- results
- Test-result types and on-disk storage.
- review
- The Code Review Engine.
- rules
- The rule registry.
- scanner
- Project scanner: recursively walks a directory, detects languages, and collects the file contents that the rule engine analyzes.
- suites
- Built-in security test suites, embedded in the binary at compile time.
- watch
- A dependency-free file watcher used by
killer watch.