Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bastion β€” the guardian that protects the live system

πŸ›‘οΈ Bastion

The guardian that protects the live system. Sibling to Cairn.

License: MIT Made by Mohammed Nasher AI Skill Sibling: Cairn PRs Welcome GitHub stars

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.

Why Bastion is different

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. It's verifiable. Bastion ships with evals that prove it activates correctly, finds planted vulnerabilities, and does not hallucinate ones that aren't there.

The four pillars

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.

Metadata

  • 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

What's inside

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

Install

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/

How to use it

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.

Verify it works

# 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>

Scope & honesty

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.

Contributing

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.

Author & Credits

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.

License

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 ⭐.

About

No description or website provided.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages