apiposture 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 (58) hide show
  1. apiposture-0.1.0/.gitignore +207 -0
  2. apiposture-0.1.0/LICENSE +21 -0
  3. apiposture-0.1.0/PKG-INFO +175 -0
  4. apiposture-0.1.0/README.md +141 -0
  5. apiposture-0.1.0/pyproject.toml +81 -0
  6. apiposture-0.1.0/src/apiposture/__init__.py +3 -0
  7. apiposture-0.1.0/src/apiposture/__main__.py +6 -0
  8. apiposture-0.1.0/src/apiposture/cli/__init__.py +1 -0
  9. apiposture-0.1.0/src/apiposture/cli/app.py +42 -0
  10. apiposture-0.1.0/src/apiposture/cli/license.py +44 -0
  11. apiposture-0.1.0/src/apiposture/cli/scan.py +234 -0
  12. apiposture-0.1.0/src/apiposture/core/__init__.py +1 -0
  13. apiposture-0.1.0/src/apiposture/core/analysis/__init__.py +1 -0
  14. apiposture-0.1.0/src/apiposture/core/analysis/project_analyzer.py +147 -0
  15. apiposture-0.1.0/src/apiposture/core/analysis/source_loader.py +222 -0
  16. apiposture-0.1.0/src/apiposture/core/authorization/__init__.py +1 -0
  17. apiposture-0.1.0/src/apiposture/core/authorization/django_auth.py +167 -0
  18. apiposture-0.1.0/src/apiposture/core/authorization/extractor.py +22 -0
  19. apiposture-0.1.0/src/apiposture/core/authorization/fastapi_auth.py +189 -0
  20. apiposture-0.1.0/src/apiposture/core/authorization/flask_auth.py +155 -0
  21. apiposture-0.1.0/src/apiposture/core/classification/__init__.py +1 -0
  22. apiposture-0.1.0/src/apiposture/core/classification/classifier.py +47 -0
  23. apiposture-0.1.0/src/apiposture/core/configuration/__init__.py +1 -0
  24. apiposture-0.1.0/src/apiposture/core/configuration/loader.py +185 -0
  25. apiposture-0.1.0/src/apiposture/core/discovery/__init__.py +1 -0
  26. apiposture-0.1.0/src/apiposture/core/discovery/base.py +38 -0
  27. apiposture-0.1.0/src/apiposture/core/discovery/django_drf.py +259 -0
  28. apiposture-0.1.0/src/apiposture/core/discovery/fastapi.py +219 -0
  29. apiposture-0.1.0/src/apiposture/core/discovery/flask.py +189 -0
  30. apiposture-0.1.0/src/apiposture/core/licensing/__init__.py +1 -0
  31. apiposture-0.1.0/src/apiposture/core/licensing/context.py +32 -0
  32. apiposture-0.1.0/src/apiposture/core/licensing/manager.py +52 -0
  33. apiposture-0.1.0/src/apiposture/core/models/__init__.py +23 -0
  34. apiposture-0.1.0/src/apiposture/core/models/authorization.py +91 -0
  35. apiposture-0.1.0/src/apiposture/core/models/endpoint.py +96 -0
  36. apiposture-0.1.0/src/apiposture/core/models/enums.py +80 -0
  37. apiposture-0.1.0/src/apiposture/core/models/finding.py +67 -0
  38. apiposture-0.1.0/src/apiposture/core/models/scan_result.py +112 -0
  39. apiposture-0.1.0/src/apiposture/output/__init__.py +1 -0
  40. apiposture-0.1.0/src/apiposture/output/base.py +49 -0
  41. apiposture-0.1.0/src/apiposture/output/json_output.py +17 -0
  42. apiposture-0.1.0/src/apiposture/output/markdown.py +112 -0
  43. apiposture-0.1.0/src/apiposture/output/terminal.py +163 -0
  44. apiposture-0.1.0/src/apiposture/rules/__init__.py +1 -0
  45. apiposture-0.1.0/src/apiposture/rules/base.py +70 -0
  46. apiposture-0.1.0/src/apiposture/rules/consistency/__init__.py +1 -0
  47. apiposture-0.1.0/src/apiposture/rules/consistency/ap003_auth_conflict.py +59 -0
  48. apiposture-0.1.0/src/apiposture/rules/consistency/ap004_missing_auth_writes.py +62 -0
  49. apiposture-0.1.0/src/apiposture/rules/engine.py +83 -0
  50. apiposture-0.1.0/src/apiposture/rules/exposure/__init__.py +1 -0
  51. apiposture-0.1.0/src/apiposture/rules/exposure/ap001_public_without_intent.py +63 -0
  52. apiposture-0.1.0/src/apiposture/rules/exposure/ap002_anonymous_on_write.py +58 -0
  53. apiposture-0.1.0/src/apiposture/rules/privilege/__init__.py +1 -0
  54. apiposture-0.1.0/src/apiposture/rules/privilege/ap005_excessive_roles.py +56 -0
  55. apiposture-0.1.0/src/apiposture/rules/privilege/ap006_weak_role_naming.py +72 -0
  56. apiposture-0.1.0/src/apiposture/rules/surface/__init__.py +1 -0
  57. apiposture-0.1.0/src/apiposture/rules/surface/ap007_sensitive_keywords.py +100 -0
  58. apiposture-0.1.0/src/apiposture/rules/surface/ap008_endpoint_without_auth.py +77 -0
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BlagoCuljak
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,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: apiposture
3
+ Version: 0.1.0
4
+ Summary: A CLI security inspection tool for Python API frameworks
5
+ Project-URL: Homepage, https://github.com/apiposture/apiposture-python
6
+ Project-URL: Documentation, https://github.com/apiposture/apiposture-python#readme
7
+ Project-URL: Repository, https://github.com/apiposture/apiposture-python
8
+ Project-URL: Issues, https://github.com/apiposture/apiposture-python/issues
9
+ Author: ApiPosture Team
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,authorization,django,fastapi,flask,security,static-analysis
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Security
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: rich>=13.0.0
27
+ Requires-Dist: typer>=0.9.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
31
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # ApiPosture
36
+
37
+ A CLI security inspection tool for Python API frameworks. Performs static source-code analysis to identify authorization misconfigurations and security risks.
38
+
39
+ ## Features
40
+
41
+ - **Multi-Framework Support**: FastAPI, Flask, Django REST Framework
42
+ - **8 Security Rules**: Comprehensive detection of common authorization issues
43
+ - **Multiple Output Formats**: Terminal (Rich), JSON, Markdown
44
+ - **Configurable**: YAML-based configuration with suppressions
45
+ - **CI/CD Ready**: Exit codes based on severity for pipeline integration
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install apiposture
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ```bash
56
+ # Scan current directory
57
+ apiposture scan .
58
+
59
+ # Scan specific path with JSON output
60
+ apiposture scan ./src --output json
61
+
62
+ # Scan and fail on high severity findings (for CI)
63
+ apiposture scan . --fail-on high
64
+ ```
65
+
66
+ ## Security Rules
67
+
68
+ | Rule | Name | Severity | Description |
69
+ |------|------|----------|-------------|
70
+ | AP001 | Public without explicit intent | High | Public endpoint without AllowAny or explicit marker |
71
+ | AP002 | Anonymous on write | High | AllowAny on POST/PUT/DELETE/PATCH |
72
+ | AP003 | Auth conflict | Medium | Method-level AllowAny overrides class auth |
73
+ | AP004 | Missing auth on writes | Critical | No auth on write endpoints |
74
+ | AP005 | Excessive roles | Low | >3 roles on single endpoint |
75
+ | AP006 | Weak role naming | Low | Generic names like "user", "admin" |
76
+ | AP007 | Sensitive keywords | Medium | admin/debug/export in public routes |
77
+ | AP008 | Endpoint without auth | High | No auth configuration at all |
78
+
79
+ ## Supported Frameworks
80
+
81
+ ### FastAPI
82
+
83
+ ```python
84
+ from fastapi import Depends, FastAPI
85
+
86
+ @app.get("/protected")
87
+ async def protected(user = Depends(get_current_user)):
88
+ ...
89
+ ```
90
+
91
+ ### Flask
92
+
93
+ ```python
94
+ from flask import Flask
95
+ from flask_login import login_required
96
+
97
+ @app.route("/protected")
98
+ @login_required
99
+ def protected():
100
+ ...
101
+ ```
102
+
103
+ ### Django REST Framework
104
+
105
+ ```python
106
+ from rest_framework.views import APIView
107
+ from rest_framework.permissions import IsAuthenticated
108
+
109
+ class ProtectedView(APIView):
110
+ permission_classes = [IsAuthenticated]
111
+ ```
112
+
113
+ ## Configuration
114
+
115
+ Create `.apiposture.yaml` in your project root:
116
+
117
+ ```yaml
118
+ rules:
119
+ disabled:
120
+ - AP006 # Disable weak role naming check
121
+
122
+ exclude:
123
+ - "**/tests/**"
124
+ - "**/migrations/**"
125
+
126
+ suppressions:
127
+ - rule: AP001
128
+ route: "/health"
129
+ reason: "Health check is intentionally public"
130
+ ```
131
+
132
+ ## CLI Options
133
+
134
+ ```
135
+ apiposture scan [PATH] [OPTIONS]
136
+
137
+ Options:
138
+ -o, --output Output format: terminal, json, markdown
139
+ -f, --output-file Write output to file
140
+ -c, --config Configuration file path
141
+ --severity Minimum severity: info, low, medium, high, critical
142
+ --fail-on Exit code 1 if findings at this severity
143
+ --sort-by Sort by: severity, route, method, classification
144
+ --classification Filter: public, authenticated, role_restricted
145
+ --method Filter: GET, POST, PUT, DELETE, PATCH
146
+ --route-contains Filter routes by substring
147
+ --framework Filter: fastapi, flask, django_drf
148
+ --rule Filter by rule ID
149
+ --no-color Disable colored output
150
+ --no-icons Disable icons
151
+ ```
152
+
153
+ ## Development
154
+
155
+ ```bash
156
+ # Clone the repository
157
+ git clone https://github.com/apiposture/apiposture-python
158
+ cd apiposture-python
159
+
160
+ # Install with dev dependencies
161
+ pip install -e ".[dev]"
162
+
163
+ # Run tests
164
+ pytest
165
+
166
+ # Run linter
167
+ ruff check src tests
168
+
169
+ # Run type checker
170
+ mypy src
171
+ ```
172
+
173
+ ## License
174
+
175
+ MIT
@@ -0,0 +1,141 @@
1
+ # ApiPosture
2
+
3
+ A CLI security inspection tool for Python API frameworks. Performs static source-code analysis to identify authorization misconfigurations and security risks.
4
+
5
+ ## Features
6
+
7
+ - **Multi-Framework Support**: FastAPI, Flask, Django REST Framework
8
+ - **8 Security Rules**: Comprehensive detection of common authorization issues
9
+ - **Multiple Output Formats**: Terminal (Rich), JSON, Markdown
10
+ - **Configurable**: YAML-based configuration with suppressions
11
+ - **CI/CD Ready**: Exit codes based on severity for pipeline integration
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install apiposture
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ # Scan current directory
23
+ apiposture scan .
24
+
25
+ # Scan specific path with JSON output
26
+ apiposture scan ./src --output json
27
+
28
+ # Scan and fail on high severity findings (for CI)
29
+ apiposture scan . --fail-on high
30
+ ```
31
+
32
+ ## Security Rules
33
+
34
+ | Rule | Name | Severity | Description |
35
+ |------|------|----------|-------------|
36
+ | AP001 | Public without explicit intent | High | Public endpoint without AllowAny or explicit marker |
37
+ | AP002 | Anonymous on write | High | AllowAny on POST/PUT/DELETE/PATCH |
38
+ | AP003 | Auth conflict | Medium | Method-level AllowAny overrides class auth |
39
+ | AP004 | Missing auth on writes | Critical | No auth on write endpoints |
40
+ | AP005 | Excessive roles | Low | >3 roles on single endpoint |
41
+ | AP006 | Weak role naming | Low | Generic names like "user", "admin" |
42
+ | AP007 | Sensitive keywords | Medium | admin/debug/export in public routes |
43
+ | AP008 | Endpoint without auth | High | No auth configuration at all |
44
+
45
+ ## Supported Frameworks
46
+
47
+ ### FastAPI
48
+
49
+ ```python
50
+ from fastapi import Depends, FastAPI
51
+
52
+ @app.get("/protected")
53
+ async def protected(user = Depends(get_current_user)):
54
+ ...
55
+ ```
56
+
57
+ ### Flask
58
+
59
+ ```python
60
+ from flask import Flask
61
+ from flask_login import login_required
62
+
63
+ @app.route("/protected")
64
+ @login_required
65
+ def protected():
66
+ ...
67
+ ```
68
+
69
+ ### Django REST Framework
70
+
71
+ ```python
72
+ from rest_framework.views import APIView
73
+ from rest_framework.permissions import IsAuthenticated
74
+
75
+ class ProtectedView(APIView):
76
+ permission_classes = [IsAuthenticated]
77
+ ```
78
+
79
+ ## Configuration
80
+
81
+ Create `.apiposture.yaml` in your project root:
82
+
83
+ ```yaml
84
+ rules:
85
+ disabled:
86
+ - AP006 # Disable weak role naming check
87
+
88
+ exclude:
89
+ - "**/tests/**"
90
+ - "**/migrations/**"
91
+
92
+ suppressions:
93
+ - rule: AP001
94
+ route: "/health"
95
+ reason: "Health check is intentionally public"
96
+ ```
97
+
98
+ ## CLI Options
99
+
100
+ ```
101
+ apiposture scan [PATH] [OPTIONS]
102
+
103
+ Options:
104
+ -o, --output Output format: terminal, json, markdown
105
+ -f, --output-file Write output to file
106
+ -c, --config Configuration file path
107
+ --severity Minimum severity: info, low, medium, high, critical
108
+ --fail-on Exit code 1 if findings at this severity
109
+ --sort-by Sort by: severity, route, method, classification
110
+ --classification Filter: public, authenticated, role_restricted
111
+ --method Filter: GET, POST, PUT, DELETE, PATCH
112
+ --route-contains Filter routes by substring
113
+ --framework Filter: fastapi, flask, django_drf
114
+ --rule Filter by rule ID
115
+ --no-color Disable colored output
116
+ --no-icons Disable icons
117
+ ```
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ # Clone the repository
123
+ git clone https://github.com/apiposture/apiposture-python
124
+ cd apiposture-python
125
+
126
+ # Install with dev dependencies
127
+ pip install -e ".[dev]"
128
+
129
+ # Run tests
130
+ pytest
131
+
132
+ # Run linter
133
+ ruff check src tests
134
+
135
+ # Run type checker
136
+ mypy src
137
+ ```
138
+
139
+ ## License
140
+
141
+ MIT
@@ -0,0 +1,81 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "apiposture"
7
+ version = "0.1.0"
8
+ description = "A CLI security inspection tool for Python API frameworks"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "ApiPosture Team" }
14
+ ]
15
+ keywords = [
16
+ "security",
17
+ "api",
18
+ "fastapi",
19
+ "flask",
20
+ "django",
21
+ "authorization",
22
+ "static-analysis",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Environment :: Console",
27
+ "Intended Audience :: Developers",
28
+ "License :: OSI Approved :: MIT License",
29
+ "Operating System :: OS Independent",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Topic :: Security",
35
+ "Topic :: Software Development :: Quality Assurance",
36
+ ]
37
+ dependencies = [
38
+ "typer>=0.9.0",
39
+ "rich>=13.0.0",
40
+ "pyyaml>=6.0",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+ dev = [
45
+ "pytest>=7.0.0",
46
+ "pytest-cov>=4.0.0",
47
+ "ruff>=0.1.0",
48
+ "mypy>=1.0.0",
49
+ ]
50
+
51
+ [project.scripts]
52
+ apiposture = "apiposture.cli.app:app"
53
+
54
+ [project.urls]
55
+ Homepage = "https://github.com/apiposture/apiposture-python"
56
+ Documentation = "https://github.com/apiposture/apiposture-python#readme"
57
+ Repository = "https://github.com/apiposture/apiposture-python"
58
+ Issues = "https://github.com/apiposture/apiposture-python/issues"
59
+
60
+ [tool.hatch.build.targets.sdist]
61
+ include = [
62
+ "/src",
63
+ ]
64
+
65
+ [tool.hatch.build.targets.wheel]
66
+ packages = ["src/apiposture"]
67
+
68
+ [tool.pytest.ini_options]
69
+ testpaths = ["tests"]
70
+ pythonpath = ["src"]
71
+
72
+ [tool.ruff]
73
+ line-length = 100
74
+ target-version = "py310"
75
+
76
+ [tool.ruff.lint]
77
+ select = ["E", "F", "I", "UP", "B"]
78
+
79
+ [tool.mypy]
80
+ python_version = "3.10"
81
+ strict = true
@@ -0,0 +1,3 @@
1
+ """ApiPosture - Security inspection tool for Python API frameworks."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ """Entry point for running apiposture as a module: python -m apiposture."""
2
+
3
+ from apiposture.cli.app import app
4
+
5
+ if __name__ == "__main__":
6
+ app()
@@ -0,0 +1 @@
1
+ """CLI module for ApiPosture."""
@@ -0,0 +1,42 @@
1
+ """Main CLI application using Typer."""
2
+
3
+ import typer
4
+ from rich.console import Console
5
+
6
+ from apiposture import __version__
7
+ from apiposture.cli.license import license_app
8
+ from apiposture.cli.scan import scan
9
+
10
+ console = Console()
11
+
12
+ app = typer.Typer(
13
+ name="apiposture",
14
+ help="Security inspection tool for Python API frameworks",
15
+ no_args_is_help=True,
16
+ rich_markup_mode="rich",
17
+ )
18
+
19
+ # Register subcommands
20
+ app.command()(scan)
21
+ app.add_typer(license_app, name="license", help="License management commands")
22
+
23
+
24
+ @app.callback(invoke_without_command=True)
25
+ def main(
26
+ ctx: typer.Context,
27
+ version: bool = typer.Option(
28
+ False,
29
+ "--version",
30
+ "-v",
31
+ help="Show version and exit",
32
+ is_eager=True,
33
+ ),
34
+ ) -> None:
35
+ """ApiPosture - Security inspection tool for Python API frameworks."""
36
+ if version:
37
+ console.print(f"apiposture version {__version__}")
38
+ raise typer.Exit()
39
+
40
+
41
+ if __name__ == "__main__":
42
+ app()