Skip to main content
Kekkai/Documentation

Kekkai Documentation

Kekkai is a local-first security CLI that wraps Trivy, Semgrep, and Gitleaks. It normalizes their outputs, provides an interactive terminal UI for triage, and integrates with CI/CD pipelines — without requiring a proprietary rules engine or SaaS account.

Python 3.12+Requires DockerApache-2.0

The Suite

Kekkai is made up of a core scanner orchestrator, an interactive triage TUI, and several opt-in integrations. All core workflows run entirely on your machine.

Installation

Requires Python 3.12+ and Docker. Kekkai uses Docker to run scanners in isolated containers — Docker must be running before scanning.

pipxrecommended

Recommended for local development. Installs in an isolated environment.

$pipx install kekkai-cli
Homebrew

macOS and Linux users who prefer native package managers.

$brew install kademoslabs/tap/kekkai
Scoop

Windows users via the Scoop package manager.

$scoop install kademoslabs/kekkai
pip

Traditional Python environments — manage dependencies manually.

$pip install kekkai-cli
Docker

CI/CD pipelines where no local Python install is available.

$./scripts/kekkai-docker --help

Quick Start

1. Verify dependencies

$kekkai doctor

Checks Docker availability and scanner image accessibility.

2. Scan the current repository

$kekkai scan

Runs Trivy, Semgrep, and Gitleaks. Outputs kekkai-report.json.

3. Review findings interactively

$kekkai triage

Opens the terminal UI. Navigate with j/k, mark false positives with f.


kekkai scan

Run security scanners on a repository. By default, runs Trivy, Semgrep, and Gitleaks in isolated Docker containers and writes a unified kekkai-report.json.

Usage
kekkai scan [OPTIONS]

Core options

--repo PATHPath to repository to scan (default: current directory)
--scanners LISTComma-separated scanners: trivy, semgrep, gitleaks, zap
--output PATHCustom output path for policy result JSON
--run-id IDOverride run ID (alphanumeric with . _ -)
--config PATHPath to config file

CI mode

--ciEnable CI mode: fail on policy violations
--fail-on LEVELSSeverity levels to fail on (e.g. critical,high or medium)

Examples

# Scan current directory
kekkai scan
# Scan specific path
kekkai scan --repo ./my-project
# Run only specific scanners
kekkai scan --scanners trivy,semgrep
# CI mode: fail on critical and high findings
kekkai scan --ci --fail-on critical,high
# Scan and post PR comments
kekkai scan --pr-comment --github-token "$GITHUB_TOKEN"

kekkai triage

Open an interactive terminal UI to review findings, mark false positives, and generate a .kekkaiignore file. All decisions are logged to .kekkai-audit.json for compliance purposes.

--input PATHPath to findings JSON (from kekkai scan output)
--output PATHOutput path for .kekkaiignore (default: .kekkaiignore)

Keyboard controls

j / k or arrow keysNavigate findings up and down
EnterView detailed finding information
cMark as confirmed (valid issue requiring remediation)
fMark as false positive (added to .kekkaiignore)
dDefer finding (tracked for later)
nAdd notes to a finding
Ctrl+OOpen in editor at vulnerable line ($EDITOR)
Ctrl+S / sSave decisions and write .kekkaiignore
qQuit

Severity levels

SeverityDescription
Critical
Immediate action required
High
Should be fixed soon
Medium
Fix when possible
Low
Consider fixing
Info
Informational only

kekkai report

Generate compliance-ready reports from a unified kekkai-report.json. Outputs include HTML, PDF, and compliance matrix formats with executive summaries and framework mappings.

--input PATHPath to kekkai-report.json [required]
--format FORMATOutput format: html, pdf, json, compliance-matrix
--output PATHOutput directory for report files
--project NAMEProject name used in report headers
--frameworks LISTComma-separated frameworks: PCI-DSS, OWASP, HIPAA, SOC2

Examples

# Generate HTML report
kekkai report --input kekkai-report.json --format html --output ./reports
# PDF with framework mapping
kekkai report --input kekkai-report.json --format pdf --frameworks PCI-DSS,OWASP

kekkai fix

Generate AI-powered code patches for findings (experimental). Runs in dry-run mode by default — use --apply to write changes to disk. Backups are created automatically unless disabled.

--input PATHPath to scan results JSON [required]
--repo PATHRepository path (default: current directory)
--dry-runPreview fixes without applying (default: true)
--applyApply fixes to files
--model-mode MODELLM backend: local, ollama, openai, anthropic, gemini, mock
--model-name NAMESpecific model name to use
--api-key KEYAPI key (prefer KEKKAI_FIX_API_KEY env var)
--max-fixes NMaximum fixes per run (default: 10)
--no-backupDisable backup creation when applying

kekkai doctor

Verify that all prerequisites are available: Docker daemon, scanner image accessibility, Python version, and configuration validity. Run this before your first scan.

$kekkai doctor

CI/CD Integration

Kekkai CI mode runs scanners, evaluates severity thresholds, and returns structured exit codes so your pipeline can distinguish scan errors from policy violations. Generate a ready-to-use workflow file with kekkai init --ci.

GitHub Actions

# .github/workflows/security.yml
name: Security Scan
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Kekkai
run: pip install kekkai-cli
- name: Run Security Scan
run: kekkai scan --ci --fail-on critical,high
- name: Upload Results
if: always()
uses: actions/upload-artifact@v4
with:
name: security-results
path: ~/.kekkai/runs/

Pre-commit hook

# .pre-commit-config.yaml
- repo: https://github.com/kademoslabs/kekkai
rev: v2.0.1
hooks:
- id: kekkai-scan

GitHub PR Comments

Post security findings directly as pull request review comments. In GitHub Actions, the PR number and repository are auto-detected from the event payload.

--pr-commentEnable PR comment posting
--github-token TOKENGitHub token (or set GITHUB_TOKEN env var)
--pr-number NUMPR number (auto-detected in GitHub Actions)
--github-repo REPOowner/repo (auto-detected in GitHub Actions)
--max-comments NUMMaximum comments to post (default: 50)
--comment-severity LEVELMinimum severity for comments (default: medium)
# Post PR comments from CI
export GITHUB_TOKEN="ghp_..."
kekkai scan --pr-comment

DefectDojo

Spin up a local DefectDojo vulnerability management dashboard with one command. Credentials are generated automatically and stored in ~/.kekkai/dojo/.env.

# Start DefectDojo
kekkai dojo up --wait --open
# Check status
kekkai dojo status
# Import scan results
kekkai scan --import-dojo
# Start on custom port
kekkai dojo up --port 9000 --wait
# Stop and clean up
kekkai dojo down

dojo up options

--port PORTHTTP port for the UI (default: 8080)
--tls-port PORTHTTPS port (default: 8443)
--waitWait for UI readiness before returning
--openOpen the UI in a browser after starting
--project-name NAMEDocker Compose project name

ThreatFlow

Generate STRIDE-aligned threat models from your codebase using a local or remote LLM. With Ollama (recommended), your code never leaves your machine. Remote providers (OpenAI, Anthropic, Gemini) are explicitly opt-in.

With Ollama (recommended)

# 1. Install Ollama and pull a model
curl -fsSL https://ollama.com/install.sh | sh
ollama pull mistral
# 2. Run ThreatFlow
kekkai threatflow --repo . --model-mode ollama --model-name mistral

All options

--repo PATHPath to repository to analyze
--output-dir PATHOutput directory for artifacts
--model-mode MODElocal (default), ollama, openai, anthropic, gemini, mock
--model-name NAMEModel name (e.g. mistral, gpt-4o, claude-3-5-sonnet)
--api-key KEYAPI key for remote provider (prefer env var)
--max-files NUMMaximum files to analyze (default: 500)
--timeout SECSTimeout for model calls (default: 300)
--no-redactDisable secret redaction (NOT RECOMMENDED)

Output artifacts

THREATS.mdIdentified threats with STRIDE categorization
DATAFLOWS.mdData flow diagram description
ASSUMPTIONS.mdAnalysis assumptions and limitations
threat-model.jsonMachine-readable threat model

DAST with OWASP ZAP

Run a baseline DAST scan against a running HTTP service. On Linux, 127.0.0.1 and localhost targets are rewritten to host.docker.internal automatically so the container can reach your application.

# Scan a locally running service
kekkai scan --scanners zap \
--target-url 'http://127.0.0.1:5000' \
--allow-private-ips
Note: --allow-private-ips is required for scanning localhost or internal IPs. Do not use this flag against production or external systems without authorization.

Configuration

Kekkai loads configuration in this order (later sources override earlier):

  1. Built-in defaults
  2. Config file: ~/.config/kekkai/config.toml (Linux/macOS) or %APPDATA%\kekkai\config.toml (Windows)
  3. Environment variables with KEKKAI_ prefix
  4. CLI flags

Minimal config.toml

# ~/.config/kekkai/config.toml
repo_path = "."
run_base_dir = "~/.kekkai/runs"
timeout_seconds = 900
env_allowlist = ["PATH", "HOME", "USER", "SHELL", "LANG"]

Full configuration reference

repo_path = "."
run_base_dir = "~/.kekkai/runs"
timeout_seconds = 900
env_allowlist = ["PATH", "HOME", "USER", "SHELL", "LANG"]
scanners = ["trivy", "semgrep", "gitleaks"]
[dojo]
enabled = false
base_url = "http://localhost:8080"
api_key = "" # Use KEKKAI_DOJO_API_KEY instead
[zap]
enabled = false
target_url = ""
allow_private_ips = false

Environment Variables

KEKKAI_REPO_PATHDefault repository path
KEKKAI_RUN_BASE_DIRBase directory for run outputs
KEKKAI_TIMEOUT_SECONDSScanner timeout in seconds
KEKKAI_DOJO_URLDefectDojo base URL
KEKKAI_DOJO_API_KEYDefectDojo API key
KEKKAI_DOJO_PORTDefectDojo HTTP port
KEKKAI_ZAP_TARGET_URLZAP target URL
KEKKAI_ENABLE_FALCOEnable Falco runtime security (1 to enable)
KEKKAI_THREATFLOW_MODEThreatFlow model mode
KEKKAI_THREATFLOW_API_KEYThreatFlow API key
KEKKAI_THREATFLOW_MODEL_NAMEThreatFlow model name
KEKKAI_FIX_API_KEYAPI key for fix engine LLM
GITHUB_TOKENGitHub token for PR comments
GITHUB_REPOSITORYGitHub repository (auto-detected in Actions)

Exit Codes

0Success — all checks passed
1General error or policy passed with warnings
2Policy violation — findings exceed configured thresholds
3Scan error — scanner failed to execute

Ignore File Format

The .kekkaiignore file is generated by the triage TUI when you mark findings as false positives. It is read automatically by kekkai scan from the repository root.

# Kekkai Ignore File
# Generated by kekkai triage
# Pattern format: <scanner>:<rule_id>:<file_path>
# False positive: intentional test vulnerability
semgrep:python.lang.security.audit.dangerous-system-call:tests/test_app.py
# CVE not applicable: internal-only endpoint
trivy:CVE-2023-12345:requirements.txt

Commit .kekkaiignore to your repository to share triage decisions with your team. Re-triage periodically when dependencies update.


Support