safefix 0.0.0-stage → 0.1.1
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 +21 -0
- package/README.md +143 -2
- package/dist/index.js +11418 -0
- package/package.json +50 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Montassar (SafeFix)
|
|
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
CHANGED
|
@@ -1,3 +1,144 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SafeFix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Find and fix security holes in apps built with AI tools like Lovable, Bolt, Cursor and Replit.
|
|
4
|
+
|
|
5
|
+
SafeFix checks your project folder and your Supabase database. It explains each problem in
|
|
6
|
+
plain English and gives you a fix: ready-to-run SQL or code when it is safe to write one.
|
|
7
|
+
|
|
8
|
+
- **Database:** tables without Row Level Security, rules that let everyone in, risky functions
|
|
9
|
+
and views, public storage buckets.
|
|
10
|
+
- **Leaked keys:** secret keys in your code, in your website bundle, or in `.env` files saved in git.
|
|
11
|
+
- **App config, Docker, GitHub Actions:** open CORS, weak JWT secrets, debug mode, containers
|
|
12
|
+
that run as root, actions that are not pinned, and more.
|
|
13
|
+
|
|
14
|
+
Needs Node.js 22.12 or newer. Full docs: <https://safefix.dev/docs>
|
|
15
|
+
|
|
16
|
+
## Scan your project
|
|
17
|
+
|
|
18
|
+
In your project folder:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx safefix scan
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
To check your Supabase database too, put its connection string in an environment variable
|
|
25
|
+
first (Supabase Dashboard > Connect > Session pooler). Then the password stays out of your
|
|
26
|
+
shell history:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
# macOS / Linux
|
|
30
|
+
export SAFEFIX_DB_URL="postgresql://postgres.<project-ref>:<password>@<host>:5432/postgres"
|
|
31
|
+
npx safefix scan --path .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```powershell
|
|
35
|
+
# Windows PowerShell
|
|
36
|
+
$env:SAFEFIX_DB_URL = "postgresql://postgres.<project-ref>:<password>@<host>:5432/postgres"
|
|
37
|
+
npx safefix scan --path .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Let your AI tool fix it
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npx safefix scan --ai --output fix-prompt.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Paste `fix-prompt.md` into Cursor, Claude Code, Lovable or Bolt. The prompt lists every
|
|
47
|
+
problem with its fix, and rules for the AI: fix the most serious first, never turn off Row
|
|
48
|
+
Level Security or delete data, never print secrets. Then scan again to prove it worked.
|
|
49
|
+
|
|
50
|
+
## Use SafeFix inside your AI tool (MCP)
|
|
51
|
+
|
|
52
|
+
SafeFix is also an MCP server. Your AI tool starts it for you; then just ask
|
|
53
|
+
**"Is my app secure?"**
|
|
54
|
+
|
|
55
|
+
**Claude Code**
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
claude mcp add safefix -- npx -y safefix mcp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Cursor** (`.cursor/mcp.json`) and **Windsurf** (its `mcp_config.json`)
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"safefix": { "command": "npx", "args": ["-y", "safefix", "mcp"] }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**VS Code** (`.vscode/mcp.json`)
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"servers": {
|
|
76
|
+
"safefix": { "type": "stdio", "command": "npx", "args": ["-y", "safefix", "mcp"] }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Tool | What it does |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `safefix_scan` | Scans the open workspace: grade, score, counts and findings (in pages). |
|
|
84
|
+
| `safefix_explain` | One finding: why it matters, step-by-step fix, SQL or code. |
|
|
85
|
+
| `safefix_verify` | Scans again and says which problems are fixed, still open or new. |
|
|
86
|
+
| `safefix_upload` | Sends the last scan to your dashboard. Only when `SAFEFIX_TOKEN` is set. |
|
|
87
|
+
|
|
88
|
+
The `fix_all` prompt walks your AI tool through fixing everything safely.
|
|
89
|
+
|
|
90
|
+
- The server only scans inside your workspace, never your home folder or a whole disk. If your
|
|
91
|
+
AI tool starts it somewhere else, add `"--root", "/path/to/your/project"` to the args.
|
|
92
|
+
- It checks your database only when `SAFEFIX_DB_URL` is in the server's `env` in that config.
|
|
93
|
+
Never paste a connection string into the chat.
|
|
94
|
+
- On Windows, if your AI tool cannot start `npx`, use `"command": "cmd"` and
|
|
95
|
+
`"args": ["/c", "npx", "-y", "safefix", "mcp"]`.
|
|
96
|
+
|
|
97
|
+
## Scan on every push (GitHub Actions)
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
npx safefix ci init
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This writes `.github/workflows/safefix.yml`: a scan on every push, pull request and night,
|
|
104
|
+
with a read-only token and actions pinned to commit SHAs. Add `--sarif` to also show the
|
|
105
|
+
findings in GitHub's Security tab. Then save your dashboard token as a secret:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
gh secret set SAFEFIX_TOKEN
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Commands
|
|
112
|
+
|
|
113
|
+
| Command | What it does |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `safefix scan` | Scan. Main options: `--path <dir>`, `--fail-on <severity>`, `--only <ids>`, `--format pretty\|json\|markdown\|sarif`, `--output <file>`, `--ai`, `--upload`. |
|
|
116
|
+
| `safefix checks` | List every check. |
|
|
117
|
+
| `safefix mcp` | Run the MCP server (stdio). |
|
|
118
|
+
| `safefix ci init` | Write the GitHub Actions workflow. `--sarif`, `--force`. |
|
|
119
|
+
|
|
120
|
+
Run `safefix <command> --help` for every option.
|
|
121
|
+
|
|
122
|
+
**Exit codes:** 0 no problems at or above `--fail-on` (default `high`), 1 problems found,
|
|
123
|
+
2 wrong options or the scan could not run, 3 the scan is incomplete (a check did not finish).
|
|
124
|
+
|
|
125
|
+
## Privacy and safety
|
|
126
|
+
|
|
127
|
+
- **Read-only.** Every database query runs in a read-only transaction that is rolled back.
|
|
128
|
+
SafeFix never changes your data or your files.
|
|
129
|
+
- **Nothing leaves your computer** unless you use `--upload` (or `safefix_upload`, which only
|
|
130
|
+
exists when you set `SAFEFIX_TOKEN`). SafeFix talks only to your own database.
|
|
131
|
+
- **Secrets stay secret.** Reports show keys masked, like `eyJh********abcd`, and never your
|
|
132
|
+
database password.
|
|
133
|
+
- **Fixes are suggestions.** SafeFix never applies a fix by itself.
|
|
134
|
+
- **Your projects only.** Scan projects you own or are allowed to test.
|
|
135
|
+
|
|
136
|
+
## Dashboard
|
|
137
|
+
|
|
138
|
+
Local scans are free and unlimited. To keep a history, get alerts and share reports with your
|
|
139
|
+
team, upload your scans to <https://safefix.dev> with `--upload` and a `SAFEFIX_TOKEN`.
|
|
140
|
+
Set `SAFEFIX_NO_PROMO=1` to hide the one-line reminder at the end of a scan.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT. See [LICENSE](LICENSE). The SafeFix dashboard at safefix.dev is a separate, paid service.
|