cobraphp 0.1.0.dev1__tar.gz → 0.1.0.dev3__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. {cobraphp-0.1.0.dev1/src/cobraphp.egg-info → cobraphp-0.1.0.dev3}/PKG-INFO +16 -6
  2. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/README.md +14 -4
  3. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/pyproject.toml +2 -2
  4. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/__init__.py +3 -1
  5. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3/src/cobraphp.egg-info}/PKG-INFO +16 -6
  6. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/LICENSE +0 -0
  7. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/setup.cfg +0 -0
  8. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/__init__.py +0 -0
  9. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/_backend.py +0 -0
  10. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/_placeholder.py +0 -0
  11. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_ast_types.py +0 -0
  12. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_call_builder.py +0 -0
  13. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_call_graph.py +0 -0
  14. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_call_graph_nodes.py +0 -0
  15. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_callee_index.py +0 -0
  16. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_defuse_builder.py +0 -0
  17. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_errors.py +0 -0
  18. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_file_filter.py +0 -0
  19. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_project_root.py +0 -0
  20. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_records.py +0 -0
  21. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_semgrep_runner.py +0 -0
  22. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_source_kinds.py +0 -0
  23. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_taint_graph.py +0 -0
  24. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_taint_propagator.py +0 -0
  25. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/_taint_rules.py +0 -0
  26. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/frameworks.toml +0 -0
  27. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/php_ast_types.toml +0 -0
  28. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/rules/database_taint.yaml +0 -0
  29. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/analysis/rules/user_input_taint.yaml +0 -0
  30. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/config.py +0 -0
  31. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/entries.py +0 -0
  32. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/errors.py +0 -0
  33. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/graphs.py +0 -0
  34. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/project.py +0 -0
  35. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/py.typed +0 -0
  36. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp/results.py +0 -0
  37. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp.egg-info/SOURCES.txt +0 -0
  38. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp.egg-info/dependency_links.txt +0 -0
  39. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp.egg-info/requires.txt +0 -0
  40. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/src/cobraphp.egg-info/top_level.txt +0 -0
  41. {cobraphp-0.1.0.dev1 → cobraphp-0.1.0.dev3}/tests/test_interface.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cobraphp
3
- Version: 0.1.0.dev1
4
- Summary: Placeholder for the Python interface of CobraPHP, a static taint analyzer for PHP projects, and a pure-Python static analysis over php-parser-py and Semgrep.
3
+ Version: 0.1.0.dev3
4
+ Summary: Placeholder for the Python interface of CobraPHP, a static taint analyzer for PHP projects.
5
5
  License-Expression: GPL-2.0-only
6
6
  Requires-Python: >=3.11
7
7
  Description-Content-Type: text/markdown
@@ -18,9 +18,9 @@ Python interface of [CobraPHP](https://github.com/jhu-seclab-cobra/CobraPHP), th
18
18
 
19
19
  ## Status
20
20
 
21
- **Placeholder.** This package is a placeholder for the CobraPHP Python interface. The jar interface is not implemented, and `cobraphp.analysis` is an interim pure-Python implementation that the CobraPHP implementation will replace in a later version. Interfaces and results may change between versions.
21
+ **Placeholder.** The Python binding is not fully implemented. Interfaces and results may change between versions.
22
22
 
23
- Two parts. The jar interface is declared only: its types, functions and errors are typed, and every entry raises `NotImplementedError` ("implementation waits for the CobraPHP jar"). The implementation will run the CobraPHP jar in the Python process through JPype; JPype is planned and not yet a dependency. The subpackage `cobraphp.analysis` is implemented: a pure-Python static analysis over [php-parser-py](https://pypi.org/project/php-parser-py/) and [Semgrep](https://semgrep.dev) that builds a call graph and Semgrep-seeded data flow from a parsed PHP project. The version is a pre-release, `0.1.0.dev1`. The name follows the pattern `bindings-<language>-<analyzer>`.
23
+ The subpackage `cobraphp.analysis` builds a call graph and a data flow from a PHP project parsed with [php-parser-py](https://pypi.org/project/php-parser-py/). The version is a pre-release. The name follows the pattern `bindings-<language>-<analyzer>`.
24
24
 
25
25
  ## Install
26
26
 
@@ -30,7 +30,7 @@ From a checkout, with [uv](https://docs.astral.sh/uv/):
30
30
  uv sync
31
31
  ```
32
32
 
33
- `uv sync` installs the package, its dependencies at the versions of `uv.lock` and the check tools. `cobraphp.analysis` runs the `semgrep` program, which the Semgrep dependency installs into the environment; it must be on `PATH`, for example by running commands through `uv run`. The subpackage's Semgrep run sends no version-check request.
33
+ `uv sync` installs the package, its dependencies at the versions of `uv.lock` and the check tools. Run commands through `uv run` so that the programs the dependencies install are on `PATH`.
34
34
 
35
35
  The planned release wheel will bundle the CobraPHP jar. Which Java runtime it uses is undecided ([open gaps](docs/design.md#open-gaps)). Python 3.11 or later.
36
36
 
@@ -75,6 +75,16 @@ for node_id in flow.tainted[USER_INPUT]:
75
75
  print(node_id, backward_slice(flow, node_id, max_depth=3))
76
76
  ```
77
77
 
78
+ Apply the same file exclusions outside `parse_project`:
79
+
80
+ ```python
81
+ from cobraphp.analysis import app_file_filter, framework_excluded_dirs
82
+
83
+ framework_dirs = framework_excluded_dirs(root.resolve())
84
+ app_files = [p for p in root.resolve().rglob("*.php")
85
+ if app_file_filter(p) and not any(p.is_relative_to(d) for d in framework_dirs)]
86
+ ```
87
+
78
88
  Handle a failure:
79
89
 
80
90
  ```python
@@ -98,7 +108,7 @@ python -m pytest
98
108
  python -m mypy
99
109
  ```
100
110
 
101
- Run them inside the environment, for example as `uv run python -m pytest`. The tests marked `integration` run the `semgrep` program; `python -m pytest -m "not integration"` skips them.
111
+ Run them inside the environment, for example as `uv run python -m pytest`. The tests marked `integration` run an external program; `python -m pytest -m "not integration"` skips them.
102
112
 
103
113
  ## License
104
114
 
@@ -4,9 +4,9 @@ Python interface of [CobraPHP](https://github.com/jhu-seclab-cobra/CobraPHP), th
4
4
 
5
5
  ## Status
6
6
 
7
- **Placeholder.** This package is a placeholder for the CobraPHP Python interface. The jar interface is not implemented, and `cobraphp.analysis` is an interim pure-Python implementation that the CobraPHP implementation will replace in a later version. Interfaces and results may change between versions.
7
+ **Placeholder.** The Python binding is not fully implemented. Interfaces and results may change between versions.
8
8
 
9
- Two parts. The jar interface is declared only: its types, functions and errors are typed, and every entry raises `NotImplementedError` ("implementation waits for the CobraPHP jar"). The implementation will run the CobraPHP jar in the Python process through JPype; JPype is planned and not yet a dependency. The subpackage `cobraphp.analysis` is implemented: a pure-Python static analysis over [php-parser-py](https://pypi.org/project/php-parser-py/) and [Semgrep](https://semgrep.dev) that builds a call graph and Semgrep-seeded data flow from a parsed PHP project. The version is a pre-release, `0.1.0.dev1`. The name follows the pattern `bindings-<language>-<analyzer>`.
9
+ The subpackage `cobraphp.analysis` builds a call graph and a data flow from a PHP project parsed with [php-parser-py](https://pypi.org/project/php-parser-py/). The version is a pre-release. The name follows the pattern `bindings-<language>-<analyzer>`.
10
10
 
11
11
  ## Install
12
12
 
@@ -16,7 +16,7 @@ From a checkout, with [uv](https://docs.astral.sh/uv/):
16
16
  uv sync
17
17
  ```
18
18
 
19
- `uv sync` installs the package, its dependencies at the versions of `uv.lock` and the check tools. `cobraphp.analysis` runs the `semgrep` program, which the Semgrep dependency installs into the environment; it must be on `PATH`, for example by running commands through `uv run`. The subpackage's Semgrep run sends no version-check request.
19
+ `uv sync` installs the package, its dependencies at the versions of `uv.lock` and the check tools. Run commands through `uv run` so that the programs the dependencies install are on `PATH`.
20
20
 
21
21
  The planned release wheel will bundle the CobraPHP jar. Which Java runtime it uses is undecided ([open gaps](docs/design.md#open-gaps)). Python 3.11 or later.
22
22
 
@@ -61,6 +61,16 @@ for node_id in flow.tainted[USER_INPUT]:
61
61
  print(node_id, backward_slice(flow, node_id, max_depth=3))
62
62
  ```
63
63
 
64
+ Apply the same file exclusions outside `parse_project`:
65
+
66
+ ```python
67
+ from cobraphp.analysis import app_file_filter, framework_excluded_dirs
68
+
69
+ framework_dirs = framework_excluded_dirs(root.resolve())
70
+ app_files = [p for p in root.resolve().rglob("*.php")
71
+ if app_file_filter(p) and not any(p.is_relative_to(d) for d in framework_dirs)]
72
+ ```
73
+
64
74
  Handle a failure:
65
75
 
66
76
  ```python
@@ -84,7 +94,7 @@ python -m pytest
84
94
  python -m mypy
85
95
  ```
86
96
 
87
- Run them inside the environment, for example as `uv run python -m pytest`. The tests marked `integration` run the `semgrep` program; `python -m pytest -m "not integration"` skips them.
97
+ Run them inside the environment, for example as `uv run python -m pytest`. The tests marked `integration` run an external program; `python -m pytest -m "not integration"` skips them.
88
98
 
89
99
  ## License
90
100
 
@@ -5,8 +5,8 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "cobraphp"
8
- version = "0.1.0.dev1"
9
- description = "Placeholder for the Python interface of CobraPHP, a static taint analyzer for PHP projects, and a pure-Python static analysis over php-parser-py and Semgrep."
8
+ version = "0.1.0.dev3"
9
+ description = "Placeholder for the Python interface of CobraPHP, a static taint analyzer for PHP projects."
10
10
  readme = "README.md"
11
11
  license = "GPL-2.0-only"
12
12
  license-files = ["LICENSE"]
@@ -10,7 +10,7 @@ from php_parser_py import AST
10
10
 
11
11
  from ._call_builder import CallBuilder
12
12
  from ._errors import AnalysisTimeoutError, StaticAnalysisError
13
- from ._file_filter import make_app_file_filter
13
+ from ._file_filter import app_file_filter, framework_excluded_dirs, make_app_file_filter
14
14
  from ._records import DataFlowGraph, backward_slice, call_graph_export, data_flow_graph
15
15
  from ._source_kinds import DATABASE, USER_INPUT
16
16
  from ._taint_propagator import TaintPropagator
@@ -53,8 +53,10 @@ __all__ = [
53
53
  "AnalysisTimeoutError",
54
54
  "DataFlowGraph",
55
55
  "StaticAnalysisError",
56
+ "app_file_filter",
56
57
  "backward_slice",
57
58
  "build_call_graph",
58
59
  "build_data_flow",
60
+ "framework_excluded_dirs",
59
61
  "make_app_file_filter",
60
62
  ]
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cobraphp
3
- Version: 0.1.0.dev1
4
- Summary: Placeholder for the Python interface of CobraPHP, a static taint analyzer for PHP projects, and a pure-Python static analysis over php-parser-py and Semgrep.
3
+ Version: 0.1.0.dev3
4
+ Summary: Placeholder for the Python interface of CobraPHP, a static taint analyzer for PHP projects.
5
5
  License-Expression: GPL-2.0-only
6
6
  Requires-Python: >=3.11
7
7
  Description-Content-Type: text/markdown
@@ -18,9 +18,9 @@ Python interface of [CobraPHP](https://github.com/jhu-seclab-cobra/CobraPHP), th
18
18
 
19
19
  ## Status
20
20
 
21
- **Placeholder.** This package is a placeholder for the CobraPHP Python interface. The jar interface is not implemented, and `cobraphp.analysis` is an interim pure-Python implementation that the CobraPHP implementation will replace in a later version. Interfaces and results may change between versions.
21
+ **Placeholder.** The Python binding is not fully implemented. Interfaces and results may change between versions.
22
22
 
23
- Two parts. The jar interface is declared only: its types, functions and errors are typed, and every entry raises `NotImplementedError` ("implementation waits for the CobraPHP jar"). The implementation will run the CobraPHP jar in the Python process through JPype; JPype is planned and not yet a dependency. The subpackage `cobraphp.analysis` is implemented: a pure-Python static analysis over [php-parser-py](https://pypi.org/project/php-parser-py/) and [Semgrep](https://semgrep.dev) that builds a call graph and Semgrep-seeded data flow from a parsed PHP project. The version is a pre-release, `0.1.0.dev1`. The name follows the pattern `bindings-<language>-<analyzer>`.
23
+ The subpackage `cobraphp.analysis` builds a call graph and a data flow from a PHP project parsed with [php-parser-py](https://pypi.org/project/php-parser-py/). The version is a pre-release. The name follows the pattern `bindings-<language>-<analyzer>`.
24
24
 
25
25
  ## Install
26
26
 
@@ -30,7 +30,7 @@ From a checkout, with [uv](https://docs.astral.sh/uv/):
30
30
  uv sync
31
31
  ```
32
32
 
33
- `uv sync` installs the package, its dependencies at the versions of `uv.lock` and the check tools. `cobraphp.analysis` runs the `semgrep` program, which the Semgrep dependency installs into the environment; it must be on `PATH`, for example by running commands through `uv run`. The subpackage's Semgrep run sends no version-check request.
33
+ `uv sync` installs the package, its dependencies at the versions of `uv.lock` and the check tools. Run commands through `uv run` so that the programs the dependencies install are on `PATH`.
34
34
 
35
35
  The planned release wheel will bundle the CobraPHP jar. Which Java runtime it uses is undecided ([open gaps](docs/design.md#open-gaps)). Python 3.11 or later.
36
36
 
@@ -75,6 +75,16 @@ for node_id in flow.tainted[USER_INPUT]:
75
75
  print(node_id, backward_slice(flow, node_id, max_depth=3))
76
76
  ```
77
77
 
78
+ Apply the same file exclusions outside `parse_project`:
79
+
80
+ ```python
81
+ from cobraphp.analysis import app_file_filter, framework_excluded_dirs
82
+
83
+ framework_dirs = framework_excluded_dirs(root.resolve())
84
+ app_files = [p for p in root.resolve().rglob("*.php")
85
+ if app_file_filter(p) and not any(p.is_relative_to(d) for d in framework_dirs)]
86
+ ```
87
+
78
88
  Handle a failure:
79
89
 
80
90
  ```python
@@ -98,7 +108,7 @@ python -m pytest
98
108
  python -m mypy
99
109
  ```
100
110
 
101
- Run them inside the environment, for example as `uv run python -m pytest`. The tests marked `integration` run the `semgrep` program; `python -m pytest -m "not integration"` skips them.
111
+ Run them inside the environment, for example as `uv run python -m pytest`. The tests marked `integration` run an external program; `python -m pytest -m "not integration"` skips them.
102
112
 
103
113
  ## License
104
114
 
File without changes
File without changes