Created by Mohammed Nasher Β· Open source (MIT) Β· Free for anyone to use
Bastion is a self-contained security + performance + pentest + monitoring engine for AI coding assistants. You point it at a system and it goes deep β hunting every reachable vulnerability, checking performance and latency, simulating attacks with proof-of-concept, and advising what to watch on the live system.
Cairn builds the path; Bastion guards it. Cairn is the architecture compass that builds and cleans system structure. Bastion is the guardian that walks that structure and defends it. Siblings in one toolkit.
Who built this? Bastion is designed and authored by Mohammed Nasher (@mhd-nasher). Released open source under MIT β use it, fork it, ship with it. If it helps you, a β and a mention go a long way.
Most security tooling fails in one of two ways: it misses the real breach (no stack awareness, shallow checks), or it drowns you in noise (200 theoretical findings, 44 of them false). Bastion refuses both:
- It proves every finding. The Anti-False-Alarm Law: no finding without a reachable path and a concrete, named attack. A pattern match is a lead, not a finding. If it can't prove it, it says "needs manual verification" instead of inflating the count.
- It's stack-aware. It detects your real technology and suppresses the checks that don't fit β no SQL injection on a Firestore app, no CSP nag on a callable-only backend. Signal, not dogma. Firebase / serverless is the flagship profile.
- It's honest about its limits. Bastion never promises "unhackable" or "99% secure" β no tool can. Real security is defense-in-depth + human review + continuous testing. It says so, plainly.
- It's an advisor, not an autopilot. It finds, proves, explains, and proposes the exact fix β the human approves every change. Money/auth/PII code always needs human sign-off, because a wrong fix to a payout or a Security Rule is worse than the bug.
- It's verifiable. Bastion ships with evals that prove it activates correctly, finds planted vulnerabilities, and does not hallucinate ones that aren't there.
| Pillar | What it does |
|---|---|
| 1 β Deep Security Audit | SAST + secrets + authn/z + injection + crypto + config + deps + money-path. Finds and proves reachable vulnerabilities. |
| 2 β Security-Architecture Review | Blast radius & isolation β "if one node falls, does the rest hold?", "is everything separated?" SPOFs, trust boundaries, least privilege. |
| 3 β Performance, Speed & Latency | N+1, missing indexes, cold starts, unbounded queries, denial-of-wallet β same severity model as security. |
| 4 β Penetration Test (+ Monitoring) | Authorized attack simulation: threat model, attack surface, scenarios, PoC payloads. Plus what to log/alert to catch live intrusions. |
- Version: 1.0.0
- Name:
bastion - Author: Mohammed Nasher (@mhd-nasher)
- Tagline: the guardian that protects the live system
- Modes: Guided (beginner) Β· Full Audit Β· Targeted (single pillar) Β· Authorized Pentest
- Stack-aware: Firebase/serverless (flagship) Β· mobile/Flutter Β· web/Next.js Β· backend/monolith Β· microservices Β· CLI/library Β· data/ML
- Citable: every finding maps to a CWE and OWASP (Top 10 / ASVS / MASVS)
- Category: Application security, performance & penetration testing
- Risk: Low (advisory β finds, proves, and proposes; the human approves every change; active exploitation is opt-in and authorized)
- License: MIT
bastion/
βββ SKILL.md # Entry point: identity, Step 0, 4 pillars, top-10, the Anti-False-Alarm Law, honest scope
βββ README.md # This file
βββ LICENSE # MIT
βββ CHANGELOG.md # Version history
βββ CITATION.cff # Citation metadata
βββ CONTRIBUTING.md # How to add checks / profiles / evals (skill-TDD)
βββ reference/
β βββ checks.md # ALL findings: B-SEC/ARCH/PERF/PEN/MON-### + CWE + OWASP + stack note (the backbone)
β βββ checks-plain-language.md # Every check in human words + when it does / doesn't apply
β βββ stack-profiles.md # Per-stack APPLY/SUPPRESS + risk defaults + attack surface (Firebase deepest)
β βββ severity-model.md # Critical/High/Medium/Low via exploitability Γ blast-radius
β βββ anti-false-alarm.md # The judgment layer: prove-it-or-don't-report-it
β βββ threat-modeling.md # STRIDE-lite threat model & attack-surface / trust-boundary mapping
β βββ secure-essentials.md # Secure-by-default playbook, each with "applies when"
β βββ owasp-mapping.md # OWASP Top 10 / ASVS / MASVS cross-reference
β βββ glossary.md # Security vocabulary, defined plainly
βββ workflows/
β βββ deep-security-audit.md # Pillar 1
β βββ security-architecture-review.md # Pillar 2 β blast radius, isolation, SPOF
β βββ performance-and-latency.md # Pillar 3
β βββ penetration-test.md # Pillar 4 β authorized attack simulation + PoC
β βββ live-monitoring.md # What to log/alert to catch intrusions, without leaking secrets
β βββ guided-audit-for-beginners.md # Plain-language guided mode, progress gauges
βββ checklists/
β βββ security-review.md # Tickable, tied to B-SEC ids
β βββ firebase-hardening.md # Rules, App Check, function auth, Stripe webhook/idempotency
β βββ pre-ship-checklist.md # The "before you go live" money/PII gate
βββ templates/
β βββ vulnerability-report.md # Finding: id, severity, evidence/PoC, impact, exact fix, references
β βββ threat-model-template.md # STRIDE-lite threat model
βββ examples/
β βββ firebase-stripe-vulnerable-fixed.md # FLAGSHIP: NasGo-style Cloud Function, vulnerable β fixed, with ids
β βββ insecure-firestore-rules-fixed.md # Before/after Firestore Security Rules
β βββ exposed-secret-remediation.md # The leaked-key scenario, end to end
βββ scripts/
β βββ scan_secrets.py # Deduped secret/pattern scanner (emits LEADS, not findings; self-tested)
βββ evals/
βββ trigger-eval.json # Activation tests (should / shouldn't trigger)
βββ evals.json # Behavior: planted vulns it MUST find + must-NOT-falsely-flag cases
βββ README.md # Skill-TDD (RED Β· GREEN Β· REFACTOR) for security evals
Personal skill (recommended):
# Claude Code
cp -R bastion ~/.claude/skills/Then start a new session. Bastion auto-activates when you discuss finding vulnerabilities, auditing security, encryption/secrets, pentesting, or hardening a system.
Project skill:
mkdir -p .claude/skills && cp -R bastion .claude/skills/Beginner β "I don't know if my app is safe":
"I built a booking app on Firebase. I'm about to let a real company use it. Is it safe?"
Bastion runs Step 0 (detects Firebase, maps the money/auth/PII surface), then the guided mode: a plain-language walkthrough with progress gauges, explaining each risk in human terms and proving the real ones.
Targeted β one pillar:
"Just check my Stripe webhook and Firestore rules β can someone forge a payment or read other users' data?"
Bastion runs the security audit on those surfaces, proves any reachable finding (B-SEC-060, B-SEC-017, β¦), and proposes the exact fix for you to approve.
Authorized pentest:
"Here's my staging project β you have my permission, try to break it."
Bastion builds a threat model, enumerates the attack surface, and walks through exploitation with PoCs β scoped to your environment, on your explicit go-ahead.
# Activation + behavior tests live in evals/. See evals/README.md for the skill-TDD workflow.
python3 -c "import json; json.load(open('bastion/evals/trigger-eval.json')); json.load(open('bastion/evals/evals.json')); print('evals OK')"
# The secret scanner is self-tested (proves it catches real secrets AND downgrades publishable ones):
python3 bastion/scripts/scan_secrets.py --self-test
# Scan a real tree for secret LEADS (verify each before treating it as a finding):
python3 bastion/scripts/scan_secrets.py <path>Bastion produces a security assessment β findings, proof, and proposed fixes. It does not, by itself, make a system "secure" or prove it unbreachable. No tool can. Real security is defense-in-depth + human review + continuous testing. Bastion is stack-aware (a check that doesn't fit your stack is suppressed, with the reason stated), it proves every finding or labels it for manual verification, and it leaves every change β especially to money, auth, and PII code β for a human to approve. Active exploitation is opt-in, scoped, and authorized on your own environment.
Bastion is open source and contributions are welcome. Open an issue or a pull request on the
GitHub repo. Good contributions: new stack profiles, sharper
anti-false-alarm guardrails, more evals (especially must_not_flag cases), new worked examples. See
CONTRIBUTING.md and evals/README.md for the skill-TDD workflow that keeps Bastion trustworthy.
Bastion is created and maintained by Mohammed Nasher.
- π€ Author: Mohammed Nasher
- π GitHub: @mhd-nasher
- π¦ Repository: github.com/mhd-nasher/bastion
- πΏ Sibling project: Cairn β the architecture compass
- π§΅ Sibling project: Loom β the feature-completeness engine (enumerates the abuse surface Bastion rules on)
- π§ Sibling project: Helm β the product-loop engine (routes exploit-shaped anomalies in the data to Bastion)
- π Sibling project: Facet β the interface engine (routes exploitable surfaces to Bastion)
- π¬ Contact / questions / collaboration: open an issue or start a discussion on the repo.
If you use Bastion in a project, a credit back to @mhd-nasher is appreciated.
See CITATION.cff for citation details.
MIT Β© Mohammed Nasher (@mhd-nasher). Free to use, modify, and distribute β keep the copyright and license notice.
Built with intent by Mohammed Nasher π‘οΈ
Cairn builds the path; Bastion guards it. If Bastion helped you ship something safer, drop a β.