skilltotal 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.
Files changed (52) hide show
  1. skilltotal-0.3.0/LICENSE +201 -0
  2. skilltotal-0.3.0/NOTICE +6 -0
  3. skilltotal-0.3.0/PKG-INFO +170 -0
  4. skilltotal-0.3.0/README.md +139 -0
  5. skilltotal-0.3.0/pyproject.toml +73 -0
  6. skilltotal-0.3.0/setup.cfg +4 -0
  7. skilltotal-0.3.0/skilltotal/__init__.py +43 -0
  8. skilltotal-0.3.0/skilltotal/__main__.py +6 -0
  9. skilltotal-0.3.0/skilltotal/baseline.py +81 -0
  10. skilltotal-0.3.0/skilltotal/capabilities.py +31 -0
  11. skilltotal-0.3.0/skilltotal/cli.py +155 -0
  12. skilltotal-0.3.0/skilltotal/collector.py +371 -0
  13. skilltotal-0.3.0/skilltotal/engine.py +149 -0
  14. skilltotal-0.3.0/skilltotal/file_index.py +227 -0
  15. skilltotal-0.3.0/skilltotal/models.py +218 -0
  16. skilltotal-0.3.0/skilltotal/report.py +86 -0
  17. skilltotal-0.3.0/skilltotal/rules.py +36 -0
  18. skilltotal-0.3.0/skilltotal/sarif.py +108 -0
  19. skilltotal-0.3.0/skilltotal/scanners/__init__.py +49 -0
  20. skilltotal-0.3.0/skilltotal/scanners/base.py +128 -0
  21. skilltotal-0.3.0/skilltotal/scanners/dynamic_code.py +41 -0
  22. skilltotal-0.3.0/skilltotal/scanners/filesystem.py +63 -0
  23. skilltotal-0.3.0/skilltotal/scanners/install_scripts.py +85 -0
  24. skilltotal-0.3.0/skilltotal/scanners/invisible_unicode.py +127 -0
  25. skilltotal-0.3.0/skilltotal/scanners/mcp.py +370 -0
  26. skilltotal-0.3.0/skilltotal/scanners/network.py +47 -0
  27. skilltotal-0.3.0/skilltotal/scanners/obfuscation.py +140 -0
  28. skilltotal-0.3.0/skilltotal/scanners/prompt_surface.py +104 -0
  29. skilltotal-0.3.0/skilltotal/scanners/python_ast.py +380 -0
  30. skilltotal-0.3.0/skilltotal/scanners/sensitive_paths.py +174 -0
  31. skilltotal-0.3.0/skilltotal/scanners/shell_exec.py +47 -0
  32. skilltotal-0.3.0/skilltotal/scoring.py +79 -0
  33. skilltotal-0.3.0/skilltotal.egg-info/PKG-INFO +170 -0
  34. skilltotal-0.3.0/skilltotal.egg-info/SOURCES.txt +50 -0
  35. skilltotal-0.3.0/skilltotal.egg-info/dependency_links.txt +1 -0
  36. skilltotal-0.3.0/skilltotal.egg-info/entry_points.txt +2 -0
  37. skilltotal-0.3.0/skilltotal.egg-info/requires.txt +10 -0
  38. skilltotal-0.3.0/skilltotal.egg-info/top_level.txt +1 -0
  39. skilltotal-0.3.0/tests/test_baseline.py +100 -0
  40. skilltotal-0.3.0/tests/test_calibration.py +146 -0
  41. skilltotal-0.3.0/tests/test_capabilities.py +28 -0
  42. skilltotal-0.3.0/tests/test_cli.py +133 -0
  43. skilltotal-0.3.0/tests/test_collector_packages.py +126 -0
  44. skilltotal-0.3.0/tests/test_file_index.py +69 -0
  45. skilltotal-0.3.0/tests/test_invisible_unicode.py +53 -0
  46. skilltotal-0.3.0/tests/test_models.py +76 -0
  47. skilltotal-0.3.0/tests/test_python_ast.py +85 -0
  48. skilltotal-0.3.0/tests/test_report.py +55 -0
  49. skilltotal-0.3.0/tests/test_report_schema.py +47 -0
  50. skilltotal-0.3.0/tests/test_sarif.py +56 -0
  51. skilltotal-0.3.0/tests/test_scanners.py +210 -0
  52. skilltotal-0.3.0/tests/test_scoring.py +76 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 SkillTotal
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ SkillTotal
2
+ Copyright 2026 SkillTotal
3
+
4
+ This product includes software developed by the SkillTotal project.
5
+
6
+ Licensed under the Apache License, Version 2.0 (see the LICENSE file).
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: skilltotal
3
+ Version: 0.3.0
4
+ Summary: AI Component Security Platform — static security analysis for AI components (CLI engine)
5
+ Author: SkillTotal
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/pezhik/skilltotal
8
+ Project-URL: Repository, https://github.com/pezhik/skilltotal
9
+ Project-URL: Changelog, https://github.com/pezhik/skilltotal/blob/main/CHANGELOG.md
10
+ Keywords: security,ai,mcp,supply-chain,static-analysis,prompt-injection
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Topic :: Security
16
+ Classifier: Programming Language :: Python :: 3
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ License-File: NOTICE
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Requires-Dist: ruff>=0.4; extra == "dev"
24
+ Requires-Dist: jsonschema>=4.0; extra == "dev"
25
+ Requires-Dist: bandit>=1.7; extra == "dev"
26
+ Requires-Dist: build>=1.0; extra == "dev"
27
+ Requires-Dist: twine>=5.0; extra == "dev"
28
+ Requires-Dist: pre-commit>=3.5; extra == "dev"
29
+ Requires-Dist: detect-secrets>=1.5; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # SkillTotal
33
+
34
+ **AI Component Security Platform — open-source CLI engine.**
35
+
36
+ SkillTotal statically analyzes AI-related components (skills, plugins, MCP servers, npm /
37
+ Python packages, repositories) to surface supply-chain risks, dangerous capabilities,
38
+ prompt-injection surfaces, and data-exfiltration paths **before** the component is installed
39
+ or trusted.
40
+
41
+ It analyzes **only the component itself** — never your user, company, environment,
42
+ deployment, or runtime context. Every score and finding is derived exclusively from the
43
+ files inside the component.
44
+
45
+ > Core principle: **every confirmed finding carries evidence** (file, line range, code
46
+ > snippet). Anything that cannot be evidenced is placed in `needs_review`, never in
47
+ > `findings`, and never affects the score.
48
+
49
+ ## Install
50
+
51
+ Requires **Python 3.10+**. Zero runtime dependencies. `git` is required only for scanning
52
+ remote URLs.
53
+
54
+ ```bash
55
+ pip install -e .
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ ```bash
61
+ # Human-readable report
62
+ skilltotal scan ./path/to/component
63
+
64
+ # Scan a remote repository (shallow git clone)
65
+ skilltotal scan https://github.com/owner/repo
66
+
67
+ # JSON to stdout
68
+ skilltotal scan ./component --json
69
+
70
+ # SARIF 2.1.0 (GitHub Code Scanning / IDE)
71
+ skilltotal scan ./component --sarif --output report.sarif
72
+
73
+ # Write the report to a file (SARIF if --sarif, else JSON)
74
+ skilltotal scan ./component --output report.json
75
+
76
+ # CI gate: exit code 2 if any finding is high or critical
77
+ skilltotal scan ./component --fail-on-high
78
+
79
+ # Baseline: snapshot current findings, then suppress them on later scans
80
+ skilltotal scan ./component --write-baseline .skilltotal-baseline.json
81
+ skilltotal scan ./component --baseline .skilltotal-baseline.json --fail-on-high
82
+
83
+ # List every detection rule
84
+ skilltotal rules list
85
+ skilltotal rules list --json
86
+ ```
87
+
88
+ **Baseline** suppresses findings by a stable fingerprint of
89
+ `(rule id, file, code snippet)` — independent of line numbers, so it survives edits.
90
+ Suppressed findings are removed before scoring and do not affect the risk score.
91
+
92
+ `python -m skilltotal ...` works identically to the `skilltotal` console script.
93
+
94
+ ### Exit codes
95
+
96
+ | Code | Meaning |
97
+ |------|---------|
98
+ | 0 | Success |
99
+ | 1 | Usage / collection error (e.g. path missing, clone failed) |
100
+ | 2 | `--fail-on-high` set and a finding of severity ≥ high was produced |
101
+
102
+ ## What it detects
103
+
104
+ | Category | Examples |
105
+ |----------|----------|
106
+ | Shell execution | `subprocess.*`, `os.system`, `child_process.exec` |
107
+ | Filesystem access | `open`, `read_text`/`write_text`, `fs.readFile`/`writeFile` |
108
+ | Sensitive paths | `~/.ssh`, `~/.aws`, `.env`, `id_rsa`, `credentials`, `secrets` |
109
+ | Network egress | `requests`, `urllib`, `aiohttp`, `fetch`, `axios` |
110
+ | Install-time execution | npm `preinstall`/`postinstall`/`prepare`, `setup.py` hooks |
111
+ | Dynamic code execution | `eval`, `exec`, `compile`, `new Function`, `vm.runInNewContext` |
112
+ | Obfuscation | decode-and-execute chains, base64 blobs, hex escaping, minification |
113
+ | MCP risks | manifests, dangerous tools (shell/fs/network/credential), server commands |
114
+ | Prompt surface | "ignore previous instructions", "reveal system prompt", exfiltration phrasing |
115
+
116
+ ## Output
117
+
118
+ A normalized report containing the component identity, a **risk score (0–100)** and
119
+ **risk level** (low / medium / high / critical), detected **capabilities** (each
120
+ evidence-backed), **findings**, **needs_review**, and **metadata**. See
121
+ [docs/report-schema.md](docs/report-schema.md) and [docs/scoring.md](docs/scoring.md).
122
+
123
+ ## Architecture
124
+
125
+ The package under `skilltotal/` (except `cli.py`) is a pure, side-effect-free library so the
126
+ same engine can power the future web app and enterprise SaaS. See
127
+ [docs/architecture.md](docs/architecture.md).
128
+
129
+ ## Development
130
+
131
+ ```bash
132
+ pip install -e ".[dev]"
133
+ pytest
134
+ ```
135
+
136
+ ## Accuracy notes
137
+
138
+ - Python is analyzed via an **AST** (resolves import aliases, tells `open(p,'w')` from a
139
+ read, ignores API names that only appear in strings/comments). Node.js/config use regex.
140
+ - **Test code** (`__tests__/`, `*.test.*`, `tests/`, `conftest.py`, …) is demoted to
141
+ `needs_review` — it is not executed by consumers, so it does not affect the score.
142
+ - Ambiguous signals (bare `secrets`/`credentials` words, lone base64 blobs, "before
143
+ answering" phrasing, minified files) go to `needs_review`, never to `findings`.
144
+ - **Hidden Unicode** (ASCII-smuggling tag characters, Trojan-Source bidi overrides,
145
+ zero-width chars) is detected and decoded — a real evasion used to smuggle instructions
146
+ past human review. See `tests/manual_eval/` for calibration against real-world attacks.
147
+ - Shell execution covers `subprocess`/`os.system`, `asyncio.create_subprocess_*`, Node
148
+ `child_process`, and common process-spawning libraries (Python `sh`/`plumbum`/`pexpect`/
149
+ `invoke`/`fabric`; Node `zx`/`execa`/`cross-spawn`/`shelljs`/`tinyexec`/`node-pty`).
150
+ - MCP dangerous tools are classified by name/description both in JSON manifests **and when
151
+ defined in code** (`server.tool("run_command", …)`, `@mcp.tool` over `def read_file`).
152
+ - **Limitations:** detection is at the call/import level. Capability via an *unrecognized*
153
+ higher-level library (e.g. a git library that writes files internally, a browser library)
154
+ may not be flagged as a raw filesystem/shell call. Capabilities indicate *presence*, not
155
+ proven misuse.
156
+
157
+ ## Open source vs SkillTotal Cloud
158
+
159
+ SkillTotal is **open core**. This engine (analysis + all detection rules + CLI) is open source
160
+ and **complete on its own** — run it locally or in CI, free, offline, with zero runtime
161
+ dependencies. It tells you **what** a component does, with evidence.
162
+
163
+ Paid features are delivered only via **SkillTotal Cloud** (the website) and explain **why it
164
+ matters**: LLM interpretation and prioritization of findings, dynamic sandbox execution,
165
+ hosting, scan history, and monitoring. They are server-side services on top of this engine —
166
+ their code is not part of this repository. See [docs/open-core.md](docs/open-core.md).
167
+
168
+ ## License
169
+
170
+ [Apache-2.0](LICENSE). See also [NOTICE](NOTICE).
@@ -0,0 +1,139 @@
1
+ # SkillTotal
2
+
3
+ **AI Component Security Platform — open-source CLI engine.**
4
+
5
+ SkillTotal statically analyzes AI-related components (skills, plugins, MCP servers, npm /
6
+ Python packages, repositories) to surface supply-chain risks, dangerous capabilities,
7
+ prompt-injection surfaces, and data-exfiltration paths **before** the component is installed
8
+ or trusted.
9
+
10
+ It analyzes **only the component itself** — never your user, company, environment,
11
+ deployment, or runtime context. Every score and finding is derived exclusively from the
12
+ files inside the component.
13
+
14
+ > Core principle: **every confirmed finding carries evidence** (file, line range, code
15
+ > snippet). Anything that cannot be evidenced is placed in `needs_review`, never in
16
+ > `findings`, and never affects the score.
17
+
18
+ ## Install
19
+
20
+ Requires **Python 3.10+**. Zero runtime dependencies. `git` is required only for scanning
21
+ remote URLs.
22
+
23
+ ```bash
24
+ pip install -e .
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```bash
30
+ # Human-readable report
31
+ skilltotal scan ./path/to/component
32
+
33
+ # Scan a remote repository (shallow git clone)
34
+ skilltotal scan https://github.com/owner/repo
35
+
36
+ # JSON to stdout
37
+ skilltotal scan ./component --json
38
+
39
+ # SARIF 2.1.0 (GitHub Code Scanning / IDE)
40
+ skilltotal scan ./component --sarif --output report.sarif
41
+
42
+ # Write the report to a file (SARIF if --sarif, else JSON)
43
+ skilltotal scan ./component --output report.json
44
+
45
+ # CI gate: exit code 2 if any finding is high or critical
46
+ skilltotal scan ./component --fail-on-high
47
+
48
+ # Baseline: snapshot current findings, then suppress them on later scans
49
+ skilltotal scan ./component --write-baseline .skilltotal-baseline.json
50
+ skilltotal scan ./component --baseline .skilltotal-baseline.json --fail-on-high
51
+
52
+ # List every detection rule
53
+ skilltotal rules list
54
+ skilltotal rules list --json
55
+ ```
56
+
57
+ **Baseline** suppresses findings by a stable fingerprint of
58
+ `(rule id, file, code snippet)` — independent of line numbers, so it survives edits.
59
+ Suppressed findings are removed before scoring and do not affect the risk score.
60
+
61
+ `python -m skilltotal ...` works identically to the `skilltotal` console script.
62
+
63
+ ### Exit codes
64
+
65
+ | Code | Meaning |
66
+ |------|---------|
67
+ | 0 | Success |
68
+ | 1 | Usage / collection error (e.g. path missing, clone failed) |
69
+ | 2 | `--fail-on-high` set and a finding of severity ≥ high was produced |
70
+
71
+ ## What it detects
72
+
73
+ | Category | Examples |
74
+ |----------|----------|
75
+ | Shell execution | `subprocess.*`, `os.system`, `child_process.exec` |
76
+ | Filesystem access | `open`, `read_text`/`write_text`, `fs.readFile`/`writeFile` |
77
+ | Sensitive paths | `~/.ssh`, `~/.aws`, `.env`, `id_rsa`, `credentials`, `secrets` |
78
+ | Network egress | `requests`, `urllib`, `aiohttp`, `fetch`, `axios` |
79
+ | Install-time execution | npm `preinstall`/`postinstall`/`prepare`, `setup.py` hooks |
80
+ | Dynamic code execution | `eval`, `exec`, `compile`, `new Function`, `vm.runInNewContext` |
81
+ | Obfuscation | decode-and-execute chains, base64 blobs, hex escaping, minification |
82
+ | MCP risks | manifests, dangerous tools (shell/fs/network/credential), server commands |
83
+ | Prompt surface | "ignore previous instructions", "reveal system prompt", exfiltration phrasing |
84
+
85
+ ## Output
86
+
87
+ A normalized report containing the component identity, a **risk score (0–100)** and
88
+ **risk level** (low / medium / high / critical), detected **capabilities** (each
89
+ evidence-backed), **findings**, **needs_review**, and **metadata**. See
90
+ [docs/report-schema.md](docs/report-schema.md) and [docs/scoring.md](docs/scoring.md).
91
+
92
+ ## Architecture
93
+
94
+ The package under `skilltotal/` (except `cli.py`) is a pure, side-effect-free library so the
95
+ same engine can power the future web app and enterprise SaaS. See
96
+ [docs/architecture.md](docs/architecture.md).
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ pip install -e ".[dev]"
102
+ pytest
103
+ ```
104
+
105
+ ## Accuracy notes
106
+
107
+ - Python is analyzed via an **AST** (resolves import aliases, tells `open(p,'w')` from a
108
+ read, ignores API names that only appear in strings/comments). Node.js/config use regex.
109
+ - **Test code** (`__tests__/`, `*.test.*`, `tests/`, `conftest.py`, …) is demoted to
110
+ `needs_review` — it is not executed by consumers, so it does not affect the score.
111
+ - Ambiguous signals (bare `secrets`/`credentials` words, lone base64 blobs, "before
112
+ answering" phrasing, minified files) go to `needs_review`, never to `findings`.
113
+ - **Hidden Unicode** (ASCII-smuggling tag characters, Trojan-Source bidi overrides,
114
+ zero-width chars) is detected and decoded — a real evasion used to smuggle instructions
115
+ past human review. See `tests/manual_eval/` for calibration against real-world attacks.
116
+ - Shell execution covers `subprocess`/`os.system`, `asyncio.create_subprocess_*`, Node
117
+ `child_process`, and common process-spawning libraries (Python `sh`/`plumbum`/`pexpect`/
118
+ `invoke`/`fabric`; Node `zx`/`execa`/`cross-spawn`/`shelljs`/`tinyexec`/`node-pty`).
119
+ - MCP dangerous tools are classified by name/description both in JSON manifests **and when
120
+ defined in code** (`server.tool("run_command", …)`, `@mcp.tool` over `def read_file`).
121
+ - **Limitations:** detection is at the call/import level. Capability via an *unrecognized*
122
+ higher-level library (e.g. a git library that writes files internally, a browser library)
123
+ may not be flagged as a raw filesystem/shell call. Capabilities indicate *presence*, not
124
+ proven misuse.
125
+
126
+ ## Open source vs SkillTotal Cloud
127
+
128
+ SkillTotal is **open core**. This engine (analysis + all detection rules + CLI) is open source
129
+ and **complete on its own** — run it locally or in CI, free, offline, with zero runtime
130
+ dependencies. It tells you **what** a component does, with evidence.
131
+
132
+ Paid features are delivered only via **SkillTotal Cloud** (the website) and explain **why it
133
+ matters**: LLM interpretation and prioritization of findings, dynamic sandbox execution,
134
+ hosting, scan history, and monitoring. They are server-side services on top of this engine —
135
+ their code is not part of this repository. See [docs/open-core.md](docs/open-core.md).
136
+
137
+ ## License
138
+
139
+ [Apache-2.0](LICENSE). See also [NOTICE](NOTICE).
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "skilltotal"
7
+ # Single source of truth for the version is skilltotal/__init__.py (__version__);
8
+ # a hardcoded copy here once drifted (0.1.0 vs 0.3.0) and nearly shipped mislabeled.
9
+ dynamic = ["version"]
10
+ description = "AI Component Security Platform — static security analysis for AI components (CLI engine)"
11
+ readme = "README.md"
12
+ requires-python = ">=3.10"
13
+ license = { text = "Apache-2.0" }
14
+ authors = [{ name = "SkillTotal" }]
15
+ keywords = ["security", "ai", "mcp", "supply-chain", "static-analysis", "prompt-injection"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Topic :: Security",
22
+ "Programming Language :: Python :: 3",
23
+ ]
24
+ # Zero runtime dependencies — Python standard library only.
25
+ dependencies = []
26
+
27
+ [project.optional-dependencies]
28
+ # Dev-only — the runtime engine stays zero-dependency. jsonschema validates that reports
29
+ # conform to docs/report.schema.json (the engine<->consumer contract).
30
+ dev = [
31
+ "pytest>=7.0",
32
+ "ruff>=0.4",
33
+ "jsonschema>=4.0",
34
+ "bandit>=1.7",
35
+ "build>=1.0",
36
+ "twine>=5.0",
37
+ "pre-commit>=3.5",
38
+ "detect-secrets>=1.5",
39
+ ]
40
+
41
+ [project.scripts]
42
+ skilltotal = "skilltotal.cli:main"
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/pezhik/skilltotal"
46
+ Repository = "https://github.com/pezhik/skilltotal"
47
+ Changelog = "https://github.com/pezhik/skilltotal/blob/main/CHANGELOG.md"
48
+
49
+ [tool.setuptools.packages.find]
50
+ include = ["skilltotal*"]
51
+
52
+ [tool.setuptools.dynamic]
53
+ version = { attr = "skilltotal.__version__" }
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
57
+ # manual_eval holds the manual calibration harness, generators, and a cloned third-party
58
+ # corpus (with its own tests) — none of it should be collected by our test run.
59
+ addopts = "-q --ignore=tests/manual_eval"
60
+
61
+ [tool.bandit]
62
+ # Scan the engine package; fixtures/corpus/tests are not shipped code.
63
+ exclude_dirs = ["tests", "build", "dist"]
64
+
65
+ [tool.ruff]
66
+ line-length = 100
67
+ target-version = "py310"
68
+
69
+ [tool.ruff.lint]
70
+ select = ["E", "F", "I", "UP", "B"]
71
+ # Scanner regexes intentionally contain detection string literals (e.g. "eval", "exec");
72
+ # they are not executable code, so no per-file ignores are needed here.
73
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,43 @@
1
+ """SkillTotal — AI Component Security Platform (core engine).
2
+
3
+ This package is the reusable core engine. Everything here is import-safe and free of
4
+ process-level side effects (no printing, no ``sys.exit``) *except* :mod:`skilltotal.cli`,
5
+ which is the thin I/O shell. Future web and enterprise products are intended to import
6
+ :func:`skilltotal.engine.analyze` directly.
7
+ """
8
+
9
+ from skilltotal.models import (
10
+ Capability,
11
+ Component,
12
+ Evidence,
13
+ Finding,
14
+ NeedsReview,
15
+ Report,
16
+ RiskLevel,
17
+ Severity,
18
+ )
19
+
20
+ # --- Versioned contract (consumed by downstream products such as the web app) -----------
21
+ # ENGINE_VERSION: semver of the code / public API; pin this from a consumer.
22
+ # REPORT_SCHEMA_VERSION: shape of Report.to_dict(); bumps only on schema changes.
23
+ # RULESET_VERSION: integer counter of the detection ruleset; bumps when rules change, so a
24
+ # consumer knows when re-scanning old reports may surface new findings.
25
+ __version__ = "0.3.0"
26
+ ENGINE_VERSION = __version__
27
+ REPORT_SCHEMA_VERSION = "1.1"
28
+ RULESET_VERSION = 4
29
+
30
+ __all__ = [
31
+ "__version__",
32
+ "ENGINE_VERSION",
33
+ "REPORT_SCHEMA_VERSION",
34
+ "RULESET_VERSION",
35
+ "Capability",
36
+ "Component",
37
+ "Evidence",
38
+ "Finding",
39
+ "NeedsReview",
40
+ "Report",
41
+ "RiskLevel",
42
+ "Severity",
43
+ ]
@@ -0,0 +1,6 @@
1
+ """Enable ``python -m skilltotal`` as an entry point."""
2
+
3
+ from skilltotal.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())