coretrace-python-analyzer 0.1.0__tar.gz → 0.2.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.
- coretrace_python_analyzer-0.2.0/CHANGELOG.md +42 -0
- coretrace_python_analyzer-0.2.0/LICENSE +202 -0
- coretrace_python_analyzer-0.2.0/NOTICE +4 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/PKG-INFO +7 -3
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/README.md +3 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/docs/usage.md +96 -20
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/pyproject.toml +4 -4
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/__init__.py +1 -1
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/aiohttp/aiohttp_models.py +61 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/aiohttp/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/bottle/bottle_models.py +39 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/bottle/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/db_drivers/db_driver_models.py +71 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/db_drivers/plugin.toml +9 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/django/django_models.py +11 -3
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/flask/flask_models.py +6 -2
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/python_stdlib/python_stdlib.py +12 -6
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/tornado/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/models/tornado/tornado_models.py +37 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/insecure_tempfile/insecure_tempfile.py +25 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/insecure_tempfile/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/insecure_tls/insecure_tls.py +40 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/insecure_tls/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/unsafe_archive/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/unsafe_archive/unsafe_archive.py +36 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/unsafe_xml/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/unsafe_xml/unsafe_xml.py +35 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/weak_random/plugin.toml +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/bundled/syntax/weak_random/weak_random.py +86 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/cache.py +14 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/cfg/builder.py +7 -2
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/cli.py +40 -2
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/engine.py +48 -6
- coretrace_python_analyzer-0.2.0/src/coretrace_python/findings/baseline.py +99 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/findings/model.py +9 -0
- coretrace_python_analyzer-0.2.0/src/coretrace_python/findings/suppressions.py +71 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/frontend/ast_adapter.py +17 -12
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/hir/nodes.py +17 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/interprocedural/__init__.py +2 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/interprocedural/callgraph.py +56 -9
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/interprocedural/summaries.py +65 -4
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/ir/lowering.py +78 -9
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/ir/model.py +24 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/ir/printer.py +6 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/detectors.py +23 -10
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/secrets.py +60 -4
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/reporters/json_format.py +17 -5
- coretrace_python_analyzer-0.2.0/src/coretrace_python/reporters/report.py +46 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/reporters/sarif.py +40 -16
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/reporters/text.py +5 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/semantic/scopes.py +12 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/taint/engine.py +57 -12
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/taint/routes.py +54 -3
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/DjangoGoat.json +0 -18
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/InsecureGram.json +0 -6
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/MiniBookApiServer.json +0 -6
- coretrace_python_analyzer-0.2.0/tests/regression/expected/dvpwa.json +40 -0
- coretrace_python_analyzer-0.2.0/tests/regression/expected/full-stack-fastapi-template.json +70 -0
- coretrace_python_analyzer-0.2.0/tests/regression/expected/healthchecks.json +448 -0
- coretrace_python_analyzer-0.2.0/tests/regression/expected/httpie.json +58 -0
- coretrace_python_analyzer-0.2.0/tests/regression/expected/luigi.json +352 -0
- coretrace_python_analyzer-0.2.0/tests/regression/expected/pygoat.json +352 -0
- coretrace_python_analyzer-0.2.0/tests/regression/expected/yt-fts.json +34 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/repositories.toml +33 -0
- coretrace_python_analyzer-0.2.0/tests/test_aiohttp_models.py +154 -0
- coretrace_python_analyzer-0.2.0/tests/test_baseline.py +159 -0
- coretrace_python_analyzer-0.2.0/tests/test_class_keywords_with_targets.py +91 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_cli.py +3 -2
- coretrace_python_analyzer-0.2.0/tests/test_credential_context.py +88 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_dependencies.py +1 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_detectors.py +10 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_django_http_clients.py +1 -1
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_docs.py +2 -2
- coretrace_python_analyzer-0.2.0/tests/test_fail_on.py +77 -0
- coretrace_python_analyzer-0.2.0/tests/test_frontend_gaps.py +112 -0
- coretrace_python_analyzer-0.2.0/tests/test_hex_digests.py +89 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_hir_builder.py +3 -3
- coretrace_python_analyzer-0.2.0/tests/test_nonlocal_writeback.py +103 -0
- coretrace_python_analyzer-0.2.0/tests/test_operator_sources.py +79 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_packaging.py +19 -2
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_project.py +1 -1
- coretrace_python_analyzer-0.2.0/tests/test_redirect_targets.py +79 -0
- coretrace_python_analyzer-0.2.0/tests/test_relative_paths.py +125 -0
- coretrace_python_analyzer-0.2.0/tests/test_release.py +40 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_remaining_limits.py +2 -2
- coretrace_python_analyzer-0.2.0/tests/test_scale.py +69 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_secrets_sbom.py +4 -3
- coretrace_python_analyzer-0.2.0/tests/test_suppressions.py +167 -0
- coretrace_python_analyzer-0.2.0/tests/test_syntactic_rules.py +80 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_syntax_coverage.py +2 -2
- coretrace_python_analyzer-0.2.0/tests/test_tornado_bottle_models.py +128 -0
- coretrace_python_analyzer-0.1.0/src/coretrace_python/reporters/report.py +0 -23
- coretrace_python_analyzer-0.1.0/tests/regression/expected/yt-fts.json +0 -28
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/.github/workflows/ci.yml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/.github/workflows/release.yml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/.gitignore +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/docs/architecture.md +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/docs/plugins.md +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/examples/add.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/examples/canonical_symbols.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/__main__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/abstract/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/abstract/constants.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/abstract/heap.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/abstract/ranges.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/abstract/values.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/analysis/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/analysis/manager.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/analysis/provider.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/dependency_policy/dependency_policy.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/dependency_policy/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/reachable_vulnerability/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/reachable_vulnerability/reachable_vulnerability.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/sample_advisories/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/sample_advisories/sample_advisories.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/vulnerable_dependency/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/dependency/vulnerable_dependency/vulnerable_dependency.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/cli/cli_models.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/cli/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/credentials/credential_models.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/credentials/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/django/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/fastapi/fastapi_models.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/fastapi/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/flask/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/http_clients/http_client_models.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/http_clients/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/python_stdlib/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/sqlalchemy/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/models/sqlalchemy/sqlalchemy_models.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/secrets/config_secrets/config_secrets.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/secrets/config_secrets/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/secrets/hardcoded_secrets/hardcoded_secrets.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/secrets/hardcoded_secrets/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/command_injection/command_injection.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/command_injection/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/insecure_deserialization/insecure_deserialization.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/insecure_deserialization/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/open_redirect/open_redirect.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/open_redirect/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/path_traversal/path_traversal.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/path_traversal/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/plaintext_credentials/plaintext_credentials.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/plaintext_credentials/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/sql_injection/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/sql_injection/sql_injection.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/ssrf/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/ssrf/ssrf.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/xss/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/security/xss/xss.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/dangerous_eval/dangerous_eval.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/dangerous_eval/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/flask_debug/flask_debug.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/flask_debug/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/missing_timeout/missing_timeout.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/missing_timeout/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/weak_crypto/plugin.toml +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/bundled/syntax/weak_crypto/weak_crypto.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/cfg/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/cfg/dominance.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/cfg/model.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dataflow/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dataflow/lattice.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dataflow/solver.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dependency/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dependency/advisories.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dependency/correlation.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dependency/graph.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dependency/policy.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/dependency/sbom.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/findings/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/findings/coverage.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/findings/refutation.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/frontend/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/frontend/parser.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/hir/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/hir/visitors.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/interprocedural/modulegraph.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/ir/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/ir/defuse.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/ir/ssa.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/api.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/loader.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/manifest.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/plugins/registry.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/reporters/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/semantic/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/semantic/identity.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/semantic/imports.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/semantic/symbols.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/source/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/source/manager.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/source/model.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/taint/__init__.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/src/coretrace_python/taint/models.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/Chatbot.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/Flask-Image-Editing-Website.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/NPL-IA.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/Spam-Detection-Project.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/Vulnerable_fastapi.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/my_gdb.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/network-topologer.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/uploadbox-cloud-storage-solution.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/expected/vulnerable-flask.json +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/fixtures/vulnerable-flask/README.md +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/fixtures/vulnerable-flask/app.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/fixtures/vulnerable-flask/requirements.txt +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/regression/fixtures/vulnerable-flask/vulnerable_services.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_advisory_feeds.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_analysis_manager.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_architecture.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_audit_detectors.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_cache.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_cfg.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_closures.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_config_secrets_coverage.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_constants.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_correlation.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_dataflow.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_discovery.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_django_routes.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_dominance.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_emit_ir.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_exceptions.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_factories_match_loop_else.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_fastapi_cli_precision.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_frameworks.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_heap.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_imports.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_interprocedural.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_interprocedural_taint.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_ir.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_match_patterns.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_parallel.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_parser.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_plaintext_credentials.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_plugins.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_pyir_imports.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_real_code_precision.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_refutation.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_refutation_evidence.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_regression.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_reporters.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_scopes.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_self_state.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_source_manager.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_ssa.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_symbol_resolution.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_symbols.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_syntax_control_flow.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_syntax_expressions.py +0 -0
- {coretrace_python_analyzer-0.1.0 → coretrace_python_analyzer-0.2.0}/tests/test_taint.py +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (2026-09-06)
|
|
4
|
+
|
|
5
|
+
### Adoption in an existing repository
|
|
6
|
+
|
|
7
|
+
- Report paths are relative to the checked root; the JSON report carries the root and the SARIF log declares it as the `SRCROOT` URI base, so code scanning attaches alerts to files (#75).
|
|
8
|
+
- `# coretrace: ignore` and `# coretrace: ignore[rule, rule]` silence a finding on its line, in Python sources and requirements files; suppressed findings are counted, listed and marked in the reports (#76).
|
|
9
|
+
- `--baseline PATH` records the accepted findings on the first run and fails later runs on new findings only; findings are recognised by file, rule, function and line text, not line number (#77).
|
|
10
|
+
- `--fail-on SEVERITY` sets the exit status to 1 only from that severity up (#78).
|
|
11
|
+
|
|
12
|
+
### Analysis
|
|
13
|
+
|
|
14
|
+
- Assignment expressions, `yield from`, starred assignment targets, class keyword arguments and any assignable `with` target are supported; they used to reject whole files (#80, #86).
|
|
15
|
+
- A `nonlocal` write made by a nested function flows back to the enclosing function when it calls that function directly, the last documented approximation (#84).
|
|
16
|
+
- An attribute a class does not define resolves through its base, so `self.get_argument` in a Tornado handler and `self.request` in a Django class-based view denote the framework's; static methods called on the class resolve to the method and pass no receiver (#89).
|
|
17
|
+
- Route registrations are found inside functions such as `setup_routes(app: Application)`, and `await f()` denotes what `f()` denotes (#88).
|
|
18
|
+
|
|
19
|
+
### Detection
|
|
20
|
+
|
|
21
|
+
- New security models: aiohttp, Tornado, Bottle, and the aiopg, asyncpg, psycopg2 and PyMySQL drivers (#88, #89).
|
|
22
|
+
- New rules: `insecure-tls`, `unsafe-xml`, `unsafe-archive-extraction`, `insecure-temp-file` and `weak-random` (#90).
|
|
23
|
+
|
|
24
|
+
### Precision
|
|
25
|
+
|
|
26
|
+
- Hex digests, subresource-integrity hashes and character-set constants are no longer high-entropy secrets; credentials in test code and template files are reported at low confidence; `token_type`-like names are not credentials (#81, #82, #87).
|
|
27
|
+
- Redirect sinks read their target argument only, so `redirect("url-name", arg)` is not an open redirect (#83).
|
|
28
|
+
- Environment variables and process output are operator-controlled: they carry no command or path kinds, except a downloaded script piped into a shell (#87).
|
|
29
|
+
- A container literal passed to a sink is serialised, never rendered, so it carries no HTML (#89).
|
|
30
|
+
|
|
31
|
+
### Performance and corpus
|
|
32
|
+
|
|
33
|
+
- A module's functions are collected once; 25 to 30 percent faster on large projects, measured on healthchecks, rich and wagtail and recorded in the usage guide (#79).
|
|
34
|
+
- The regression corpus grows to 19 repositories, including healthchecks, dvpwa, pygoat, the FastAPI full-stack template, httpie and luigi (#79, #85).
|
|
35
|
+
|
|
36
|
+
### Packaging
|
|
37
|
+
|
|
38
|
+
- The Apache License 2.0 text ships with the repository and the wheel (#74).
|
|
39
|
+
|
|
40
|
+
## 0.1.0 (2026-09-04)
|
|
41
|
+
|
|
42
|
+
First release on PyPI: the analyzer with its 26 bundled plugins, the regression suite on 13 public repositories and the usage and plugin guides.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: coretrace-python-analyzer
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Static security analysis infrastructure for Python code
|
|
5
5
|
Project-URL: Homepage, https://github.com/CoreTrace/coretrace-python-analyzer
|
|
6
6
|
Project-URL: Repository, https://github.com/CoreTrace/coretrace-python-analyzer
|
|
7
7
|
Project-URL: Issues, https://github.com/CoreTrace/coretrace-python-analyzer/issues
|
|
8
8
|
Author: CoreTrace
|
|
9
|
-
License: Apache-2.0
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
10
12
|
Keywords: python,sast,security,static-analysis,taint
|
|
11
13
|
Classifier: Development Status :: 4 - Beta
|
|
12
14
|
Classifier: Environment :: Console
|
|
13
15
|
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
16
|
Classifier: Programming Language :: Python :: 3
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -72,3 +73,6 @@ python -m pytest -m regression
|
|
|
72
73
|
CORETRACE_REGRESSION_UPDATE=1 python -m pytest -m regression # record an intended change
|
|
73
74
|
```
|
|
74
75
|
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
Apache License 2.0, see [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -31,7 +31,8 @@ coverage: 2/2 files, 12/12 functions
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
The exit status is 0 when nothing was found, 1 when findings were reported and 2 on a
|
|
34
|
-
usage or analysis error, so the command can gate a pipeline as it is.
|
|
34
|
+
usage or analysis error, so the command can gate a pipeline as it is. `--fail-on high`
|
|
35
|
+
keeps reporting every finding but fails only from that severity up.
|
|
35
36
|
|
|
36
37
|
## Command line
|
|
37
38
|
|
|
@@ -52,6 +53,8 @@ coretrace-python-analyzer [--check | --emit-ir [--ssa]] [options] [path]
|
|
|
52
53
|
| `--advisories FILE` | Read a local advisory file in addition to `advisories.json` at the root. Repeatable. |
|
|
53
54
|
| `--policy FILE` | Apply this dependency policy instead of `coretrace-policy.toml` at the root. |
|
|
54
55
|
| `--import-advisories SRC OUT` | Convert an OSV dump into the local advisory file `OUT`, then exit. |
|
|
56
|
+
| `--fail-on SEVERITY` | Exit with status 1 only when a finding of this severity or above was reported: `info`, `low`, `medium`, `high` or `critical`. Default: any finding. |
|
|
57
|
+
| `--baseline PATH` | The accepted findings: written on the first run, then only findings not recorded there fail the check. |
|
|
55
58
|
| `--emit-ir` | Print the intermediate representation of `path` instead of checking it. |
|
|
56
59
|
| `--ssa` | With `--emit-ir`, print the static single assignment form. |
|
|
57
60
|
| `--help` | Show the options and exit. |
|
|
@@ -76,9 +79,15 @@ report's per-file detail tell "no findings" from "nothing analysed".
|
|
|
76
79
|
|
|
77
80
|
Taint follows values between functions and across files through function summaries,
|
|
78
81
|
into objects (containers, attributes, instances of the project's own classes) and through
|
|
79
|
-
closures. Flask, FastAPI and
|
|
80
|
-
URL patterns receive HTTP input
|
|
81
|
-
`
|
|
82
|
+
closures. Flask, FastAPI, Django, aiohttp, Tornado and Bottle route handlers, class-based views
|
|
83
|
+
and registered URL patterns receive HTTP input, and a method a handler class inherits
|
|
84
|
+
from its framework base, `self.get_argument` or `self.request`, denotes the base's; click and Typer commands receive `argv` input; `input()`,
|
|
85
|
+
`sys.argv`, environment variables, the output of local processes and the responses of
|
|
86
|
+
HTTP clients are further sources. The first three are operator-controlled: a command-line
|
|
87
|
+
tool opens the paths it is given, a command or a path built from the environment is the
|
|
88
|
+
operator's own doing, and a path read from a local process is not a traversal, so those
|
|
89
|
+
sources do not carry the corresponding kinds; a downloaded script piped into a shell
|
|
90
|
+
stays a command injection.
|
|
82
91
|
|
|
83
92
|
## Rules
|
|
84
93
|
|
|
@@ -117,6 +126,11 @@ medium confidence. The verdict and its evidence are in the finding's metadata.
|
|
|
117
126
|
| `weak-crypto` | `hashlib.md5`, `hashlib.sha1` and other broken algorithms. |
|
|
118
127
|
| `debug-enabled` | `app.run(debug=True)` on a Flask application. |
|
|
119
128
|
| `missing-timeout` | A Requests or httpx call without a `timeout`. |
|
|
129
|
+
| `insecure-tls` | `verify=False` on a Requests or httpx call, or `ssl._create_unverified_context()`. |
|
|
130
|
+
| `unsafe-xml` | A standard-library or lxml XML parser, which expands entities; `defusedxml` is the safe replacement. |
|
|
131
|
+
| `unsafe-archive-extraction` | `tarfile` or `zipfile` extraction, or `shutil.unpack_archive`, without a member `filter`. |
|
|
132
|
+
| `insecure-temp-file` | `tempfile.mktemp`, which names a file without creating it. |
|
|
133
|
+
| `weak-random` | A `random` function whose result is assigned to a credential-like name, or produced by a function named like one. Medium confidence. |
|
|
120
134
|
|
|
121
135
|
### Secrets
|
|
122
136
|
|
|
@@ -126,8 +140,8 @@ sources and in configuration files.
|
|
|
126
140
|
| Rule | Confidence | Trigger |
|
|
127
141
|
|---|---|---|
|
|
128
142
|
| `hardcoded-secret` | high | A provider-specific format: AWS, GitHub, Slack, Stripe, Google, private keys, JWTs, SendGrid, Twilio. |
|
|
129
|
-
| `hardcoded-credential` | medium | A credential-like name (`password`, `token`, `api_key`, `app.config['SECRET_KEY']`, …) bound to a real value. Placeholders are excluded. |
|
|
130
|
-
| `high-entropy-string` | low | An opaque high-entropy token. |
|
|
143
|
+
| `hardcoded-credential` | medium | A credential-like name (`password`, `token`, `api_key`, `app.config['SECRET_KEY']`, …) bound to a real value. Placeholders are excluded. Low confidence in test code, fixtures and template files such as `.env.example`, with the context in the metadata. |
|
|
144
|
+
| `high-entropy-string` | low | An opaque high-entropy token. Hex digests (MD5, SHA-1, SHA-256, SHA-512 lengths, or a name such as `hash`, `checksum`, `commit`), subresource-integrity hashes (`sha512-…`) and character-set constants are not secrets unless a credential name says so. |
|
|
131
145
|
|
|
132
146
|
### Dependencies
|
|
133
147
|
|
|
@@ -139,39 +153,77 @@ sources and in configuration files.
|
|
|
139
153
|
| `denied-dependency` | A package the policy denies. |
|
|
140
154
|
| `unpinned-dependency` | A requirement without an exact pin when the policy requires pins. |
|
|
141
155
|
|
|
156
|
+
## Suppressing a finding
|
|
157
|
+
|
|
158
|
+
A finding whose line carries a `# coretrace: ignore` comment is suppressed. With a list
|
|
159
|
+
of rules, only those are:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
data = yaml.load(text) # coretrace: ignore[insecure-deserialization]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The comment also works in requirements files, where a line
|
|
166
|
+
`pyyaml==5.3.1 # coretrace: ignore[vulnerable-dependency]` silences that requirement's
|
|
167
|
+
finding. Suppressed findings are kept apart: the text report counts them, the JSON report
|
|
168
|
+
lists them under `suppressed`, the SARIF log marks them as suppressed in source, and
|
|
169
|
+
they never affect the exit status.
|
|
170
|
+
|
|
171
|
+
## Adopting the analyzer on an existing code base
|
|
172
|
+
|
|
173
|
+
A repository with known findings starts from a baseline:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
coretrace-python-analyzer --check src/ --baseline coretrace-baseline.json
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The first run writes the file with every current finding and passes. Later runs set the
|
|
180
|
+
recorded findings apart and fail only on new ones. A finding is recognised by its file,
|
|
181
|
+
its rule, its function and the text of its line, not by its line number, so code inserted
|
|
182
|
+
above it does not make it new; a change to the line itself does. Commit the file and
|
|
183
|
+
shrink it as findings are fixed: an entry without a matching finding is simply unused.
|
|
184
|
+
Baselined findings are counted in the text report, listed under `baselined` in the JSON
|
|
185
|
+
report and marked `baselineState: unchanged` in the SARIF log, where new results are
|
|
186
|
+
marked `new`.
|
|
187
|
+
|
|
142
188
|
## Reports
|
|
143
189
|
|
|
144
190
|
`--format` accepts `text`, `json` and `sarif`.
|
|
145
191
|
|
|
146
192
|
`--format text` prints one line per finding, `path:line:column: severity rule: message`,
|
|
147
|
-
then the count and the coverage line.
|
|
193
|
+
then the count and the coverage line. Paths are relative to the checked directory, or to
|
|
194
|
+
the directory of the checked file; a path outside it is printed as it is.
|
|
148
195
|
|
|
149
196
|
`--format json` prints one document:
|
|
150
197
|
|
|
151
198
|
```json
|
|
152
199
|
{
|
|
153
200
|
"schema_version": 1,
|
|
154
|
-
"tool": {"name": "coretrace-python-analyzer", "version": "0.
|
|
201
|
+
"tool": {"name": "coretrace-python-analyzer", "version": "0.2.0"},
|
|
202
|
+
"root": "/home/me/project",
|
|
155
203
|
"findings": [
|
|
156
204
|
{
|
|
157
205
|
"rule_id": "sql-injection",
|
|
158
206
|
"message": "SQL injection: http input reaches python.sqlite3.connect.cursor.execute",
|
|
159
207
|
"severity": "high",
|
|
160
208
|
"confidence": "high",
|
|
161
|
-
"location": {"path": "
|
|
209
|
+
"location": {"path": "app.py", "line": 50, "column": 21, "end_line": 50, "end_column": 60},
|
|
162
210
|
"function": "user",
|
|
163
211
|
"metadata": {"source": "python.flask.request.args", "verdict": "vulnerability"}
|
|
164
212
|
}
|
|
165
213
|
],
|
|
166
214
|
"coverage": {
|
|
167
215
|
"files": 2, "files_analysed": 2, "functions": 12, "functions_analysed": 12,
|
|
168
|
-
"details": [{"path": "
|
|
216
|
+
"details": [{"path": "app.py", "status": "analysed", "functions": 9, "analysed": 9}]
|
|
169
217
|
}
|
|
170
218
|
}
|
|
171
219
|
```
|
|
172
220
|
|
|
221
|
+
`root` is the directory the paths are relative to.
|
|
222
|
+
|
|
173
223
|
`--format sarif` prints a SARIF 2.1.0 log, one run with the tool, its rules and one
|
|
174
|
-
result per finding
|
|
224
|
+
result per finding. The root is declared once as the `SRCROOT` original URI base and
|
|
225
|
+
every location under it is relative to that base, which is what code scanning services
|
|
226
|
+
need to attach results to files:
|
|
175
227
|
|
|
176
228
|
```bash
|
|
177
229
|
coretrace-python-analyzer --check src/ --format sarif > report.sarif
|
|
@@ -243,15 +295,34 @@ first, so the result is the same whatever `N`.
|
|
|
243
295
|
coretrace-python-analyzer --check src/ --cache .coretrace --jobs 4
|
|
244
296
|
```
|
|
245
297
|
|
|
298
|
+
## Performance
|
|
299
|
+
|
|
300
|
+
Measured on one core of a laptop, single process, cold start, with the bundled plugins
|
|
301
|
+
(September 2026):
|
|
302
|
+
|
|
303
|
+
| Project | Python lines | Functions | Time | Peak memory |
|
|
304
|
+
|---|---:|---:|---:|---:|
|
|
305
|
+
| healthchecks (Django application) | 45 000 | 2 566 | 7 s | 107 MB |
|
|
306
|
+
| rich (library) | 52 000 | 1 198 | 6 s | 106 MB |
|
|
307
|
+
| wagtail (Django CMS) | 273 000 | 12 146 | 85 s | 461 MB |
|
|
308
|
+
|
|
309
|
+
Time grows a little faster than linearly with the size of the project, because the
|
|
310
|
+
interprocedural summaries are iterated to a fixpoint over the module graph. A warm
|
|
311
|
+
`--cache` brings an unchanged healthchecks to about one second, `--jobs 4` saves a
|
|
312
|
+
quarter of the cold time at the cost of one process's memory per job. The
|
|
313
|
+
`healthchecks` repository is part of the regression corpus, so the analysis time of a
|
|
314
|
+
real 45 000-line project is exercised on every change.
|
|
315
|
+
|
|
246
316
|
## Plugins
|
|
247
317
|
|
|
248
|
-
The package ships
|
|
318
|
+
The package ships 35 plugins, loaded by default. Security models for the standard library
|
|
249
319
|
and the supported frameworks: `python-stdlib-models`, `flask-models`, `fastapi-models`,
|
|
250
|
-
`django-models`, `
|
|
251
|
-
`cli-models`. Taint detectors: `command-injection`, `sql-injection`, `path-traversal`,
|
|
320
|
+
`django-models`, `aiohttp-models`, `tornado-models`, `bottle-models`, `sqlalchemy-models`, `db-driver-models` (aiopg,
|
|
321
|
+
asyncpg, psycopg2, PyMySQL), `http-client-models`, `credential-models` and `cli-models`. Taint detectors: `command-injection`, `sql-injection`, `path-traversal`,
|
|
252
322
|
`ssrf`, `xss`, `insecure-deserialization`, `open-redirect` and `plaintext-credentials`.
|
|
253
|
-
Dangerous API detectors: `dangerous-eval`, `weak-crypto`, `flask-debug
|
|
254
|
-
`missing-timeout
|
|
323
|
+
Dangerous API detectors: `dangerous-eval`, `weak-crypto`, `flask-debug`,
|
|
324
|
+
`missing-timeout`, `insecure-tls`, `unsafe-xml`, `unsafe-archive-extraction`,
|
|
325
|
+
`insecure-temp-file` and `weak-random`. Secret scanners: `hardcoded-secrets` for Python sources and
|
|
255
326
|
`config-secrets` for configuration files. Dependency checks: `sample-advisories`,
|
|
256
327
|
`vulnerable-dependency`, `reachable-vulnerability` and `dependency-policy`.
|
|
257
328
|
|
|
@@ -271,7 +342,7 @@ Actions:
|
|
|
271
342
|
|
|
272
343
|
```yaml
|
|
273
344
|
- run: pip install coretrace-python-analyzer
|
|
274
|
-
- run: coretrace-python-analyzer --check src/ --format sarif > coretrace.sarif
|
|
345
|
+
- run: coretrace-python-analyzer --check src/ --fail-on high --format sarif > coretrace.sarif
|
|
275
346
|
continue-on-error: true
|
|
276
347
|
- uses: github/codeql-action/upload-sarif@v3
|
|
277
348
|
with:
|
|
@@ -304,9 +375,14 @@ assignment, list, tuple, set and dict literals with unpacking, f-strings, slices
|
|
|
304
375
|
boolean operators, chained comparisons, keyword and starred arguments, `with`, `assert`,
|
|
305
376
|
`try`/`except`/`else`/`finally`, `await`, `yield`, `if`, `while` and `for` with their
|
|
306
377
|
`else` clauses, `break`, `continue`, `raise` with `from`, conditional expressions,
|
|
307
|
-
comprehensions, lambdas, nested functions and classes, `global`, `nonlocal`, `del
|
|
308
|
-
`
|
|
309
|
-
`
|
|
378
|
+
comprehensions, lambdas, nested functions and classes, `global`, `nonlocal`, `del`,
|
|
379
|
+
assignment expressions (`(y := f(x))`, laid out as an assignment before the statement),
|
|
380
|
+
`yield from`, starred assignment targets (`first, *rest = items`), class keyword arguments
|
|
381
|
+
such as `metaclass=`, `with` targets of any assignable form and `match` with every
|
|
382
|
+
pattern kind. `finally` is modelled on the normal path only. A
|
|
383
|
+
`nonlocal` write made by a nested function flows back to the enclosing variable when the
|
|
384
|
+
enclosing function calls that nested function directly by name; a nested function passed
|
|
385
|
+
around and called elsewhere keeps its writes to itself. Methods of module-level classes are
|
|
310
386
|
analysed like functions.
|
|
311
387
|
|
|
312
388
|
## Looking at the intermediate representation
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["hatchling>=1.
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
3
|
build-backend = "hatchling.build"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "coretrace-python-analyzer"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Static security analysis infrastructure for Python code"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
|
-
license =
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
12
13
|
authors = [{ name = "CoreTrace" }]
|
|
13
14
|
keywords = ["static-analysis", "security", "taint", "sast", "python"]
|
|
14
15
|
classifiers = [
|
|
15
16
|
"Development Status :: 4 - Beta",
|
|
16
17
|
"Environment :: Console",
|
|
17
18
|
"Intended Audience :: Developers",
|
|
18
|
-
"License :: OSI Approved :: Apache Software License",
|
|
19
19
|
"Programming Language :: Python :: 3",
|
|
20
20
|
"Programming Language :: Python :: 3.11",
|
|
21
21
|
"Programming Language :: Python :: 3.12",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""aiohttp security models: handlers receive HTTP input whether they take an annotated
|
|
2
|
+
``web.Request``, are registered on the router or decorated by a ``RouteTableDef``;
|
|
3
|
+
responses, file responses and redirect exceptions are sinks; client sessions are SSRF
|
|
4
|
+
sinks whose responses are untrusted."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import ClassVar
|
|
9
|
+
|
|
10
|
+
from coretrace_python.plugins import ModelPlugin
|
|
11
|
+
from coretrace_python.semantic.symbols import SymbolId
|
|
12
|
+
from coretrace_python.taint import (
|
|
13
|
+
EntryPoint,
|
|
14
|
+
Model,
|
|
15
|
+
RouteRegistrar,
|
|
16
|
+
Sink,
|
|
17
|
+
Source,
|
|
18
|
+
TaintKind,
|
|
19
|
+
TypedParameter,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
_METHODS = ("get", "post", "put", "patch", "delete", "head", "options")
|
|
23
|
+
_REQUEST_CLASSES = ("aiohttp.web.Request", "aiohttp.web_request.Request")
|
|
24
|
+
_ROUTERS = ("aiohttp.web.Application.router", "aiohttp.web.UrlDispatcher")
|
|
25
|
+
_REDIRECTS = ("HTTPFound", "HTTPMovedPermanently", "HTTPSeeOther", "HTTPTemporaryRedirect", "HTTPPermanentRedirect")
|
|
26
|
+
_CLIENT_FUNCTIONS = (
|
|
27
|
+
*(f"aiohttp.ClientSession.{method}" for method in (*_METHODS, "request")),
|
|
28
|
+
*(f"aiohttp.client.ClientSession.{method}" for method in (*_METHODS, "request")),
|
|
29
|
+
"aiohttp.request",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _sym(path: str) -> SymbolId:
|
|
34
|
+
return SymbolId(f"python.{path}")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class AiohttpModels(ModelPlugin):
|
|
38
|
+
name: ClassVar[str] = "aiohttp-models"
|
|
39
|
+
models: ClassVar[tuple[Model, ...]] = (
|
|
40
|
+
# The whole request is attacker-controlled: its query, match info, headers,
|
|
41
|
+
# cookies and body all come from the client.
|
|
42
|
+
*(TypedParameter(_sym(cls), "http") for cls in _REQUEST_CLASSES),
|
|
43
|
+
# ``@routes.get('/')`` on a ``RouteTableDef``.
|
|
44
|
+
*(EntryPoint(_sym(f"aiohttp.web.RouteTableDef.{method}"), "http") for method in (*_METHODS, "route", "view")),
|
|
45
|
+
# ``app.router.add_route('GET', '/', handler)`` and ``app.router.add_get('/', handler)``.
|
|
46
|
+
*(RouteRegistrar(_sym(f"{router}.add_route"), 2, "http", keyword="handler") for router in _ROUTERS),
|
|
47
|
+
*(
|
|
48
|
+
RouteRegistrar(_sym(f"{router}.add_{method}"), 1, "http", keyword="handler")
|
|
49
|
+
for router in _ROUTERS
|
|
50
|
+
for method in (*_METHODS, "view")
|
|
51
|
+
),
|
|
52
|
+
# ``app.add_routes([web.get('/', handler)])``: the route definitions name the handler.
|
|
53
|
+
RouteRegistrar(_sym("aiohttp.web.route"), 2, "http", keyword="handler"),
|
|
54
|
+
*(RouteRegistrar(_sym(f"aiohttp.web.{method}"), 1, "http", keyword="handler") for method in (*_METHODS, "view")),
|
|
55
|
+
Sink(_sym("aiohttp.web.Response"), TaintKind.HTML),
|
|
56
|
+
Sink(_sym("aiohttp.web.FileResponse"), TaintKind.PATH),
|
|
57
|
+
*(Sink(_sym(f"aiohttp.web.{exception}"), TaintKind.REDIRECT) for exception in _REDIRECTS),
|
|
58
|
+
*(Sink(_sym(f"aiohttp.web_exceptions.{exception}"), TaintKind.REDIRECT) for exception in _REDIRECTS),
|
|
59
|
+
*(Sink(_sym(function), TaintKind.SSRF) for function in _CLIENT_FUNCTIONS),
|
|
60
|
+
*(Source(_sym(function), "http-response") for function in _CLIENT_FUNCTIONS),
|
|
61
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Bottle security models: ``@route``, ``@get`` and the methods of a ``Bottle`` application
|
|
2
|
+
are entry points, ``bottle.request`` is the HTTP source, ``redirect``, ``static_file``,
|
|
3
|
+
``template`` and ``HTTPResponse`` are sinks, ``html_escape`` a sanitizer."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import ClassVar
|
|
8
|
+
|
|
9
|
+
from coretrace_python.plugins import ModelPlugin
|
|
10
|
+
from coretrace_python.semantic.symbols import SymbolId
|
|
11
|
+
from coretrace_python.taint import EntryPoint, Model, Sanitizer, Sink, Source, TaintKind
|
|
12
|
+
|
|
13
|
+
_METHODS = ("route", "get", "post", "put", "delete", "patch")
|
|
14
|
+
_REQUEST_ATTRIBUTES = (
|
|
15
|
+
"query", "forms", "params", "json", "body", "headers", "cookies", "GET", "POST", "files",
|
|
16
|
+
"url", "path", "fullpath", "query_string", "get_cookie", "get_header",
|
|
17
|
+
)
|
|
18
|
+
_FIRST_ONLY = lambda kind: ((kind, (0,)),)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _sym(path: str) -> SymbolId:
|
|
22
|
+
return SymbolId(f"python.{path}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class BottleModels(ModelPlugin):
|
|
26
|
+
name: ClassVar[str] = "bottle-models"
|
|
27
|
+
models: ClassVar[tuple[Model, ...]] = (
|
|
28
|
+
*(EntryPoint(_sym(f"bottle.{method}"), "http") for method in _METHODS),
|
|
29
|
+
*(EntryPoint(_sym(f"bottle.Bottle.{method}"), "http") for method in _METHODS),
|
|
30
|
+
*(Source(_sym(f"bottle.request.{attribute}"), "http") for attribute in _REQUEST_ATTRIBUTES),
|
|
31
|
+
Sink(_sym("bottle.redirect"), TaintKind.REDIRECT, _FIRST_ONLY(TaintKind.REDIRECT)),
|
|
32
|
+
# ``static_file(filename, root)``: the root is the application's own.
|
|
33
|
+
Sink(_sym("bottle.static_file"), TaintKind.PATH, _FIRST_ONLY(TaintKind.PATH)),
|
|
34
|
+
# ``template(source_or_name, **variables)``: a tainted template is injection, the
|
|
35
|
+
# variables are escaped by the engine.
|
|
36
|
+
Sink(_sym("bottle.template"), TaintKind.HTML, _FIRST_ONLY(TaintKind.HTML)),
|
|
37
|
+
Sink(_sym("bottle.HTTPResponse"), TaintKind.HTML),
|
|
38
|
+
Sanitizer(_sym("bottle.html_escape"), TaintKind.HTML),
|
|
39
|
+
)
|