decaloguex 0.3.0__tar.gz
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.
- decaloguex-0.3.0/LICENSE +21 -0
- decaloguex-0.3.0/PKG-INFO +452 -0
- decaloguex-0.3.0/README.md +418 -0
- decaloguex-0.3.0/decaloguex/__init__.py +16 -0
- decaloguex-0.3.0/decaloguex/__main__.py +12 -0
- decaloguex-0.3.0/decaloguex/blindspots.py +123 -0
- decaloguex-0.3.0/decaloguex/cli.py +405 -0
- decaloguex-0.3.0/decaloguex/engine.py +584 -0
- decaloguex-0.3.0/decaloguex/explain.py +328 -0
- decaloguex-0.3.0/decaloguex/languages.py +358 -0
- decaloguex-0.3.0/decaloguex/models.py +99 -0
- decaloguex-0.3.0/decaloguex/project.py +384 -0
- decaloguex-0.3.0/decaloguex/rules/__init__.py +29 -0
- decaloguex-0.3.0/decaloguex/rules/appsec.py +347 -0
- decaloguex-0.3.0/decaloguex/rules/async_.py +605 -0
- decaloguex-0.3.0/decaloguex/rules/auth.py +293 -0
- decaloguex-0.3.0/decaloguex/rules/common.py +134 -0
- decaloguex-0.3.0/decaloguex/rules/config_files.py +159 -0
- decaloguex-0.3.0/decaloguex/rules/errors.py +641 -0
- decaloguex-0.3.0/decaloguex/rules/fallbacks.py +229 -0
- decaloguex-0.3.0/decaloguex/rules/gitignore.py +371 -0
- decaloguex-0.3.0/decaloguex/rules/injection.py +452 -0
- decaloguex-0.3.0/decaloguex/rules/launch.py +288 -0
- decaloguex-0.3.0/decaloguex/rules/other_languages.py +1629 -0
- decaloguex-0.3.0/decaloguex/rules/secrets.py +632 -0
- decaloguex-0.3.0/decaloguex/rules/sql.py +1052 -0
- decaloguex-0.3.0/decaloguex/rules/supabase.py +109 -0
- decaloguex-0.3.0/decaloguex/rules/web.py +643 -0
- decaloguex-0.3.0/decaloguex/scenes.py +341 -0
- decaloguex-0.3.0/decaloguex/telemetry.py +366 -0
- decaloguex-0.3.0/decaloguex/ui.py +798 -0
- decaloguex-0.3.0/decaloguex/undo.py +185 -0
- decaloguex-0.3.0/decaloguex.egg-info/PKG-INFO +452 -0
- decaloguex-0.3.0/decaloguex.egg-info/SOURCES.txt +60 -0
- decaloguex-0.3.0/decaloguex.egg-info/dependency_links.txt +1 -0
- decaloguex-0.3.0/decaloguex.egg-info/entry_points.txt +2 -0
- decaloguex-0.3.0/decaloguex.egg-info/requires.txt +15 -0
- decaloguex-0.3.0/decaloguex.egg-info/top_level.txt +1 -0
- decaloguex-0.3.0/pyproject.toml +75 -0
- decaloguex-0.3.0/setup.cfg +4 -0
- decaloguex-0.3.0/setup.py +27 -0
- decaloguex-0.3.0/tests/test_ai_apps.py +207 -0
- decaloguex-0.3.0/tests/test_appsec.py +249 -0
- decaloguex-0.3.0/tests/test_async.py +204 -0
- decaloguex-0.3.0/tests/test_auth.py +213 -0
- decaloguex-0.3.0/tests/test_builds.py +376 -0
- decaloguex-0.3.0/tests/test_cli.py +218 -0
- decaloguex-0.3.0/tests/test_engine.py +40 -0
- decaloguex-0.3.0/tests/test_errors.py +189 -0
- decaloguex-0.3.0/tests/test_fallbacks.py +130 -0
- decaloguex-0.3.0/tests/test_false_alarms.py +484 -0
- decaloguex-0.3.0/tests/test_gitignore.py +147 -0
- decaloguex-0.3.0/tests/test_injection.py +274 -0
- decaloguex-0.3.0/tests/test_launch.py +193 -0
- decaloguex-0.3.0/tests/test_other_languages.py +219 -0
- decaloguex-0.3.0/tests/test_real_projects.py +271 -0
- decaloguex-0.3.0/tests/test_review.py +515 -0
- decaloguex-0.3.0/tests/test_safety_features.py +272 -0
- decaloguex-0.3.0/tests/test_scenes.py +50 -0
- decaloguex-0.3.0/tests/test_secrets.py +138 -0
- decaloguex-0.3.0/tests/test_sql.py +220 -0
- decaloguex-0.3.0/tests/test_web.py +187 -0
decaloguex-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 christiangemayell
|
|
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.
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: decaloguex
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Crash Doctor: finds and fixes the security and crash bugs AI coding tools leave behind.
|
|
5
|
+
Author: christiangemayell
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/christiangemayell/decaloguex
|
|
8
|
+
Project-URL: Issues, https://github.com/christiangemayell/decaloguex/issues
|
|
9
|
+
Keywords: security,linter,ai,vibe-coding,sql-injection,secrets,code-fixer
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: tree-sitter>=0.23
|
|
20
|
+
Requires-Dist: tree-sitter-javascript>=0.23
|
|
21
|
+
Requires-Dist: tree-sitter-typescript>=0.23
|
|
22
|
+
Requires-Dist: tree-sitter-python>=0.23
|
|
23
|
+
Requires-Dist: tree-sitter-php>=0.23
|
|
24
|
+
Requires-Dist: tree-sitter-java>=0.23
|
|
25
|
+
Requires-Dist: tree-sitter-c-sharp>=0.23
|
|
26
|
+
Requires-Dist: tree-sitter-go>=0.23
|
|
27
|
+
Requires-Dist: tree-sitter-ruby>=0.23
|
|
28
|
+
Requires-Dist: tree-sitter-kotlin>=1.0
|
|
29
|
+
Requires-Dist: tree-sitter-swift>=0.7
|
|
30
|
+
Requires-Dist: certifi>=2024.2.2
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/christiangemayell/decaloguex/main/assets/logo.jpg" alt="DecalogueX logo: an ice-blue ten-point star" width="180">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
# DecalogueX: Crash Doctor
|
|
40
|
+
|
|
41
|
+
**DecalogueX finds and fixes the mistakes AI coding tools often make.**
|
|
42
|
+
|
|
43
|
+
You point it at a project. It reads the code, explains every problem in
|
|
44
|
+
plain words, and asks whether you want them fixed. Say yes, and it fixes
|
|
45
|
+
them for you. Change your mind, and `decaloguex undo` puts everything back.
|
|
46
|
+
|
|
47
|
+
It checks **JavaScript, TypeScript, Python, PHP, Java, C#, Go, Ruby, Kotlin,
|
|
48
|
+
Swift, HTML, Vue and Svelte**, plus settings files like `.yml` and `.json`.
|
|
49
|
+
|
|
50
|
+
It's open source (MIT licence), and this is a **free early-access version**:
|
|
51
|
+
a full version is coming soon.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Install (2 minutes)
|
|
56
|
+
|
|
57
|
+
**1. Get Python** (skip this if you already have it)
|
|
58
|
+
|
|
59
|
+
Download it from [python.org/downloads](https://www.python.org/downloads/)
|
|
60
|
+
and run the installer. **On Windows, tick "Add python.exe to PATH"** on the
|
|
61
|
+
first screen. That one tick saves most install problems.
|
|
62
|
+
|
|
63
|
+
**2. Install DecalogueX**
|
|
64
|
+
|
|
65
|
+
Open a terminal (on Windows: press the Start key, type **Terminal**, press
|
|
66
|
+
Enter) and type:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
pip install decaloguex
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
That's it. Check it worked:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
decaloguex --version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
> **"decaloguex is not recognized"?** Use `python -m decaloguex` instead of
|
|
79
|
+
> `decaloguex` in every command below. It does exactly the same thing.
|
|
80
|
+
>
|
|
81
|
+
> **Trying an early version before it's released?** Install it from GitHub instead:
|
|
82
|
+
> `pip install git+https://github.com/christiangemayell/decaloguex`
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Check your project (3 steps)
|
|
87
|
+
|
|
88
|
+
**1. Open a terminal in your project's folder.** In VS Code or Cursor: menu
|
|
89
|
+
**Terminal → New Terminal**. It opens in your project's folder.
|
|
90
|
+
|
|
91
|
+
**2. Scan it:**
|
|
92
|
+
```
|
|
93
|
+
decaloguex scan .
|
|
94
|
+
```
|
|
95
|
+
(The `.` means "this folder".)
|
|
96
|
+
|
|
97
|
+
**3. Choose what to do.** DecalogueX explains every problem in plain words,
|
|
98
|
+
then asks:
|
|
99
|
+
|
|
100
|
+
- **A**: fix everything
|
|
101
|
+
- **O**: go through them one by one, answering yes or no for each
|
|
102
|
+
- **N**: change nothing
|
|
103
|
+
|
|
104
|
+
Changed your mind? `decaloguex undo` puts everything back.
|
|
105
|
+
|
|
106
|
+
When nothing is left to fix, you get the **DecalogueX approval stamp**.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Use it inside your AI coding tool
|
|
111
|
+
|
|
112
|
+
DecalogueX comes as an **Agent Skill**, so your AI assistant can run it
|
|
113
|
+
after it writes code.
|
|
114
|
+
|
|
115
|
+
- **Claude Code:** run these in your terminal
|
|
116
|
+
```
|
|
117
|
+
claude plugin marketplace add christiangemayell/decaloguex
|
|
118
|
+
claude plugin install decaloguex@decaloguex
|
|
119
|
+
```
|
|
120
|
+
- **Cursor, Codex and other tools that support Agent Skills:** copy the
|
|
121
|
+
`skills/decaloguex` folder into your project's `.agents/skills/` folder
|
|
122
|
+
(or `.cursor/skills/` or `.claude/skills/`).
|
|
123
|
+
- **Any other AI tool:** add this line to your project's `AGENTS.md` file:
|
|
124
|
+
```
|
|
125
|
+
After changing code, run `decaloguex scan . --json` and fix what it reports.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> **Use Node.js?** `npx decaloguex scan .` also works, but it still needs
|
|
129
|
+
> Python installed (step 1 above), because DecalogueX is written in Python.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Try it on a practice app
|
|
134
|
+
|
|
135
|
+
Want to see it in action first? Download this project, open a terminal in
|
|
136
|
+
its folder, and run:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
python scripts/make_demo.py
|
|
140
|
+
decaloguex scan demo
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`make_demo.py` builds a small app full of mistakes. Type `A` to fix them all,
|
|
144
|
+
then run `decaloguex scan demo` again to see the approval stamp. Run
|
|
145
|
+
`make_demo.py` again any time for a fresh broken app. Add `--manual` to also
|
|
146
|
+
see a problem only a person can fix (a **"What to do"** card).
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## What it fixes
|
|
151
|
+
|
|
152
|
+
| Problem | Why it's bad | What DecalogueX does |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| **Passwords and API keys written in the code** | Anyone who sees the code can steal them. Bots search GitHub for them all day. | Moves them into a private `.env` file |
|
|
155
|
+
| **Secret files not hidden from Git** | `.env` can get uploaded to GitHub by accident | Adds them to `.gitignore` |
|
|
156
|
+
| **SQL injection** (user input glued into database queries) | A hacker can type database commands into a form and read or delete your data | Rewrites the query the safe way |
|
|
157
|
+
| **Error details shown to visitors** | Error messages can reveal file paths, database details and personal information | Shows visitors a friendly message and keeps the real error private |
|
|
158
|
+
| **Async code with no safety net** | One failed database call can crash the whole server, or a job silently never runs | Adds the missing error handling |
|
|
159
|
+
| **Debug mode left on** | Debug pages show hackers your code, settings and sometimes a live console | Turns it off for the public, keeps it on for you (Django, Flask) |
|
|
160
|
+
| **Raw HTML put into a page** (XSS) | A hacker's text can run as code in your visitors' browsers and steal their logins | Escapes it (PHP `echo`), or tells you how |
|
|
161
|
+
| **Any website allowed to call your server** (CORS `*`) | Other websites can use your visitors' logins against your server | Tells you how to allow only your own site |
|
|
162
|
+
| **Security certificate check switched off** | Anyone on the same Wi-Fi can read and change the data you send | Tells you how to turn it back on |
|
|
163
|
+
| **Whole form saved without picking fields** | A visitor can add `"isAdmin": true` to a form and make themselves admin | Tells you how to save only the fields you expect |
|
|
164
|
+
|
|
165
|
+
**It never guesses.** If it can't be sure a fix is safe, it changes nothing
|
|
166
|
+
and tells you exactly what to do yourself, in a **"What to do"** card.
|
|
167
|
+
|
|
168
|
+
**It's honest about what it can't check.** Files in languages it can't read
|
|
169
|
+
yet are listed under **BLIND SPOTS** at the end of every scan, and saved in
|
|
170
|
+
`.decaloguex/blind-spots.json`.
|
|
171
|
+
|
|
172
|
+
### What it fixes in each language
|
|
173
|
+
|
|
174
|
+
| | Secrets | SQL injection | Error leaks | Crash risks |
|
|
175
|
+
|---|---|---|---|---|
|
|
176
|
+
| JavaScript / TypeScript | ✔ fixed | ✔ fixed | ✔ fixed | ✔ fixed |
|
|
177
|
+
| Python | ✔ fixed | ✔ fixed | ✔ fixed | ✔ fixed |
|
|
178
|
+
| PHP | ✔ fixed | ✔ fixed (PDO) | ✔ fixed | not needed |
|
|
179
|
+
| Go | ✔ fixed | ✔ fixed | ✔ fixed | ✔ fixed |
|
|
180
|
+
| Ruby | ✔ fixed | ✔ fixed (ActiveRecord) | ✔ fixed | not needed |
|
|
181
|
+
| C# | ✔ fixed | ✔ fixed (EF Core, Dapper) | ✔ fixed | ✔ fixed |
|
|
182
|
+
| Java | ✔ fixed | ✔ fixed (JdbcTemplate) | ✔ fixed | ✔ fixed |
|
|
183
|
+
| Kotlin | ✔ fixed | ✔ fixed (JdbcTemplate) | ✔ fixed | ✔ fixed |
|
|
184
|
+
| Swift | ✔ fixed | instructions | ✔ fixed | ✔ fixed |
|
|
185
|
+
| HTML / Vue / Svelte | instructions* | ✔ fixed | n/a | ✔ fixed |
|
|
186
|
+
| Settings files (.yml, .json...) and scripts (.sh, .ps1...) | instructions | n/a | n/a | n/a |
|
|
187
|
+
|
|
188
|
+
Razor (`.cshtml`, `.razor`) and ERB (`.erb`) pages are checked like HTML.
|
|
189
|
+
Test, example and fixture files are only checked for real-looking keys, and
|
|
190
|
+
never changed. Generated and minified files are skipped. Both are listed
|
|
191
|
+
under BLIND SPOTS.
|
|
192
|
+
|
|
193
|
+
**Every fix is build-tested.** `tests/test_builds.py` lets DecalogueX fix a
|
|
194
|
+
broken program in each language, then builds it with the real Go, PHP,
|
|
195
|
+
Ruby, Java, C#, Kotlin and Swift tools. If a language's tool isn't installed,
|
|
196
|
+
that test is skipped.
|
|
197
|
+
|
|
198
|
+
\* A key in a web page runs in the visitor's browser, so `.env` can't hide it.
|
|
199
|
+
DecalogueX explains how to move it to your server instead. The same goes for
|
|
200
|
+
browser-only React, Vue and Svelte apps.
|
|
201
|
+
|
|
202
|
+
### Secrets are only moved if your app loads `.env`
|
|
203
|
+
|
|
204
|
+
A `.env` file does nothing by itself. Your app has to **read** it when it
|
|
205
|
+
starts, usually with a small library called dotenv, or a framework that does
|
|
206
|
+
it for you, like Next.js. If nothing reads `.env`, a moved secret would come
|
|
207
|
+
back empty and your app would break.
|
|
208
|
+
|
|
209
|
+
So before moving a secret, DecalogueX looks for proof that `.env` gets
|
|
210
|
+
loaded: dotenv in your project's files, or a framework that loads it. If it
|
|
211
|
+
can't find any, it leaves the secret where it is and tells you the two-line
|
|
212
|
+
setup to do first. Then scan again, and it moves the secret for you.
|
|
213
|
+
|
|
214
|
+
If your app gets its settings another way (from Docker or your hosting
|
|
215
|
+
dashboard, say), set `DECALOGUEX_ENV_LOADED=1` and DecalogueX will take your
|
|
216
|
+
word for it.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Useful commands
|
|
221
|
+
|
|
222
|
+
| Command | What it does |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `decaloguex scan .` | Scan the folder you're in, explain the problems, and ask what to fix |
|
|
225
|
+
| `decaloguex scan . --dry-run` | Only show problems, never change anything |
|
|
226
|
+
| `decaloguex scan . --yes` | Fix everything without asking |
|
|
227
|
+
| `decaloguex scan . --all` | Also show places that are only *worth a look* (by default only sure problems are shown, with one line counting the rest) |
|
|
228
|
+
| `decaloguex undo` | Put back everything the last fix changed |
|
|
229
|
+
| `decaloguex scan . --json` | A report for AI tools (add `--yes` to also fix) |
|
|
230
|
+
| `decaloguex scan . --no-animation` | Same screen, without the moving bars and scenes |
|
|
231
|
+
| `decaloguex telemetry off` | Switch off the anonymous usage stats |
|
|
232
|
+
| `pytest` | Run the tests, to check the program still works |
|
|
233
|
+
|
|
234
|
+
You can also press **F5** in VS Code to run a scan step by step in the debugger.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### Silence a finding you've checked
|
|
239
|
+
|
|
240
|
+
If DecalogueX flags a line and you've looked at it and you're sure it's fine,
|
|
241
|
+
add a comment with `decaloguex-ignore` on that line or the line above:
|
|
242
|
+
|
|
243
|
+
```js
|
|
244
|
+
// decaloguex-ignore
|
|
245
|
+
el.innerHTML = bundledIcon;
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
DecalogueX also respects the markers other tools use, like `nosemgrep`,
|
|
249
|
+
`NOSONAR`, `# nosec` and `rubocop:disable Rails/OutputSafety`.
|
|
250
|
+
|
|
251
|
+
## Privacy
|
|
252
|
+
|
|
253
|
+
DecalogueX sends **anonymous usage stats** so it can be improved: things like
|
|
254
|
+
how many files of each language were checked, which rules found problems, and
|
|
255
|
+
which languages it couldn't read yet. A short notice tells you this at the start
|
|
256
|
+
of the first run, before anything is sent.
|
|
257
|
+
|
|
258
|
+
- **Never sent:** your code, file or folder names, project names, secrets,
|
|
259
|
+
error messages, or anything that identifies you.
|
|
260
|
+
- **See exactly what was sent:** everything is also written to a log on your
|
|
261
|
+
own computer, at `~/.decaloguex/telemetry.log`. `decaloguex telemetry`
|
|
262
|
+
shows where it is.
|
|
263
|
+
- **Projects are counted, not identified:** each project gets a random code,
|
|
264
|
+
kept in its `.decaloguex` folder, so DecalogueX can count how many
|
|
265
|
+
projects use it each week. The code says nothing about the project.
|
|
266
|
+
- **Switch it off any time:** `decaloguex telemetry off`
|
|
267
|
+
- It's also off automatically if you've set `DO_NOT_TRACK=1`, and on
|
|
268
|
+
automated test servers (CI).
|
|
269
|
+
|
|
270
|
+
### Tell us when it's wrong
|
|
271
|
+
|
|
272
|
+
When you go through fixes one by one (**O**), press **w** on any finding
|
|
273
|
+
that looks wrong: a false alarm, or a fix that doesn't look right. Nothing
|
|
274
|
+
gets changed, the finding is noted in `.decaloguex/blind-spots.json`, and
|
|
275
|
+
an anonymous count (the rule and the reason, never your code) helps make
|
|
276
|
+
DecalogueX more accurate.
|
|
277
|
+
|
|
278
|
+
The full list of what's sent is at the top of `decaloguex/telemetry.py`.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## What's in this folder
|
|
283
|
+
|
|
284
|
+
| Item | What it is |
|
|
285
|
+
|---|---|
|
|
286
|
+
| `decaloguex/` | **The program itself.** This is the code that matters. |
|
|
287
|
+
| `tests/` | Checks that the program works. Run them with `pytest`. |
|
|
288
|
+
| `scripts/` | A helper that builds the practice app. |
|
|
289
|
+
| `assets/` | The logo and other images for the README. |
|
|
290
|
+
| `demo/` | The practice app. It's rebuilt from scratch each time, so don't edit it. |
|
|
291
|
+
| `skills/` | The Agent Skill that teaches AI tools to use DecalogueX |
|
|
292
|
+
| `.claude-plugin/` | The files that let Claude Code install the skill |
|
|
293
|
+
| `npm/` | The small launcher behind `npx decaloguex` |
|
|
294
|
+
| `README.md` | This file. |
|
|
295
|
+
| `LICENSE` | The MIT licence: anyone may use this, with your name kept on it |
|
|
296
|
+
| `pyproject.toml` | The project's ID card: its name and what it needs to run. |
|
|
297
|
+
| `.gitignore` | The list of files Git should never save, like secrets and junk. |
|
|
298
|
+
| `.venv/` | Python and its add-ons, installed just for this project. Never touch it. |
|
|
299
|
+
| `.vscode/` | VS Code's settings for this project. |
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Reading the code
|
|
304
|
+
|
|
305
|
+
Every file starts with a plain-English explanation of what it does, and the
|
|
306
|
+
code is full of comments. Many of them compare Python to Java.
|
|
307
|
+
|
|
308
|
+
**Start with the tests.** Each test is a tiny "before → after" example, so
|
|
309
|
+
it's the easiest way to see what a rule does. Then read the rule itself.
|
|
310
|
+
|
|
311
|
+
Every rule file has the same layout:
|
|
312
|
+
1. **At the top:** what the problem is and how it's fixed
|
|
313
|
+
2. **Next:** `check()`, the main function, which shows the big picture
|
|
314
|
+
3. **Below that:** the small helper steps
|
|
315
|
+
|
|
316
|
+
A good order to read the program in:
|
|
317
|
+
|
|
318
|
+
| # | File | What it does |
|
|
319
|
+
|---|---|---|
|
|
320
|
+
| 1 | `decaloguex/models.py` | The basic building blocks: a *Finding* (a problem) and a *Fix* |
|
|
321
|
+
| 2 | `decaloguex/languages.py` | Turns code into a tree the rules can search |
|
|
322
|
+
| 3 | `decaloguex/rules/secrets.py` | Finds passwords and API keys |
|
|
323
|
+
| 4 | `decaloguex/rules/gitignore.py` | Checks the `.gitignore` file |
|
|
324
|
+
| 5 | `decaloguex/rules/errors.py` | Hides error details from visitors |
|
|
325
|
+
| 6 | `decaloguex/rules/async_.py` | Adds missing error handling to async code |
|
|
326
|
+
| 7 | `decaloguex/rules/sql.py` | Fixes SQL injection (long, because every database works a bit differently) |
|
|
327
|
+
| 8 | `decaloguex/rules/other_languages.py` | The same rules for PHP, Java, C#, Go, Ruby, Kotlin and Swift, using one "profile" per language |
|
|
328
|
+
| 9 | `decaloguex/rules/config_files.py` | Secrets in settings files |
|
|
329
|
+
| 9b | `decaloguex/rules/web.py` | Website mistakes: debug mode, XSS, CORS, certificates, mass assignment |
|
|
330
|
+
| 10 | `decaloguex/engine.py` | Runs all the rules and saves the fixes safely |
|
|
331
|
+
| 11 | `decaloguex/cli.py` | The `decaloguex` command you type, step by step |
|
|
332
|
+
| 12 | `decaloguex/ui.py` | Everything on screen: the animations, problem cards and questions |
|
|
333
|
+
| 13 | `decaloguex/explain.py` | The plain-English explanation of every problem. Edit this to change what users read. |
|
|
334
|
+
| 14 | `decaloguex/scenes.py` | The fantasy animations (shield, dragon, wizard) shown while your code is fixed |
|
|
335
|
+
| 15 | `decaloguex/undo.py` | The undo button |
|
|
336
|
+
| 16 | `decaloguex/blindspots.py` | The honest list of what couldn't be checked |
|
|
337
|
+
| 17 | `decaloguex/telemetry.py` | The anonymous usage stats |
|
|
338
|
+
|
|
339
|
+
Smaller helper files: `project.py` (finds the project's files and libraries)
|
|
340
|
+
and `rules/common.py` (small jobs the rules share).
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## How it keeps your code safe
|
|
345
|
+
|
|
346
|
+
- **It reads code properly.** It understands code as a tree, not as plain
|
|
347
|
+
text, so comments or similar-looking words don't fool it.
|
|
348
|
+
- **It checks every fix.** After changing a file, it re-reads it. If the
|
|
349
|
+
change would break the code, the file isn't saved.
|
|
350
|
+
- **It only moves a secret if your app will find it again.** See "Secrets
|
|
351
|
+
are only moved if your app loads `.env`" above.
|
|
352
|
+
- **It won't patch a file that changed after the scan.** If you edit a file
|
|
353
|
+
while it's waiting for your answer, that file is skipped.
|
|
354
|
+
- **It asks first.** Nothing changes unless you say yes, or use `--yes`.
|
|
355
|
+
- **It can undo.** Every fix is backed up first; `decaloguex undo` restores it.
|
|
356
|
+
- **It doesn't crash on strange code.** If a rule gets confused by a file,
|
|
357
|
+
it skips that file, keeps going, and lists it as a blind spot.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
<details>
|
|
362
|
+
<summary><b>Python for Java developers</b> (click to open)</summary>
|
|
363
|
+
|
|
364
|
+
| Java | Python |
|
|
365
|
+
|---|---|
|
|
366
|
+
| `record Point(int x, int y)` | `@dataclass class Point: x: int; y: int` |
|
|
367
|
+
| `HashMap`, `HashSet`, `ArrayList` | `dict`, `set`, `list` (`{k: v}`, `{a, b}`, `[a, b]`) |
|
|
368
|
+
| `null` | `None` |
|
|
369
|
+
| `this` | `self` (written out as the first method parameter) |
|
|
370
|
+
| `private` | a leading underscore by convention: `_helper()` |
|
|
371
|
+
| `for (Item i : items)` | `for i in items:` |
|
|
372
|
+
| `x -> x * 2` | `lambda x: x * 2` |
|
|
373
|
+
| `stream().filter().collect()` | `[x for x in items if test(x)]` |
|
|
374
|
+
| `String.format("%s!", s)` | `f"{s}!"` |
|
|
375
|
+
| `cond ? a : b` | `a if cond else b` |
|
|
376
|
+
| Curly braces for blocks | Indentation (4 spaces) is the block |
|
|
377
|
+
| JUnit `@Test`, `assertEquals` | pytest `def test_...():`, `assert a == b` |
|
|
378
|
+
| Maven `pom.xml` | `pyproject.toml` |
|
|
379
|
+
| Local Maven repo | `.venv/` |
|
|
380
|
+
|
|
381
|
+
</details>
|
|
382
|
+
|
|
383
|
+
<details>
|
|
384
|
+
<summary><b>The rule IDs</b> (click to open)</summary>
|
|
385
|
+
|
|
386
|
+
Each problem in the report has an ID, so you can look it up here.
|
|
387
|
+
|
|
388
|
+
| ID | The problem |
|
|
389
|
+
|---|---|
|
|
390
|
+
| SEC-001 | An API key in a known format (Stripe, OpenAI, AWS...) |
|
|
391
|
+
| SEC-002 | A password or secret stored under a secret-sounding name |
|
|
392
|
+
| SEC-003 | A private key (reported only) |
|
|
393
|
+
| GIT-001 | Secret files that `.gitignore` doesn't hide |
|
|
394
|
+
| GIT-002 | A secret file already saved in Git (reported only) |
|
|
395
|
+
| GIT-003 | No `.gitignore` file at all |
|
|
396
|
+
| SQL-001 | User input glued into a database query |
|
|
397
|
+
| SQL-002 | The same, but the query is stored in a variable first |
|
|
398
|
+
| ERR-001 | Error details sent to visitors |
|
|
399
|
+
| ASYNC-001 | An Express route with no error handling (can crash the server) |
|
|
400
|
+
| ASYNC-002 | A `.then()` chain with no `.catch()` |
|
|
401
|
+
| ASYNC-003 | A Python `async` function called without `await` (it never runs) |
|
|
402
|
+
| ASYNC-004 | A Python background task that can vanish before it finishes |
|
|
403
|
+
| ASYNC-005 | A C# `async void` method (an error crashes the whole app) |
|
|
404
|
+
| ASYNC-006 | A Go goroutine with no `recover()` (a panic crashes the whole program) |
|
|
405
|
+
| ASYNC-007 | A Java `CompletableFuture` whose errors are silently lost |
|
|
406
|
+
| ASYNC-008 | A Kotlin `GlobalScope.launch` with no error handler |
|
|
407
|
+
| ASYNC-009 | A Swift `Task` whose errors are silently lost |
|
|
408
|
+
| DEBUG-001 | Debug mode left on (fixed for Django and Flask) |
|
|
409
|
+
| XSS-001 | Raw HTML put into a web page (fixed for PHP `echo`) |
|
|
410
|
+
| CORS-001 | Any website allowed to call your server (reported only) |
|
|
411
|
+
| TLS-001 | Security certificate check switched off (reported only) |
|
|
412
|
+
| MASS-001 | A whole form saved without picking fields (reported only) |
|
|
413
|
+
| SEC-004 | A backup secret anyone can guess, like `process.env.JWT_SECRET \|\| 'superSecret'` |
|
|
414
|
+
| AUTH-001 | An owner check that lets logged-out visitors through (reported only) |
|
|
415
|
+
| AUTH-002 | Anyone logged in can change or delete anyone's data (reported only) |
|
|
416
|
+
| CMD-001 | Visitor text put into a computer command (reported only) |
|
|
417
|
+
| EVAL-001 | Visitor text run as code (reported only) |
|
|
418
|
+
| PATH-001 | Visitor picks which file is read (reported only) |
|
|
419
|
+
| DESER-001 | Data loaded in a way that can run hidden code (fixed for Python's yaml.load) |
|
|
420
|
+
| NOSQL-001 | MongoDB search built from visitor input (reported only) |
|
|
421
|
+
| REDIRECT-001 | Visitor picks where the site sends people (reported only) |
|
|
422
|
+
| SSRF-001 | Server fetches a web address the visitor chose (reported only) |
|
|
423
|
+
| XXE-001 | XML reader can be tricked into reading your files (reported only) |
|
|
424
|
+
| HASH-001 | Passwords scrambled with MD5 or SHA-1 (reported only) |
|
|
425
|
+
| CSRF-001 | Protection against fake form submissions switched off (reported only) |
|
|
426
|
+
| SEC-005 | A secret with a public name (`NEXT_PUBLIC_`, `VITE_`...), so it's built into the page (reported only) |
|
|
427
|
+
| SEC-006 | An account's password typed into the code, like `generate_password_hash("admin123")` (reported only) |
|
|
428
|
+
| JWT-001 | Login tokens accepted without checking their signature (reported only) |
|
|
429
|
+
| UPLOAD-001 | Uploaded files saved without checking them (reported only, worth a look) |
|
|
430
|
+
| RAND-001 | Guessable random numbers used for codes or tokens (reported only) |
|
|
431
|
+
| AI-001 | An AI service's key exposed in the browser (reported only) |
|
|
432
|
+
| AI-002 | What the AI wrote put into a page, a query or eval() (reported only) |
|
|
433
|
+
| AI-003 | AI features with no rate limit anywhere in the project (reported only, worth a look) |
|
|
434
|
+
| RLS-001 | A Supabase table with no access rules, or a rule letting anyone change rows (reported only) |
|
|
435
|
+
| LAUNCH-001 | A form that says "thank you" but never sends the message anywhere (reported only) |
|
|
436
|
+
| LAUNCH-002 | Privacy, Terms or social links that go nowhere (reported only) |
|
|
437
|
+
| LAUNCH-003 | Placeholder content visitors will see: fake emails, "Lorem ipsum", 555 numbers (reported only) |
|
|
438
|
+
| LAUNCH-004 | Tailwind's try-it-out script (`cdn.tailwindcss.com`) on a live site (reported only) |
|
|
439
|
+
| LAUNCH-005 | Certifications, statistics or quotes only you can confirm are true (reported only, worth a look) |
|
|
440
|
+
|
|
441
|
+
</details>
|
|
442
|
+
|
|
443
|
+
<details>
|
|
444
|
+
<summary><b>Setting up on a new computer</b> (click to open)</summary>
|
|
445
|
+
|
|
446
|
+
```
|
|
447
|
+
python -m venv .venv
|
|
448
|
+
.venv\Scripts\activate
|
|
449
|
+
pip install -e ".[dev]"
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
</details>
|