All projects

Security · Developer Tools

Kestrix

An open-source security scanner and local workbench on PyPI: 146 deterministic rules across 13 languages, Sigma detection repair, file and website checks, and a Claude Code plugin.

Context
Open-source security scanner and workbench · my project, released on PyPI
Stack
Python, SARIF, Elasticsearch
Kestrix dashboard, Detection repair page, captured under the project's earlier name Aegis-Sec: a green banner reports a tested fix for the case Noise: updater executes from Temp, a diff adds a GoogleUpdate.exe ParentImage exclusion to the rule condition, and before-and-after tables show false alarms falling from 4 to 0 on development events and from 5 to 0 on validation events.

Screenshot of the local dashboard running the bundled synthetic case c03, an updater that executes from Temp, captured before the project was renamed from Aegis-Sec to Kestrix. The rule gains a narrow GoogleUpdate.exe ParentImage exclusion, replayed on the pinned Elasticsearch engine against labeled events. Validation events went from 4 of 4 attacks caught with 5 false alarms to 4 of 4 with none. Synthetic demonstration data, cropped from the full page.

How it works

Recorded terminal session, replayed

Recorded terminal session, replayed: real kestrix-scan 0.1.1 output on the repository's demo project (generated fake token). The captured output is replayed unaltered in a browser page; the workbench, the Claude Code plugin and detection repair are not shown.

  1. Check the version

    kestrix-scan --version prints 0.1.1.

  2. Scan a demo project

    kestrix-scan . reads a small demo project and lists 5 findings: 1 critical, 3 high and 1 medium. The critical one is a generated fake token.

  3. Read the exit status

    The run exits with status 1 because findings reach the fail-on level (high), so a CI job can stop on it.

  4. Scan one file

    kestrix-scan export.py reports 1 high finding, py.os.system (CWE-78), the shell-command rule the plugin hook names.

Problem

Security scanners are usually judged by how much they flag, and people coding with AI assistants get either nothing or a wall of false alarms. Detection rules in a security operations team break quietly when a log field is renamed. I wanted one local, open-source toolkit that catches insecure code as it is written, repairs broken detections with proof, and reports honestly how well each part works.

My contribution

Kestrix is my open-source project, Apache-2.0, released on PyPI as kestrix and kestrix-scan. I designed and built the scanner, the detection-repair engine, the forensics, website and mail checks, the FastAPI dashboard and the Claude Code plugin, and ran every benchmark. The Bitcoin quantum-risk module is adapted from BitShield, a team hackathon project where I co-built that scanner with a teammate.

Approach

kestrix-scan applies 146 deterministic rules across 13 languages plus CI, infrastructure, secrets and lockfiles, and writes SARIF for GitHub code scanning. It needs no runtime dependencies on Python 3.11 and newer. The detection-repair engine parses a Sigma rule, replays the exact query on a pinned Elasticsearch 8.19.3 against labeled events, names the failure family (mapping drift, noise or logic) and tries repairs of at most three edits, abstaining when none passes held-out validation. The Claude Code plugin runs the scanner on each file the agent writes and checks package installs against a local OSV index. File forensics uses real magic-byte typing and the website check inspects TLS and certificates.

How it was built

I built Kestrix in Python as two PyPI packages: kestrix-scan, a dependency-free scanner with 146 rules that writes SARIF, and the kestrix workbench, a FastAPI and React dashboard that adds Sigma detection repair, file forensics, website and mail checks. Detection repair replays each candidate fix on a pinned Elasticsearch before accepting it. A Claude Code plugin runs the scanner on every file the agent writes. Every benchmark is a committed JSON file. Limits: recall is low by design, and the plugin's effect has not been measured.

Evidence and limitations

Scanner results come from committed JSON files in the repository, measured on real CVE fixes with a project-disjoint split and a pre-registered held-out run. On Python, kestrix-scan detected 7.7% of the known vulnerabilities (37 of 482, 95% CI 4.2 to 12.0) at 0.23 false alarms per 1,000 lines, against 10.2% at 0.99 for Bandit. On JavaScript and TypeScript it found 10.3% against 12.4% for ESLint's security rules at 16.9 false alarms per 1,000 lines. It detects less than both and alarms far less, and the per-language tables publish the losses too.

Detection repair, on a locked 54-case test: 0.63 validated success with zero wrong changes. A LoRA fine-tune of Qwen2.5-Coder-7B did not beat that deterministic baseline and was not shipped, and a learned vulnerability ranker was also tested and rejected.

3,973 tests are collected; a full run passes with none failing. Version 0.1.1 was released on 26 Oct 2026.

Limits: low recall is the cost of the low false-alarm rate, the bundled detection-repair cases are synthetic, the hosted mode is a preview, and the plugin's effect on code an agent writes has not been measured yet.

  • 7.7%: known vulnerabilities (37 of 482, 0.23 false alarms per 1,000 lines
  • 10.2%: at 0.99 for Bandit, on Python
  • 0.63: validated success with zero wrong changes, locked 54-case test
  • 3,973: tests are collected, none failing
  • Scope: pre-registered held-out run