security-tests-m8 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 (41) hide show
  1. security_tests_m8-0.1.0/.codacy.yml +33 -0
  2. security_tests_m8-0.1.0/.env.example +13 -0
  3. security_tests_m8-0.1.0/.gitattributes +14 -0
  4. security_tests_m8-0.1.0/.github/FUNDING.yml +13 -0
  5. security_tests_m8-0.1.0/.github/dependabot.yml +18 -0
  6. security_tests_m8-0.1.0/.github/workflows/CI.yaml +108 -0
  7. security_tests_m8-0.1.0/.github/workflows/PiPy.yml +56 -0
  8. security_tests_m8-0.1.0/.gitignore +221 -0
  9. security_tests_m8-0.1.0/.markdownlint.json +6 -0
  10. security_tests_m8-0.1.0/CHANGELOG.md +8 -0
  11. security_tests_m8-0.1.0/LICENSE +21 -0
  12. security_tests_m8-0.1.0/PKG-INFO +644 -0
  13. security_tests_m8-0.1.0/README.md +589 -0
  14. security_tests_m8-0.1.0/examples/hardened_m8_full_security/.env.example +25 -0
  15. security_tests_m8-0.1.0/examples/hardened_m8_full_security/README.md +163 -0
  16. security_tests_m8-0.1.0/examples/hardened_m8_full_security/pytest.ini +3 -0
  17. security_tests_m8-0.1.0/examples/hardened_m8_full_security/tests/live/conftest.py +32 -0
  18. security_tests_m8-0.1.0/examples/hardened_m8_full_security/tests/live/test_full_security.py +7 -0
  19. security_tests_m8-0.1.0/pyproject.toml +137 -0
  20. security_tests_m8-0.1.0/ruff.toml +7 -0
  21. security_tests_m8-0.1.0/security_tests_m8/__init__.py +17 -0
  22. security_tests_m8-0.1.0/security_tests_m8/_client.py +75 -0
  23. security_tests_m8-0.1.0/security_tests_m8/_config.py +262 -0
  24. security_tests_m8-0.1.0/security_tests_m8/_detection.py +130 -0
  25. security_tests_m8-0.1.0/security_tests_m8/_preflight.py +137 -0
  26. security_tests_m8-0.1.0/security_tests_m8/_requests.py +60 -0
  27. security_tests_m8-0.1.0/security_tests_m8/cli.py +232 -0
  28. security_tests_m8-0.1.0/security_tests_m8/deployment.py +546 -0
  29. security_tests_m8-0.1.0/security_tests_m8/forge.py +189 -0
  30. security_tests_m8-0.1.0/security_tests_m8/full_security.py +131 -0
  31. security_tests_m8-0.1.0/security_tests_m8/plugin.py +470 -0
  32. security_tests_m8-0.1.0/security_tests_m8/suites/__init__.py +67 -0
  33. security_tests_m8-0.1.0/security_tests_m8/suites/algorithms.py +554 -0
  34. security_tests_m8-0.1.0/security_tests_m8/suites/deployment.py +36 -0
  35. security_tests_m8-0.1.0/security_tests_m8/suites/service.py +138 -0
  36. security_tests_m8-0.1.0/security_tests_m8/suites/token_modes.py +537 -0
  37. security_tests_m8-0.1.0/security_tests_m8/suites/universal.py +1253 -0
  38. security_tests_m8-0.1.0/tests/test_cli.py +264 -0
  39. security_tests_m8-0.1.0/tests/test_config.py +266 -0
  40. security_tests_m8-0.1.0/tests/test_deployment.py +340 -0
  41. security_tests_m8-0.1.0/tests/test_forge.py +108 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ engines:
3
+ bandit:
4
+ enabled: true
5
+ ruff:
6
+ enabled: true
7
+ markdownlint:
8
+ enabled: true
9
+ pylint:
10
+ enabled: false
11
+ prospector:
12
+ enabled: false
13
+ pydocstyle:
14
+ enabled: false
15
+ pycodestyle:
16
+ enabled: false
17
+ pyflakes:
18
+ enabled: false
19
+
20
+ exclude_paths:
21
+ - "tests/**"
22
+ # The reusable suites and the pytest plugin/client are live-test execution
23
+ # code: `assert` is the test mechanism and the "wrong" keys/secrets they use
24
+ # are deliberate forgery fixtures. Excluded from static analysis for the same
25
+ # reason `tests/**` is (see [tool.bandit] in pyproject.toml). Ruff still
26
+ # covers them in the CI `lint` job.
27
+ - "security_tests_m8/suites/**"
28
+ - "security_tests_m8/plugin.py"
29
+ - "security_tests_m8/_client.py"
30
+ - "dist/**"
31
+ - "*.egg-info/**"
32
+ - ".pytest_cache/**"
33
+ - "**/__pycache__/**"
@@ -0,0 +1,13 @@
1
+ LIVE_TEST_AUTH_BASE=changethis
2
+ LIVE_TEST_ADMIN_EMAIL=changethis
3
+ LIVE_TEST_ADMIN_PASSWORD=changethis
4
+ LIVE_TEST_SVC_BASE=changethis
5
+ LIVE_TEST_SVC_BASES=changethis
6
+ LIVE_TEST_DEFAULT_SVC=changethis
7
+ LIVE_TEST_TIMEOUT=changethis
8
+ LIVE_TEST_REPO_ROOT=changethis
9
+ LIVE_TEST_DEPLOYMENT_ROOT=changethis
10
+ LIVE_TEST_PUBLIC_BASE=changethis
11
+ LIVE_TEST_PUBLIC_TLS_VERIFY=changethis
12
+ LIVE_TEST_PRIVATE_API_SECRET=changethis
13
+ LIVE_TEST_REFRESH_SECRET_KEY=changethis
@@ -0,0 +1,14 @@
1
+ # Enforce LF line endings for all text files in this repo.
2
+ * text=auto eol=lf
3
+
4
+ # Explicitly binary — never touch line endings.
5
+ *.png binary
6
+ *.jpg binary
7
+ *.jpeg binary
8
+ *.gif binary
9
+ *.ico binary
10
+ *.woff binary
11
+ *.woff2 binary
12
+ *.ttf binary
13
+ *.eot binary
14
+ *.pyc binary
@@ -0,0 +1,13 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: eliserra
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,18 @@
1
+ version: 2
2
+
3
+ updates:
4
+ # GitHub Actions — keep workflow action SHAs current
5
+ - package-ecosystem: "github-actions"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "monthly"
9
+ commit-message:
10
+ prefix: "ci"
11
+
12
+ # Python — track package dependencies
13
+ - package-ecosystem: "pip"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "monthly"
17
+ commit-message:
18
+ prefix: "deps"
@@ -0,0 +1,108 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ branches: ["main"]
8
+
9
+ env:
10
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11
+
12
+ jobs:
13
+ lint:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
20
+ with:
21
+ python-version: "3.14"
22
+ cache: "pip"
23
+
24
+ - name: Install dev dependencies
25
+ run: pip install -e ".[all,dev]"
26
+
27
+ - name: Check formatting
28
+ run: ruff format --check .
29
+
30
+ - name: Lint
31
+ run: ruff check .
32
+
33
+ typecheck:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
37
+
38
+ - name: Set up Python
39
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
40
+ with:
41
+ python-version: "3.14"
42
+ cache: "pip"
43
+
44
+ - name: Install dependencies
45
+ run: pip install -e ".[all,dev]"
46
+
47
+ - name: Type check
48
+ run: mypy security_tests_m8 --ignore-missing-imports
49
+
50
+ security:
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
54
+
55
+ - name: Set up Python
56
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
57
+ with:
58
+ python-version: "3.14"
59
+
60
+ - name: Install bandit
61
+ run: pip install bandit
62
+
63
+ - name: Run bandit (grade A — no MEDIUM/HIGH issues)
64
+ run: bandit -r security_tests_m8 --severity-level medium -f json -o bandit-report.json
65
+
66
+ - name: Upload bandit report
67
+ if: always()
68
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
69
+ with:
70
+ name: bandit-security-report
71
+ path: bandit-report.json
72
+
73
+ test:
74
+ runs-on: ubuntu-latest
75
+ strategy:
76
+ fail-fast: false
77
+ matrix:
78
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
79
+
80
+ steps:
81
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
82
+
83
+ - name: Set up Python ${{ matrix.python-version }}
84
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
85
+ with:
86
+ python-version: ${{ matrix.python-version }}
87
+ cache: "pip"
88
+
89
+ - name: Install dependencies
90
+ run: pip install -e ".[all,dev]"
91
+
92
+ - name: Run tests
93
+ run: pytest
94
+
95
+ - name: Upload coverage to Codecov
96
+ if: matrix.python-version == '3.11' && github.actor != 'dependabot[bot]'
97
+ uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
98
+ with:
99
+ token: ${{ secrets.CODECOV_TOKEN }}
100
+ files: coverage.xml
101
+ verbose: true
102
+
103
+ - name: Upload coverage to Codacy
104
+ if: matrix.python-version == '3.11' && github.actor != 'dependabot[bot]'
105
+ uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 # v1
106
+ with:
107
+ project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
108
+ coverage-reports: coverage.xml
@@ -0,0 +1,56 @@
1
+ name: Upload Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release-build:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
16
+
17
+ - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
18
+ with:
19
+ python-version: "3.x"
20
+
21
+ - name: Build release distributions
22
+ run: |
23
+ python -m pip install build
24
+ python -m build
25
+
26
+ - name: Upload distributions
27
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
28
+ with:
29
+ name: release-dists
30
+ path: dist/
31
+
32
+ pypi-publish:
33
+ runs-on: ubuntu-latest
34
+ needs:
35
+ - release-build
36
+ permissions:
37
+ # IMPORTANT: this permission is mandatory for trusted publishing
38
+ id-token: write
39
+
40
+ # Dedicated environments with protections for publishing are strongly recommended.
41
+ # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
42
+ environment:
43
+ name: pypi
44
+ url: https://pypi.org/project/fastapi-m8/${{ github.event.release.name }}
45
+
46
+ steps:
47
+ - name: Retrieve release distributions
48
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
49
+ with:
50
+ name: release-dists
51
+ path: dist/
52
+
53
+ - name: Publish release distributions to PyPI
54
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
55
+ with:
56
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,221 @@
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
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # Claude Code local project instructions (never committed)
221
+ CLAUDE.md
@@ -0,0 +1,6 @@
1
+ {
2
+ "MD013": false,
3
+ "MD024": {
4
+ "siblings_only": true
5
+ }
6
+ }
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial reusable pytest plugin and live suite package.
6
+ - Added config/env-driven auth, service, public entrypoint, and secret settings.
7
+ - Ported universal, algorithm-specific, token-mode, and protected endpoint suites.
8
+ - Added Python deployment preflight checks for compose env files and image policies.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eli Serra
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.