bastion-scan 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ABS Astreon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,230 @@
1
+ <p align="center">
2
+ <strong>BASTION</strong><br/>
3
+ <em>Security scanner for web projects. Runs locally. Explains what it finds.</em>
4
+ </p>
5
+
6
+ <p align="center">
7
+ <img alt="Build" src="https://img.shields.io/github/actions/workflow/status/absastreon/bastion/ci.yml?branch=main&style=flat-square" />
8
+ <img alt="Tests" src="https://img.shields.io/badge/tests-783%20passing-brightgreen?style=flat-square" />
9
+ <img alt="License" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" />
10
+ <img alt="npm" src="https://img.shields.io/npm/v/@bastion/cli?style=flat-square" />
11
+ </p>
12
+
13
+ ---
14
+
15
+ ## What is this
16
+
17
+ Bastion scans your code for security issues and tells you how to fix them. It runs on your machine, never uploads your code, and works with any Node.js project.
18
+
19
+ AI tools help you build fast, but they regularly ship hardcoded secrets, missing headers, and injection vectors. Enterprise scanners cost £300+/mo and drown you in jargon. Bastion is the middle ground: it catches the stuff that actually matters and explains it in plain English.
20
+
21
+ Every finding comes with a prompt you can paste into Claude, ChatGPT, or Copilot to get a fix tailored to your stack.
22
+
23
+ ---
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # Install globally
29
+ npm install -g @bastion/cli
30
+
31
+ # Scan your project
32
+ npx bastion scan
33
+
34
+ # Scan a live URL (headers, SSL, security.txt)
35
+ npx bastion scan --url https://yourapp.com
36
+
37
+ # JSON output for CI/CD
38
+ npx bastion scan --format json
39
+
40
+ # Generate security configs for your stack
41
+ npx bastion scan --generate-configs
42
+ ```
43
+
44
+ ---
45
+
46
+ ## What it checks
47
+
48
+ | Check | What it does |
49
+ |-------|-------------|
50
+ | `.gitignore` coverage | Makes sure `.env`, `node_modules`, and keys are excluded |
51
+ | Hardcoded secrets | Looks for API keys from OpenAI, Stripe, AWS, and others |
52
+ | Dependency audit | Wraps `npm audit` and maps findings to severity levels |
53
+ | `.env.example` | Checks that a template exists with safe placeholder values |
54
+ | `security.txt` | Validates RFC 9116 Contact + Expires fields |
55
+ | Security headers | CSP, HSTS, X-Frame-Options, Referrer-Policy, and more |
56
+ | SSL/TLS | HTTPS redirect, cert validity, TLS version |
57
+ | Insecure code patterns | `eval()`, `innerHTML`, SQL concatenation, `exec()` |
58
+ | CORS config | Catches `Allow-Origin: *`, bare `cors()`, credential leaks |
59
+ | Rate limiting | Looks for `express-rate-limit`, `@upstash/ratelimit`, etc. |
60
+ | Auth method | Flags hand-rolled auth, suggests Clerk/Supabase/NextAuth |
61
+ | `security.txt` URL | Fetches and validates the remote file |
62
+
63
+ ### Stack detection
64
+
65
+ Bastion figures out what you're running. It detects **Next.js, Express, Fastify, Remix, Astro, Nuxt, SvelteKit, Hono**, plus databases, auth providers, hosting, and package managers. AI prompts and config suggestions are tailored to your stack.
66
+
67
+ ### Output formats
68
+
69
+ Three options: **terminal** (colour-coded, score ring, verbose mode), **JSON** (for CI/CD), and **markdown** (writes a `security-report.md`).
70
+
71
+ ### Config generators
72
+
73
+ Bastion can output ready-to-paste configs for your stack:
74
+
75
+ - `helmet.js` setup for Express/Fastify
76
+ - CORS policy
77
+ - Rate limiter middleware
78
+ - Next.js security headers
79
+ - `.gitignore` additions
80
+
81
+ ### security.txt generator
82
+
83
+ Interactive CLI that walks you through creating a valid RFC 9116 `security.txt`:
84
+
85
+ ```bash
86
+ npx bastion generate security-txt
87
+ ```
88
+
89
+ ---
90
+
91
+ ## CLI Usage
92
+
93
+ ```
94
+ bastion scan [options]
95
+
96
+ Options:
97
+ -p, --path <dir> Project path (default: current directory)
98
+ -f, --format <type> Output format: terminal, json, markdown
99
+ -u, --url <url> Live URL to scan (headers, SSL, security.txt)
100
+ -v, --verbose Show fix instructions and AI prompts
101
+ --generate-configs Print security config snippets for your stack
102
+ --output-dir <dir> Write config files to directory
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Web App
108
+
109
+ The web dashboard lives at [bastion.wiki](https://bastion.wiki).
110
+
111
+ - **Security Checklist** with 20 interactive items and fix panels
112
+ - **OWASP 2025** guide, all 10 categories in plain language
113
+ - **URL Scanner** for quick header/SSL/security.txt checks
114
+ - **Vulnerability Feed** with current threats and AI coding risks
115
+ - **Tool Recommendations**, 14 curated tools with pricing info
116
+ - **Stack Checklists** generated for your framework + database + auth combo
117
+ - **Deploy Gate** that runs checks and gives a go/no-go verdict
118
+ - **Security Badge** you can embed in your README
119
+
120
+ ---
121
+
122
+ ## Pricing
123
+
124
+ | | Free | Pro | Team |
125
+ |---|---|---|---|
126
+ | **Price** | £0 | £4/mo or £39/yr | £15/mo or £119/yr |
127
+ | CLI checks | 5 | All 12 | All 12 |
128
+ | URL scans | 1/day | Unlimited | Unlimited |
129
+ | AI prompts | 3/scan | Unlimited | Unlimited |
130
+ | Config generators | | Yes | Yes |
131
+ | Security badge | | Yes | Yes |
132
+ | GitHub Action | | Public repos | All repos |
133
+ | Projects | 1 | 3 | Unlimited |
134
+ | Compliance reports | | | Yes |
135
+ | CVE alerts | | | Yes |
136
+ | Score history | | | Yes |
137
+
138
+ Annual plans save 2 months. All plans come with a 14-day free trial.
139
+
140
+ ---
141
+
142
+ ## Security Badge
143
+
144
+ Drop this in your README to show your score:
145
+
146
+ ```markdown
147
+ ![Bastion Score](https://bastion.wiki/api/badge/85)
148
+ ```
149
+
150
+ The shield is green at 80+, yellow at 50+, red below 50. It updates when you re-scan.
151
+
152
+ ---
153
+
154
+ ## GitHub Action
155
+
156
+ Add this to your CI and Bastion will scan every PR:
157
+
158
+ ```yaml
159
+ name: Security Scan
160
+ on: [pull_request]
161
+
162
+ jobs:
163
+ bastion:
164
+ runs-on: ubuntu-latest
165
+ steps:
166
+ - uses: actions/checkout@v4
167
+ - uses: absastreon/bastion-action@v1
168
+ with:
169
+ path: '.'
170
+ fail-on: 'critical' # Block PRs with critical findings
171
+ format: 'markdown' # Comment results on PR
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Scoring
177
+
178
+ You start at **100**. Points come off by severity:
179
+
180
+ | Severity | Deduction |
181
+ |----------|-----------|
182
+ | Critical | -15 |
183
+ | High | -10 |
184
+ | Medium | -5 |
185
+ | Low | -2 |
186
+
187
+ Floor is 0. Only `fail` results deduct. `warn`, `skip`, and `pass` don't affect the score.
188
+
189
+ ---
190
+
191
+ ## Project Structure
192
+
193
+ ```
194
+ bastion/
195
+ ├── packages/
196
+ │ ├── cli/ # npx bastion scan, 12 checks, 3 reporters
197
+ │ ├── shared/ # Types, checklist data, OWASP data, tools
198
+ │ └── web/ # Next.js 14 dashboard
199
+ └── docs/playbooks/ # Stack-specific security guides
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Contributing
205
+
206
+ PRs are welcome.
207
+
208
+ 1. Fork the repo
209
+ 2. Create a feature branch (`git checkout -b feature/amazing-check`)
210
+ 3. Write tests (Vitest, 80%+ coverage required)
211
+ 4. Run `npm run build && npm run lint && npm run test`
212
+ 5. Open a PR against `main`
213
+
214
+ See [SECURITY.md](SECURITY.md) for vulnerability reporting.
215
+
216
+ ---
217
+
218
+ ## License
219
+
220
+ MIT. See [LICENSE](LICENSE).
221
+
222
+ ---
223
+
224
+ ## Links
225
+
226
+ - [Web Dashboard](https://bastion.wiki)
227
+ - [CLI Docs](https://bastion.wiki/docs)
228
+ - [Stack Playbooks](docs/playbooks/)
229
+ - [OWASP Top 10 2025](https://owasp.org/Top10/2025/)
230
+ - [Report a Bug](https://github.com/absastreon/bastion/issues)
@@ -0,0 +1,2 @@
1
+
2
+ export { }