autonoma-cli 0.1.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.
Files changed (36) hide show
  1. autonoma_cli-0.1.0/LICENSE +21 -0
  2. autonoma_cli-0.1.0/PKG-INFO +405 -0
  3. autonoma_cli-0.1.0/README.md +376 -0
  4. autonoma_cli-0.1.0/pyproject.toml +48 -0
  5. autonoma_cli-0.1.0/setup.cfg +4 -0
  6. autonoma_cli-0.1.0/src/autonoma/__init__.py +5 -0
  7. autonoma_cli-0.1.0/src/autonoma/__main__.py +4 -0
  8. autonoma_cli-0.1.0/src/autonoma/_internal/__init__.py +1 -0
  9. autonoma_cli-0.1.0/src/autonoma/_internal/ast_engine.py +148 -0
  10. autonoma_cli-0.1.0/src/autonoma/_internal/git.py +138 -0
  11. autonoma_cli-0.1.0/src/autonoma/_internal/heuristics.py +245 -0
  12. autonoma_cli-0.1.0/src/autonoma/_internal/merge_utils.py +32 -0
  13. autonoma_cli-0.1.0/src/autonoma/_internal/secret_fixer.py +567 -0
  14. autonoma_cli-0.1.0/src/autonoma/cli.py +200 -0
  15. autonoma_cli-0.1.0/src/autonoma/config.py +81 -0
  16. autonoma_cli-0.1.0/src/autonoma/decisions.py +132 -0
  17. autonoma_cli-0.1.0/src/autonoma/engine.py +213 -0
  18. autonoma_cli-0.1.0/src/autonoma/fixer.py +178 -0
  19. autonoma_cli-0.1.0/src/autonoma/history.py +162 -0
  20. autonoma_cli-0.1.0/src/autonoma/reporter.py +332 -0
  21. autonoma_cli-0.1.0/src/autonoma/scanner.py +35 -0
  22. autonoma_cli-0.1.0/src/autonoma_cli.egg-info/PKG-INFO +405 -0
  23. autonoma_cli-0.1.0/src/autonoma_cli.egg-info/SOURCES.txt +34 -0
  24. autonoma_cli-0.1.0/src/autonoma_cli.egg-info/dependency_links.txt +1 -0
  25. autonoma_cli-0.1.0/src/autonoma_cli.egg-info/entry_points.txt +2 -0
  26. autonoma_cli-0.1.0/src/autonoma_cli.egg-info/requires.txt +8 -0
  27. autonoma_cli-0.1.0/src/autonoma_cli.egg-info/top_level.txt +1 -0
  28. autonoma_cli-0.1.0/tests/test_acceptance.py +602 -0
  29. autonoma_cli-0.1.0/tests/test_ci_mode.py +87 -0
  30. autonoma_cli-0.1.0/tests/test_critical.py +578 -0
  31. autonoma_cli-0.1.0/tests/test_harness.py +364 -0
  32. autonoma_cli-0.1.0/tests/test_history.py +81 -0
  33. autonoma_cli-0.1.0/tests/test_ignore.py +53 -0
  34. autonoma_cli-0.1.0/tests/test_metrics.py +432 -0
  35. autonoma_cli-0.1.0/tests/test_repo_categories.py +1291 -0
  36. autonoma_cli-0.1.0/tests/test_strict.py +481 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Autonoma
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,405 @@
1
+ Metadata-Version: 2.4
2
+ Name: autonoma-cli
3
+ Version: 0.1.0
4
+ Summary: Deterministic code security scanner. Detects and remediates hardcoded secrets.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/Vithushan/Autonoma_Community_CI
7
+ Project-URL: Issues, https://github.com/Vithushan/Autonoma_Community_CI/issues
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Security
17
+ Classifier: Topic :: Software Development :: Quality Assurance
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: click>=8.1
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest; extra == "dev"
24
+ Requires-Dist: ruff; extra == "dev"
25
+ Requires-Dist: mypy; extra == "dev"
26
+ Requires-Dist: build; extra == "dev"
27
+ Requires-Dist: twine; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # Autonoma
31
+
32
+ ![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)
33
+ ![License](https://img.shields.io/badge/License-MIT-green)
34
+ ![Platform](https://img.shields.io/badge/Platform-linux%20%7C%20windows%20%7C%20macos-informational)
35
+ ![Edition](https://img.shields.io/badge/Edition-Community-orange)
36
+ ![PyPI](https://img.shields.io/pypi/v/autonoma-cli)
37
+
38
+ Most secret scanners detect problems.
39
+ Autonoma safely fixes them — or refuses when it cannot prove the change is safe.
40
+
41
+ **Deterministic secret remediation with strict safety boundaries.**
42
+
43
+ ![Autonoma Demo](docs/Animation.gif)
44
+
45
+ ---
46
+
47
+ ## Install
48
+
49
+ The open-source package is published to PyPI as `autonoma-cli`.
50
+
51
+ ```bash
52
+ pip install autonoma-cli
53
+ ```
54
+
55
+ Once installed, use the `autonoma` command:
56
+
57
+ ```bash
58
+ autonoma --version
59
+ autonoma --help
60
+ ```
61
+
62
+ ## Quick Example
63
+
64
+ Scan a project:
65
+
66
+ ```bash
67
+ autonoma analyze ./your-project
68
+ ```
69
+
70
+ Scan and apply safe fixes:
71
+
72
+ ```bash
73
+ autonoma analyze ./your-project --auto-fix
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Example
79
+
80
+ ### Before
81
+
82
+ ```python
83
+ # settings.py
84
+
85
+ DATABASES = {
86
+ "default": {
87
+ "ENGINE": "django.db.backends.postgresql",
88
+ "NAME": "prod_db",
89
+ "USER": "admin",
90
+ "PASSWORD": "Pr0d@ccess2024!", # SEC001
91
+ "HOST": "db.internal.company.com",
92
+ }
93
+ }
94
+
95
+ SENDGRID_API_KEY = "SG.live-abc123xyz987_realkey" # SEC002
96
+ ```
97
+
98
+ ### After
99
+
100
+ ```python
101
+ # settings.py
102
+
103
+ import os
104
+
105
+ DATABASES = {
106
+ "default": {
107
+ "ENGINE": "django.db.backends.postgresql",
108
+ "NAME": "prod_db",
109
+ "USER": "admin",
110
+ "PASSWORD": os.environ["PASSWORD"],
111
+ "HOST": "db.internal.company.com",
112
+ }
113
+ }
114
+
115
+ SENDGRID_API_KEY = os.environ["SENDGRID_API_KEY"]
116
+ ```
117
+
118
+ ### Preview Fixes Safely
119
+
120
+ Preview fixes safely before applying them to guarantee deterministic outputs:
121
+
122
+ ```diff
123
+ $ autonoma analyze demo-project --diff
124
+
125
+ - SENDGRID_API_KEY = "SG.live-abc123xyz987_realkey"
126
+ + SENDGRID_API_KEY = os.environ["SENDGRID_API_KEY"]
127
+ ```
128
+
129
+ ### Example CLI Output
130
+
131
+ ```
132
+ $ autonoma analyze demo-project --auto-fix
133
+
134
+ Scanning 10 files...
135
+
136
+ SEC001 settings.py:8
137
+ Hardcoded password detected
138
+ Status: FIXED
139
+
140
+ SEC002 config.py:3
141
+ Hardcoded API key detected
142
+ Status: FIXED
143
+
144
+ SEC002 utils.py:14
145
+ Ambiguous secret pattern
146
+ Status: REFUSED
147
+
148
+ --------------------------------
149
+ Files scanned: 10
150
+ Issues detected: 3
151
+ Fixed: 2
152
+ Refused: 1
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Commands
158
+
159
+ ```bash
160
+ autonoma analyze PATH
161
+ autonoma analyze PATH --auto-fix
162
+ autonoma analyze PATH --diff
163
+ autonoma analyze PATH --json
164
+ autonoma analyze PATH --ci
165
+ autonoma history-scan PATH
166
+ autonoma --version
167
+ ```
168
+
169
+ ---
170
+
171
+ ## CLI Features
172
+
173
+ Autonoma supports:
174
+
175
+ - `--auto-fix` — apply deterministic safe fixes
176
+ - `--diff` — preview proposed fixes as unified diffs
177
+ - `--json` — emit machine-readable output for automation
178
+ - `--ci` — use CI-oriented exit codes
179
+ - `--quiet` — minimize console output for pipelines
180
+ - `--threads` — parallelize scanning on larger repositories
181
+ - `.autonomaignore` — exclude noisy paths
182
+ - `history-scan` — detect secrets that still exist in Git history
183
+
184
+ ---
185
+
186
+ ## What Autonoma Detects
187
+
188
+ | Code | Description |
189
+ | ---------- | -------------------------------------------------- |
190
+ | **SEC001** | Hardcoded passwords |
191
+ | **SEC002** | Hardcoded API keys |
192
+ | **SEC003** | High-risk SQL string construction |
193
+ | **SEC004** | Python SSTI patterns |
194
+ | **SEC005** | Insecure deserialization (`pickle`, unsafe `yaml`) |
195
+
196
+ Auto-fix support:
197
+
198
+ | Code | Behavior |
199
+ | ----------------- | -------------------- |
200
+ | **SEC001** | Auto-fixed when safe |
201
+ | **SEC002** | Auto-fixed when safe |
202
+ | **SEC003–SEC005** | Detection only |
203
+
204
+ Autonoma deliberately avoids automatic rewrites for logic-level vulnerabilities.
205
+
206
+ ---
207
+
208
+ ## Safety Model
209
+
210
+ Autonoma only applies a fix when all three conditions are satisfied:
211
+
212
+ 1. The transformation is structurally safe
213
+ 2. The environment variable contract can be established
214
+ 3. The modification introduces no ambiguity
215
+
216
+ Every finding produces one of four outcomes:
217
+
218
+ | Status | Meaning |
219
+ | ----------- | ---------------------------------------------- |
220
+ | **FIXED** | Deterministic fix applied |
221
+ | **REFUSED** | Change declined to prevent unsafe modification |
222
+ | **SKIPPED** | Code already compliant |
223
+ | **FAILED** | Tool error |
224
+
225
+ ---
226
+
227
+ ## Refusal Examples
228
+
229
+ Refusal is intentional.
230
+ A wrong automated fix is worse than no fix.
231
+
232
+ ### No Environment Contract
233
+
234
+ ```python
235
+ API_KEY = "sk-live-abc123"
236
+ ```
237
+
238
+ Refused because the project has no `.env` or dotenv dependency.
239
+
240
+ ### Ambiguous Variable Name
241
+
242
+ ```python
243
+ x = "sk-live-abc123"
244
+ ```
245
+
246
+ Autonoma cannot safely infer an environment variable name.
247
+
248
+ ### Already Compliant
249
+
250
+ ```python
251
+ API_KEY = os.getenv("API_KEY", "sk-live-abc123")
252
+ ```
253
+
254
+ Environment lookup already exists.
255
+
256
+ ### Ambiguous Secret Construction
257
+
258
+ ```python
259
+ token = "Bearer " + "sk-live-abc123"
260
+ ```
261
+
262
+ Literal cannot be safely isolated.
263
+
264
+ ---
265
+
266
+ ## Git History Scanning
267
+
268
+ Autonoma can also detect secrets that were committed in the past and later removed from the working tree.
269
+
270
+ ```bash
271
+ autonoma history-scan .
272
+ ```
273
+
274
+ This helps identify secrets that still exist in Git history and may remain accessible through old commits, forks, mirrors, or cloned repositories.
275
+
276
+ ---
277
+
278
+ ## Why Autonoma Exists
279
+
280
+ Most security scanners stop at detection.
281
+ Developers still need to manually remove secrets from code.
282
+
283
+ Autonoma focuses on deterministic remediation — automatically fixing the subset of issues that can be proven safe.
284
+
285
+ If safety cannot be guaranteed, it refuses the change instead of guessing.
286
+
287
+ ---
288
+
289
+ ## What Autonoma Deliberately Does NOT Do
290
+
291
+ Autonoma intentionally avoids features that cannot be made deterministic.
292
+
293
+ It does not perform:
294
+
295
+ - full taint analysis
296
+ - full data flow analysis
297
+ - automatic SQL injection rewriting
298
+ - automatic SSTI remediation
299
+ - LLM-generated patches
300
+
301
+ Only transformations that can be proven safe are applied automatically.
302
+ Everything else is flagged for human review.
303
+
304
+ ---
305
+
306
+ ## CI Example
307
+
308
+ Autonoma can run directly in CI pipelines.
309
+
310
+ ```yaml
311
+ - name: Install Autonoma
312
+ run: pip install autonoma-cli
313
+
314
+ - name: Scan repository
315
+ run: autonoma analyze . --ci
316
+ ```
317
+
318
+ Exit codes:
319
+
320
+ - `0` — no issues found
321
+ - `1` — issues found, but none are automatically fixable
322
+ - `2` — fixable issues found
323
+ - `3` — internal error
324
+
325
+ ---
326
+
327
+ ## Architecture
328
+
329
+ Autonoma is a local-first security remediation tool.
330
+
331
+ Key characteristics:
332
+
333
+ - Python 3.10+
334
+ - AST-based secret detection and remediation
335
+ - deterministic code transformations
336
+ - no telemetry
337
+ - no cloud dependency
338
+ - no LLM usage
339
+
340
+ All analysis runs entirely on the local machine.
341
+
342
+ ---
343
+
344
+ ## Validation
345
+
346
+ Autonoma has been tested across synthetic repositories, seeded secret datasets and real-world open-source Python projects containing exposed credentials.
347
+
348
+ Current validation results:
349
+
350
+ - 0 crashes across tested repositories
351
+ - 0 syntax breakage after auto-fix
352
+ - deterministic output across repeated runs
353
+ - idempotent fixes on rerun
354
+ - dry-run and diff preview do not modify files
355
+
356
+ Performance benchmarks:
357
+
358
+ | Repository Size | Files | LOC | Runtime |
359
+ |-----------------|------:|-------:|--------:|
360
+ | Small | 5 | 503 | 0.16s |
361
+ | Medium | 34 | 3,029 | 0.24s |
362
+ | Large | 77 | 10,025 | 0.27s |
363
+ | Very Large | 351 | 30,063 | 0.55s |
364
+
365
+ Unsafe patterns are refused instead of rewritten.
366
+
367
+ ---
368
+
369
+ ## Enterprise
370
+
371
+ Autonoma Community Edition focuses on deterministic local remediation for Python projects.
372
+
373
+ Planned enterprise capabilities include:
374
+
375
+ - policy enforcement
376
+ - CI/CD integration
377
+ - audit logs
378
+ - approval workflows
379
+ - multi-repository orchestration
380
+
381
+ Enterprise capabilities are under development.
382
+
383
+ If your team is interested in early evaluation or pilot deployments,
384
+ feel free to reach out.
385
+ ---
386
+
387
+ ## Contributing
388
+
389
+ Bug reports and edge cases are extremely valuable.
390
+
391
+ If Autonoma:
392
+
393
+ - fixes something incorrectly
394
+ - refuses a safe pattern
395
+ - misses a detectable secret
396
+
397
+ please open an issue with the code sample.
398
+
399
+ Pull requests are welcome.
400
+
401
+ ---
402
+
403
+ ## License
404
+
405
+ MIT License