crabukit 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. crabukit-0.1.0/.github/workflows/ci.yml +92 -0
  2. crabukit-0.1.0/.github/workflows/release.yml +35 -0
  3. crabukit-0.1.0/.gitignore +150 -0
  4. crabukit-0.1.0/CHANGELOG.md +30 -0
  5. crabukit-0.1.0/CONTRIBUTING.md +136 -0
  6. crabukit-0.1.0/LICENSE +21 -0
  7. crabukit-0.1.0/PKG-INFO +279 -0
  8. crabukit-0.1.0/README.md +253 -0
  9. crabukit-0.1.0/RESEARCH_SUMMARY.md +192 -0
  10. crabukit-0.1.0/SECURITY.md +95 -0
  11. crabukit-0.1.0/SKILL.md +108 -0
  12. crabukit-0.1.0/crabukit/__init__.py +3 -0
  13. crabukit-0.1.0/crabukit/analyzers/__init__.py +1 -0
  14. crabukit-0.1.0/crabukit/analyzers/bash_static.py +438 -0
  15. crabukit-0.1.0/crabukit/analyzers/permissions.py +313 -0
  16. crabukit-0.1.0/crabukit/analyzers/python_ast.py +377 -0
  17. crabukit-0.1.0/crabukit/cli.py +243 -0
  18. crabukit-0.1.0/crabukit/external_scanners.py +151 -0
  19. crabukit-0.1.0/crabukit/formatters/__init__.py +1 -0
  20. crabukit-0.1.0/crabukit/formatters/cli_table.py +185 -0
  21. crabukit-0.1.0/crabukit/parsers/__init__.py +1 -0
  22. crabukit-0.1.0/crabukit/parsers/scripts.py +98 -0
  23. crabukit-0.1.0/crabukit/parsers/skill_md.py +311 -0
  24. crabukit-0.1.0/crabukit/rules/__init__.py +1 -0
  25. crabukit-0.1.0/crabukit/rules/patterns.py +622 -0
  26. crabukit-0.1.0/crabukit/scanner.py +287 -0
  27. crabukit-0.1.0/pyproject.toml +47 -0
  28. crabukit-0.1.0/scripts/README.md +52 -0
  29. crabukit-0.1.0/scripts/claw-safe-install.sh +141 -0
  30. crabukit-0.1.0/tests/fixtures/low-risk-risk/scripts/calc.py +8 -0
  31. crabukit-0.1.0/tests/fixtures/low-risk-skill/SKILL.md +8 -0
  32. crabukit-0.1.0/tests/fixtures/malicious-skill/SKILL.md +15 -0
  33. crabukit-0.1.0/tests/fixtures/malicious-skill/scripts/exploit.py +26 -0
  34. crabukit-0.1.0/tests/fixtures/malicious-skill/scripts/setup.sh +14 -0
  35. crabukit-0.1.0/tests/fixtures/medium-risk-skill/SKILL.md +17 -0
  36. crabukit-0.1.0/tests/fixtures/medium-risk-skill/scripts/fetcher.py +23 -0
@@ -0,0 +1,92 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest]
15
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Lint with ruff
31
+ run: ruff check .
32
+
33
+ - name: Format check with black
34
+ run: black --check .
35
+
36
+ - name: Test with pytest
37
+ run: pytest --cov=crabukit --cov-report=xml
38
+
39
+ - name: Upload coverage
40
+ uses: codecov/codecov-action@v3
41
+ with:
42
+ file: ./coverage.xml
43
+ fail_ci_if_error: false
44
+
45
+ integration-test:
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Set up Python
51
+ uses: actions/setup-python@v5
52
+ with:
53
+ python-version: '3.11'
54
+
55
+ - name: Install crabukit
56
+ run: |
57
+ pip install -e .
58
+
59
+ - name: Test CLI
60
+ run: |
61
+ crabukit --version
62
+ crabukit list-rules
63
+
64
+ - name: Scan test fixtures
65
+ run: |
66
+ crabukit scan tests/fixtures/malicious-skill/ --fail-on=low || true
67
+
68
+ build:
69
+ runs-on: ubuntu-latest
70
+ needs: [test]
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+
74
+ - name: Set up Python
75
+ uses: actions/setup-python@v5
76
+ with:
77
+ python-version: '3.11'
78
+
79
+ - name: Install build dependencies
80
+ run: pip install build twine
81
+
82
+ - name: Build package
83
+ run: python -m build
84
+
85
+ - name: Check package
86
+ run: twine check dist/*
87
+
88
+ - name: Upload artifacts
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: dist
92
+ path: dist/
@@ -0,0 +1,35 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.11'
18
+
19
+ - name: Install dependencies
20
+ run: pip install build twine
21
+
22
+ - name: Build package
23
+ run: python -m build
24
+
25
+ - name: Publish to PyPI
26
+ env:
27
+ TWINE_USERNAME: __token__
28
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
29
+ run: twine upload dist/*
30
+
31
+ - name: Create GitHub Release
32
+ uses: softprops/action-gh-release@v1
33
+ with:
34
+ generate_release_notes: true
35
+ files: dist/*
@@ -0,0 +1,150 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ .pybuilder/
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # pyenv
84
+ .python-version
85
+
86
+ # pipenv
87
+ Pipfile.lock
88
+
89
+ # poetry
90
+ poetry.lock
91
+
92
+ # pdm
93
+ .pdm.toml
94
+
95
+ # PEP 582
96
+ __pypackages__/
97
+
98
+ # Celery stuff
99
+ celerybeat-schedule
100
+ celerybeat.pid
101
+
102
+ # SageMath parsed files
103
+ *.sage.py
104
+
105
+ # Environments
106
+ .env
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+ # pytype static type analyzer
133
+ .pytype/
134
+
135
+ # Cython debug symbols
136
+ cython_debug/
137
+
138
+ # PyCharm
139
+ .idea/
140
+
141
+ # VS Code
142
+ .vscode/
143
+
144
+ # macOS
145
+ .DS_Store
146
+
147
+ # Crabukit specific
148
+ crabukit.egg-info/
149
+ *.skill
150
+ .scan-results/
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-02-20
9
+
10
+ ### Added
11
+ - Initial release of Crabukit - comprehensive OpenClaw skill security scanner
12
+ - **Prompt Injection Detection**: Direct, indirect, encoded, and typoglycemia attacks
13
+ - **Code Vulnerability Detection**: eval(), exec(), shell injection, path traversal
14
+ - **Secret Detection**: AWS keys, GitHub tokens, OpenAI keys, JWTs, private keys
15
+ - **AI Malware Detection**: PROMPTFLUX/PROMPTSTEAL-style patterns
16
+ - **Supply Chain Detection**: Typosquatting, homoglyphs, hidden files
17
+ - **Tool Combination Analysis**: Detects dangerous tool pairings (Confused Deputy)
18
+ - **Backdoor Detection**: Cron jobs, SSH keys, persistent execution
19
+ - Rich CLI output with severity colors and recommendations
20
+ - JSON output format for automation
21
+ - CI/CD integration with exit codes
22
+ - Comprehensive test suite with malicious skill fixtures
23
+
24
+ ### Security
25
+ - Based on OWASP LLM Top 10
26
+ - Incorporates Lakera AI Q4 2025 research
27
+ - Implements Google Threat Intelligence malware patterns
28
+ - Protects against WithSecure's ReAct Confused Deputy attacks
29
+
30
+ [0.2.0]: https://github.com/troy/crabukit/releases/tag/v0.2.0
@@ -0,0 +1,136 @@
1
+ # Contributing to Crabukit
2
+
3
+ Thank you for your interest in contributing to Crabukit! This document provides guidelines and instructions for contributing.
4
+
5
+ ## ๐Ÿ› Reporting Issues
6
+
7
+ ### Bug Reports
8
+
9
+ Please include:
10
+ - Crabukit version (`crabukit --version`)
11
+ - Python version (`python --version`)
12
+ - Operating system
13
+ - Steps to reproduce
14
+ - Expected vs actual behavior
15
+ - Sample skill that triggers the issue (if applicable)
16
+
17
+ ### Security Vulnerabilities
18
+
19
+ **Do not open public issues for security vulnerabilities.**
20
+
21
+ Instead, email security@crabukit.dev with:
22
+ - Description of the vulnerability
23
+ - Steps to reproduce
24
+ - Potential impact
25
+ - Suggested fix (if any)
26
+
27
+ ## ๐Ÿ’ก Feature Requests
28
+
29
+ We welcome feature requests! Please open an issue with:
30
+ - Clear description of the feature
31
+ - Use case / why it's needed
32
+ - Proposed implementation (if you have ideas)
33
+
34
+ ## ๐Ÿ”ง Development Setup
35
+
36
+ ```bash
37
+ # Clone the repo
38
+ git clone https://github.com/troy/crabukit.git
39
+ cd crabukit
40
+
41
+ # Create virtual environment
42
+ python -m venv .venv
43
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
44
+
45
+ # Install in development mode
46
+ pip install -e ".[dev]"
47
+
48
+ # Run tests
49
+ pytest
50
+
51
+ # Run linting
52
+ ruff check .
53
+ black --check .
54
+ ```
55
+
56
+ ## ๐Ÿ“ Code Style
57
+
58
+ - **Formatter**: [Black](https://github.com/psf/black) (line length 100)
59
+ - **Linter**: [Ruff](https://github.com/astral-sh/ruff)
60
+ - **Type hints**: Required for new code
61
+ - **Docstrings**: Google style
62
+
63
+ ## ๐Ÿงช Testing
64
+
65
+ ```bash
66
+ # Run all tests
67
+ pytest
68
+
69
+ # Run with coverage
70
+ pytest --cov=crabukit --cov-report=html
71
+
72
+ # Run specific test file
73
+ pytest tests/test_python_analyzer.py
74
+ ```
75
+
76
+ ## ๐Ÿ—๏ธ Adding New Detection Rules
77
+
78
+ To add a new security check:
79
+
80
+ 1. **Add the pattern** to `crabukit/rules/patterns.py`:
81
+ ```python
82
+ "my_new_pattern": {
83
+ "pattern": r"regex_here",
84
+ "severity": Severity.HIGH,
85
+ "title": "Descriptive title",
86
+ "description": "What this detects and why it's dangerous",
87
+ "remediation": "How to fix it",
88
+ "cwe": "CWE-XXX", # Optional
89
+ }
90
+ ```
91
+
92
+ 2. **Implement the check** in the appropriate analyzer
93
+ 3. **Add a test case** in `tests/fixtures/`
94
+ 4. **Update documentation** in `docs/rules.md`
95
+
96
+ ## ๐Ÿ“‹ Pull Request Process
97
+
98
+ 1. Fork the repository
99
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
100
+ 3. Make your changes
101
+ 4. Run tests and linting
102
+ 5. Commit with clear messages
103
+ 6. Push to your fork
104
+ 7. Open a Pull Request
105
+
106
+ ### PR Checklist
107
+
108
+ - [ ] Tests pass
109
+ - [ ] Code follows style guidelines
110
+ - [ ] New rules have test cases
111
+ - [ ] Documentation updated
112
+ - [ ] CHANGELOG.md updated
113
+
114
+ ## ๐ŸŽฏ Priority Areas
115
+
116
+ We especially welcome contributions in:
117
+
118
+ - **New detection rules** for emerging AI threats
119
+ - **Performance improvements** for large skills
120
+ - **Better false positive reduction**
121
+ - **Additional output formats** (SARIF, JUnit XML)
122
+ - **Documentation improvements**
123
+ - **CI/CD integrations**
124
+
125
+ ## ๐Ÿ’ฌ Community
126
+
127
+ - GitHub Discussions: [github.com/troy/crabukit/discussions](https://github.com/troy/crabukit/discussions)
128
+ - Issues: [github.com/troy/crabukit/issues](https://github.com/troy/crabukit/issues)
129
+
130
+ ## ๐Ÿ“œ Code of Conduct
131
+
132
+ Be respectful, constructive, and inclusive. We're all here to make AI safer.
133
+
134
+ ---
135
+
136
+ Thank you for contributing to safer AI! ๐Ÿฆ€๐Ÿ”’
crabukit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Troy (Moltatron)
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.