graphify-php 0.0.6__tar.gz → 0.0.9__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.
- graphify_php-0.0.9/.github/workflows/graphify-canary.yml +39 -0
- graphify_php-0.0.9/.graphifyignore +38 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/PKG-INFO +7 -17
- {graphify_php-0.0.6 → graphify_php-0.0.9}/README.md +5 -15
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/index.md +5 -0
- graphify_php-0.0.9/docs/routes.md +287 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/pyproject.toml +3 -1
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/core_guard.py +20 -5
- graphify_php-0.0.9/src/graphify_php/frameworks/__init__.py +16 -0
- graphify_php-0.0.9/src/graphify_php/frameworks/codeigniter.py +1760 -0
- graphify_php-0.0.9/src/graphify_php/frameworks/detect.py +62 -0
- graphify_php-0.0.9/src/graphify_php/frameworks/laravel.py +2129 -0
- graphify_php-0.0.9/src/graphify_php/frameworks/matching.py +64 -0
- graphify_php-0.0.9/src/graphify_php/frameworks/provider.py +252 -0
- graphify_php-0.0.9/src/graphify_php/frameworks/symfony.py +821 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/graph_adapter.py +293 -6
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/resolver.py +236 -12
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/sources/route_source.py +79 -11
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/sources/tree_sitter_source.py +1 -1
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/status.py +42 -0
- graphify_php-0.0.9/src/graphify_php/syntax/access_control.py +836 -0
- graphify_php-0.0.9/src/graphify_php/syntax/attributes.py +190 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/facts.py +9 -4
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/file_scan.py +55 -14
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/names.py +27 -0
- graphify_php-0.0.9/src/graphify_php/syntax/routes.py +782 -0
- graphify_php-0.0.9/tests/conftest.py +15 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Config/AdminRoutes.php +4 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Config/Filters.php +46 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Config/Modules.php +12 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Config/Routes.php +39 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Config/Routing.php +19 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Account.php +11 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Admin/Users.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Albums.php +9 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Api/Tokens.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Contact.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Files.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Home.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Panel.php +11 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Photos.php +14 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Reports.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Search.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/app/Controllers/Users.php +10 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/composer.json +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/codeigniter/composer.lock +6 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/Api/TokenController.php +20 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/Controller.php +10 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/PhotoController.php +10 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/PostController.php +25 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/ReportController.php +24 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/ShowDashboard.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/app/Http/Controllers/UserController.php +33 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/bootstrap/app.php +16 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/composer.json +7 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/composer.lock +10 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/routes/admin.php +6 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/routes/api.php +8 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/routes/console.php +7 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/routes/orphan.php +6 -0
- graphify_php-0.0.9/tests/fixtures/frameworks/laravel/routes/web.php +53 -0
- graphify_php-0.0.9/tests/test_access_checks.py +561 -0
- graphify_php-0.0.9/tests/test_access_control_segments.py +911 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_cli_end_to_end.py +18 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_core_guard.py +21 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_engine_extracted.py +44 -2
- graphify_php-0.0.9/tests/test_framework_codeigniter.py +1228 -0
- graphify_php-0.0.9/tests/test_framework_laravel.py +1843 -0
- graphify_php-0.0.9/tests/test_framework_providers.py +461 -0
- graphify_php-0.0.9/tests/test_namespace_blocks.py +208 -0
- graphify_php-0.0.9/tests/test_route_schema.py +520 -0
- graphify_php-0.0.9/tests/test_routes_stacked_guards.py +367 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_syntax_routes.py +27 -27
- graphify_php-0.0.6/.graphifyignore +0 -29
- graphify_php-0.0.6/src/graphify_php/syntax/routes.py +0 -288
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.github/workflows/ci.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.github/workflows/pages.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.github/workflows/release.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.github/workflows/stage-build.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.github/workflows/stage-security.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.github/workflows/stage-tests.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.gitignore +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.gitleaks.toml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/.trufflehog-exclude.txt +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/LICENSE +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/_config.yml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/architecture.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/assets/css/style.scss +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/configuration.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/evaluation.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/install.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/phpstan.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/docs/setup.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/README.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/__init__.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/canaries.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/chained.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/ctor_body_assign.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/declared_property.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/dynamic.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/handler_shapes.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/inheritance.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/interfaces.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/locals_new.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/mail.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/nullable_union.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/promoted.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/same_name_traps.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/secrets.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/services.yaml +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/fixtures/traits.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/reference_set.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/eval/score.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/README.md +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/autoload.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/src/CallGraph/CallEdge.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/src/CallGraph/CallEdgeRule.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/src/CallGraph/CallEdgeWriter.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/src/CallGraph/JsonLinesWriter.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/php/src/CallGraph/MethodCallCollector.php +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/__init__.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/cli.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/__init__.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/class_lookup.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/discovery.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/document.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/emit.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/environment.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/facts.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/messaging.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/ports.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config/safe_yaml.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/config_resolver.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/__init__.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/facts.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/layer.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/locator.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/overlay.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/ports.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/reader.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/container/reasons.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/ports.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/shrink.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/shrink_cli.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/sources/phpstan_source.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/call_sites.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/class_index.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/collectors.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/src/graphify_php/syntax/nodes.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/new_graph.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/new_manifest.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/old_graph.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/old_manifest.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/present.txt +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/games/new_graph.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/games/new_manifest.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/games/old_graph.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/games/old_manifest.json +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/fixtures/shrink/games/present.txt +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_adapter_graph.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_cli_attribution.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_cli_gate.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_cli_shrink_gate.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_config_readers.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_config_resolver.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_container_integration.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_container_layer.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_container_overlay.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_container_reader.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_engine_contradictions.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_eval_canaries.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_eval_reference_set.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_eval_score.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_new_site_edges.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_phpstan_integration.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_phpstan_source.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_resolver_precedence.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_shrink.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_shrink_attribution.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_shrink_cli.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_status_record.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_syntax_parameters.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_syntax_scan.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_syntax_writes.py +0 -0
- {graphify_php-0.0.6 → graphify_php-0.0.9}/tests/test_tree_sitter_source.py +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: graphify canary
|
|
2
|
+
|
|
3
|
+
# CI installs graphify up to the release tests/test_core_guard.py PINNED_SHAPE was checked
|
|
4
|
+
# against (the cap in pyproject.toml). This run installs the newest graphify instead, so a red
|
|
5
|
+
# run here means a new graphify release changed something: re-check core's PHP pass, add a
|
|
6
|
+
# PINNED_SHAPE row, then raise the cap. It is a separate workflow so that CI stays a signal
|
|
7
|
+
# about this repository's code.
|
|
8
|
+
on:
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: '30 3 * * *'
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test-latest-graphify:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.13"
|
|
30
|
+
|
|
31
|
+
- name: Install graphify-php with the newest graphify
|
|
32
|
+
# Not the test extra: its cap would hold graphify back.
|
|
33
|
+
run: pip install -e . "pytest>=7.0" graphifyy
|
|
34
|
+
|
|
35
|
+
- name: Show the graphify release under test
|
|
36
|
+
run: pip show graphifyy
|
|
37
|
+
|
|
38
|
+
- name: Run the test suite
|
|
39
|
+
run: python -m pytest -rs
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.idea/
|
|
2
|
+
.claude/
|
|
3
|
+
.github/
|
|
4
|
+
.git/
|
|
5
|
+
.cache/
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.serena/
|
|
8
|
+
|
|
9
|
+
docs/
|
|
10
|
+
eval/fixtures/
|
|
11
|
+
build/
|
|
12
|
+
dist/
|
|
13
|
+
|
|
14
|
+
graphify-out
|
|
15
|
+
graphify-out/
|
|
16
|
+
|
|
17
|
+
*.png
|
|
18
|
+
*.jpg
|
|
19
|
+
*.jpeg
|
|
20
|
+
*.gif
|
|
21
|
+
*.svg
|
|
22
|
+
*.generated.py
|
|
23
|
+
*.min.js
|
|
24
|
+
*.pem
|
|
25
|
+
.env
|
|
26
|
+
.env.*
|
|
27
|
+
.npmrc
|
|
28
|
+
auth.json
|
|
29
|
+
LICENSE
|
|
30
|
+
|
|
31
|
+
# Tests are excluded from the graph: they added nodes and edges without
|
|
32
|
+
# answering code questions (2026-11-16).
|
|
33
|
+
# 2026-11-19: tests are indexed and demoted at query time instead (graphify-mesh non-source demotion).
|
|
34
|
+
# /tests/
|
|
35
|
+
|
|
36
|
+
# Markdown is not indexed: semantic passes on README.md time out on ai1
|
|
37
|
+
# (504 at 540 s) and add doc concepts, not code (2026-11-23).
|
|
38
|
+
*.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: graphify-php
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: PHP member-call resolution for graphify: binds $this->service->method() to the method node it calls.
|
|
5
5
|
Author: Andrii Afanasiev
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -15,7 +15,7 @@ Requires-Dist: pyyaml>=6.0
|
|
|
15
15
|
Provides-Extra: lint
|
|
16
16
|
Requires-Dist: ruff>=0.15; extra == 'lint'
|
|
17
17
|
Provides-Extra: test
|
|
18
|
-
Requires-Dist: graphifyy
|
|
18
|
+
Requires-Dist: graphifyy<=0.9.115,>=0.9.66; extra == 'test'
|
|
19
19
|
Requires-Dist: pytest>=7.0; extra == 'test'
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
@@ -172,21 +172,11 @@ a file.
|
|
|
172
172
|
|
|
173
173
|
## Routes
|
|
174
174
|
|
|
175
|
-
A second registered pass publishes what `#[Route]` attributes declare
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
The node key is `Class::method#path`, so two controller methods declaring the same path stay two
|
|
181
|
-
nodes. That is not hypothetical: the reference application declares 156 routes over 135 distinct
|
|
182
|
-
path templates, the repeats being different HTTP verbs on one path.
|
|
183
|
-
|
|
184
|
-
The relation is `handled_by`, not `routed_to` — the latter already means messenger transport
|
|
185
|
-
routing, and merging the two would put HTTP paths and message transports in one query.
|
|
186
|
-
|
|
187
|
-
A declaration whose controller method is missing from the graph still gets its node; only the
|
|
188
|
-
edge is withheld, and the omission is counted under `controller_not_in_graph`. The path is a
|
|
189
|
-
fact about the codebase either way.
|
|
175
|
+
A second registered pass publishes what `#[Route]` attributes declare (Symfony), plus Laravel
|
|
176
|
+
and CodeIgniter 4 route files. Each declaration becomes one node and one `handled_by` edge to
|
|
177
|
+
the controller method that serves it. Access guards become `access_guard` nodes reached by
|
|
178
|
+
`guarded_by` and `checks_access` edges. The route schema, providers, guard rules and limits are
|
|
179
|
+
in [docs/routes.md](docs/routes.md).
|
|
190
180
|
|
|
191
181
|
## Verifying it works
|
|
192
182
|
|
|
@@ -151,21 +151,11 @@ a file.
|
|
|
151
151
|
|
|
152
152
|
## Routes
|
|
153
153
|
|
|
154
|
-
A second registered pass publishes what `#[Route]` attributes declare
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
The node key is `Class::method#path`, so two controller methods declaring the same path stay two
|
|
160
|
-
nodes. That is not hypothetical: the reference application declares 156 routes over 135 distinct
|
|
161
|
-
path templates, the repeats being different HTTP verbs on one path.
|
|
162
|
-
|
|
163
|
-
The relation is `handled_by`, not `routed_to` — the latter already means messenger transport
|
|
164
|
-
routing, and merging the two would put HTTP paths and message transports in one query.
|
|
165
|
-
|
|
166
|
-
A declaration whose controller method is missing from the graph still gets its node; only the
|
|
167
|
-
edge is withheld, and the omission is counted under `controller_not_in_graph`. The path is a
|
|
168
|
-
fact about the codebase either way.
|
|
154
|
+
A second registered pass publishes what `#[Route]` attributes declare (Symfony), plus Laravel
|
|
155
|
+
and CodeIgniter 4 route files. Each declaration becomes one node and one `handled_by` edge to
|
|
156
|
+
the controller method that serves it. Access guards become `access_guard` nodes reached by
|
|
157
|
+
`guarded_by` and `checks_access` edges. The route schema, providers, guard rules and limits are
|
|
158
|
+
in [docs/routes.md](docs/routes.md).
|
|
169
159
|
|
|
170
160
|
## Verifying it works
|
|
171
161
|
|
|
@@ -38,6 +38,11 @@ title: Documentation
|
|
|
38
38
|
<strong>Architecture</strong>
|
|
39
39
|
<span>Understand the ports, source precedence, edge keys, and unresolved reasons.</span>
|
|
40
40
|
</a>
|
|
41
|
+
<a class="docs-card" href="routes.html">
|
|
42
|
+
<span class="docs-card-label">Reference</span>
|
|
43
|
+
<strong>Routes</strong>
|
|
44
|
+
<span>Look up route nodes, the Laravel and CodeIgniter providers, and access guards.</span>
|
|
45
|
+
</a>
|
|
41
46
|
<a class="docs-card" href="phpstan.html">
|
|
42
47
|
<span class="docs-card-label">Sources</span>
|
|
43
48
|
<strong>PHPStan source</strong>
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Routes
|
|
2
|
+
|
|
3
|
+
A second registered pass publishes what `#[Route]` attributes declare. Each declaration becomes
|
|
4
|
+
one node — labelled with the path template, carrying the route name, the HTTP methods and
|
|
5
|
+
whether the path was composed whole — and one `handled_by` edge to the controller method that
|
|
6
|
+
serves it. `route_path` holds the full composed path, `""` when it could not be composed.
|
|
7
|
+
|
|
8
|
+
Every `#[Route]` on a method is a route of its own, stacked in separate groups or listed in one.
|
|
9
|
+
Only the first class-level `#[Route]` is the prefix. An invokable class with no method routes
|
|
10
|
+
turns each class-level `#[Route]` into a route for `__invoke`. A path may be a string literal,
|
|
11
|
+
`self::NAME` for a string constant declared in the same class body, or a `.` concatenation of
|
|
12
|
+
those; `static::NAME`, inherited constants and any `self::NAME` in a trait (where `self` is the
|
|
13
|
+
using class) are refused as `path-not-literal`.
|
|
14
|
+
|
|
15
|
+
The node key is `Class::method#path`, so two controller methods declaring the same path stay two
|
|
16
|
+
nodes. An older measurement of the reference application found more route declarations than
|
|
17
|
+
distinct path templates, the repeats being different HTTP verbs on one path.
|
|
18
|
+
|
|
19
|
+
The relation is `handled_by`, not `routed_to` — the latter already means messenger transport
|
|
20
|
+
routing, and merging the two would put HTTP paths and message transports in one query.
|
|
21
|
+
|
|
22
|
+
A declaration whose controller method is missing from the graph still gets its node; only the
|
|
23
|
+
edge is withheld, and the omission is counted under `controller_not_in_graph`. The path is a
|
|
24
|
+
fact about the codebase either way.
|
|
25
|
+
|
|
26
|
+
Route nodes follow `route_schema: 2` and carry these fields after the ones above. The reason a
|
|
27
|
+
template is `""` or only partly trusted is also on the node, in `route_template_reason` (`""`
|
|
28
|
+
when there is none):
|
|
29
|
+
|
|
30
|
+
- `route_template`: the path with `{name}` placeholders and a leading `/`, `{name?}` for an
|
|
31
|
+
optional one. Symfony inline requirements and defaults are dropped: `{id<\d+>}` is `{id}`,
|
|
32
|
+
`{page<\d+>?1}` and `{page?1}` are `{page?}`. A `defaults:` key also makes a trailing
|
|
33
|
+
placeholder optional. It is `""` when the path could not be composed, or with a counted
|
|
34
|
+
reason: `route-template-multi-segment` when an inline or `requirements:` regex may match `/`
|
|
35
|
+
(anything not provably slash-free counts), `route-template-optional-literal` for an optional
|
|
36
|
+
literal part such as `[/edit]` (other providers), `route-template-unparsed` for a brace that is
|
|
37
|
+
not a placeholder. A `requirements:` value reads like a route path: a string literal,
|
|
38
|
+
`self::NAME` for a string constant declared once in the same class body, or a `.` of those.
|
|
39
|
+
The whole `requirements:` array may be `self::NAME` for a literal array constant declared once
|
|
40
|
+
in the same class body, and that array or an inline one may spread (`...self::OTHER`) another
|
|
41
|
+
such constant; later keys win, and a cycle or any unreadable element leaves the whole array
|
|
42
|
+
unread. Any other value (`static::`, another class, an inherited or trait constant) keeps the template
|
|
43
|
+
and is counted as `route-template-requirement-unread`. The status record shows these under the
|
|
44
|
+
route source's prefix, e.g. `tree_sitter_routes:route-template-multi-segment`.
|
|
45
|
+
- `declared_in`: the declaring file, equal to `source_file`.
|
|
46
|
+
- `effective_guards`: the sorted ids of the guard nodes proved to apply: route-scoped guards
|
|
47
|
+
(`access_control`), guards on the handler method and guards on its class. `checks_access`
|
|
48
|
+
targets are not included. `[]` when none.
|
|
49
|
+
- `authorization_state`: `covered` when an effective guard has `guard_kind: "authorization"`;
|
|
50
|
+
otherwise `undecided` when the `access_control` step could not decide the route or an
|
|
51
|
+
effective guard is `unknown`; otherwise `not_proven`.
|
|
52
|
+
- `authorization_reason`: `""` unless undecided, then `access-control-undecided`,
|
|
53
|
+
`access-control-blocked` (unread `security.yaml`, a config blocker, or a route path or prefix
|
|
54
|
+
that is not a literal) or `guard-kind-unknown`.
|
|
55
|
+
- `handler_kind`: `method` when the node has a `handled_by` edge, `closure` when the action is a
|
|
56
|
+
closure or arrow function (no handler node exists, so no edge), `unresolved` when the named
|
|
57
|
+
handler is not in the graph (counted under `controller_not_in_graph`, no edge). `method` holds
|
|
58
|
+
exactly when a `handled_by` edge leaves the node. A node shared by several declarations is
|
|
59
|
+
`method` when any of them produced the edge.
|
|
60
|
+
|
|
61
|
+
## Laravel provider
|
|
62
|
+
|
|
63
|
+
The Laravel provider (`frameworks/laravel.py`) reads routes files loaded from
|
|
64
|
+
`bootstrap/app.php` `withRouting(web:, api:, apiPrefix:)`. Behaviour follows the framework source
|
|
65
|
+
as recorded in a docs check; each rule cites its item in a `docs-check laravel` comment.
|
|
66
|
+
|
|
67
|
+
Covered:
|
|
68
|
+
|
|
69
|
+
- Verbs, `match`, and `any` as the installed `Router::$verbs`. The version comes from
|
|
70
|
+
`composer.lock` `packages` at minor precision. QUERY and `Route::query()` start at v13.35.0.
|
|
71
|
+
With no version or no minor read (`13.x-dev`), `any` leaves QUERY out and
|
|
72
|
+
`laravel-version-unread` is counted once.
|
|
73
|
+
- Registrar calls straight before a verb (`Route::prefix('p')->get('b', ...)`) are the route
|
|
74
|
+
action, not a group. Inside a group with prefix `g` the path is `p/g/b`. Group middleware comes
|
|
75
|
+
before registrar middleware, and the registrar `as` is appended. A repeated registrar call
|
|
76
|
+
replaces the earlier one; only `withoutMiddleware` accumulates.
|
|
77
|
+
- `Route::controller(X)->get('b', 'm')` does not bind `X`: the route is published with
|
|
78
|
+
`handler_kind: "unresolved"` under `laravel-registrar-controller-rejected-by-framework`,
|
|
79
|
+
unless an enclosing group sets a controller. Laravel itself rejects such a route at
|
|
80
|
+
registration (`RouteAction::makeInvokable` throws "Invalid route action"), so it is not an
|
|
81
|
+
unguarded endpoint.
|
|
82
|
+
- Groups: prefix, `as`, middleware, `withoutMiddleware`, `where`, `controller` (an inner one
|
|
83
|
+
overrides), `namespace` (joined unless it starts with `\`). Array groups take the aliased keys
|
|
84
|
+
`as`, `scope_bindings` and `excluded_middleware`.
|
|
85
|
+
- Route-level `->prefix()` in front of the built URI, applied in written order. Route-level
|
|
86
|
+
`->name()` appends to the name the route already has.
|
|
87
|
+
- String actions get the group namespace unless they start with `\` or with that namespace.
|
|
88
|
+
A `use` line never applies to a string. In a `controller` group, `Foo@bar` keeps its class and
|
|
89
|
+
a bare method name takes the group controller. A bare string that contains `\` or names a
|
|
90
|
+
corpus class is refused, because `class_exists()` decides it at runtime. Array actions get
|
|
91
|
+
neither the controller nor the namespace.
|
|
92
|
+
- Name prefixes (`as`) concatenate with no separator: `name('admin')` and `name('index')` give
|
|
93
|
+
`adminindex`.
|
|
94
|
+
- `resource`, `apiResource`, `resources`, `apiResources`, nested `photos.comments`, `->shallow()`,
|
|
95
|
+
`singleton` and `apiSingleton` with `creatable()` and `destroyable()`. A name with `/`
|
|
96
|
+
(`admin/photos`) registers its last segment inside a prefix group of the rest.
|
|
97
|
+
- Controller middleware from `HasMiddleware::middleware()` and the `#[Middleware]` and
|
|
98
|
+
`#[Authorize]` attributes (from v13.0.0) and `#[WithoutMiddleware]` (from v13.20.0) on a class
|
|
99
|
+
or a method. `#[Authorize('x')]` shares the guard node of `->can('x')` and `can:x`.
|
|
100
|
+
`#[WithoutMiddleware]` removes route and group middleware as well as controller middleware.
|
|
101
|
+
From v13.5.0 a parent class's attributes apply too: they are counted under
|
|
102
|
+
`laravel-controller-attribute-inherited`, not published. From v13.20.0 an inherited
|
|
103
|
+
`#[WithoutMiddleware]`, or a parent outside the corpus (`laravel-controller-parent-unread`),
|
|
104
|
+
leaves that handler with no proved route guard. `Illuminate\Routing\Controller` ends the walk.
|
|
105
|
+
- `withRouting(using:, then:)`: a closure `then` makes Laravel ignore `using` and load the
|
|
106
|
+
`web` / `api` files.
|
|
107
|
+
- Guard kinds: `can` is `authorization`; `auth`, `auth:*`, `auth.basic`, `auth.session`, `guest`,
|
|
108
|
+
`verified` and `password.confirm` are `authentication`; any other alias is `middleware`.
|
|
109
|
+
- Grant calls: `$this->authorize` and `Gate::authorize` (throwing), `Gate::allows`, `denies`,
|
|
110
|
+
`check`, `any` and `none` (conditional).
|
|
111
|
+
|
|
112
|
+
Counted under a `laravel-*` reason, never published: `redirect`, `permanentRedirect` and `view`
|
|
113
|
+
routes (`laravel-route-no-controller`), the `health:` route (`laravel-health-route`), a
|
|
114
|
+
non-literal namespace, a class string in a `controller` group, and a bare `Route::` when
|
|
115
|
+
`config/app.php` lists literal `aliases` without the facade (`laravel-route-alias-removed`).
|
|
116
|
+
Resource `create` and `edit` routes are refused when any file calls `resourceVerbs(...)`
|
|
117
|
+
(`laravel-resource-verbs-changed`). A registrar `prefix`, `name`, `where`, `namespace` or
|
|
118
|
+
`controller` before a resource is refused (`laravel-resource-registrar-attribute`):
|
|
119
|
+
`ResourceRegistrar` gets them as options and does not apply them as a group would.
|
|
120
|
+
|
|
121
|
+
Not covered: Laravel 10 `RouteServiceProvider`, Lumen, `Route::fallback`, invokable string
|
|
122
|
+
actions (`'App\Ctl'`), nested singletons, and `$this->middleware()` in a controller constructor.
|
|
123
|
+
|
|
124
|
+
## Laravel closure routes
|
|
125
|
+
|
|
126
|
+
A Laravel route whose action is a closure or arrow function (`Route::get('/', fn () => ...)`) is
|
|
127
|
+
published like an array action: path, methods, name, template and route-scope guards
|
|
128
|
+
(`middleware`, `can`). It gets `handler_kind: "closure"` and no `handled_by` edge, and it is
|
|
129
|
+
still counted under `laravel-closure-action`. Its node key is
|
|
130
|
+
`laravel:closure:<routes file>:<line>#<path>`, with the routes file repo-relative. A closure has
|
|
131
|
+
no method or class, so no method-scope or class-scope guard and no `checks_access` edge applies;
|
|
132
|
+
`authorization_state` comes from the route-scope guards alone.
|
|
133
|
+
|
|
134
|
+
## CodeIgniter 4 provider
|
|
135
|
+
|
|
136
|
+
The CodeIgniter provider (`frameworks/codeigniter.py`) is selected by a direct
|
|
137
|
+
`codeigniter4/framework` or `codeigniter4/codeigniter4` requirement. It reads the route files of
|
|
138
|
+
`app/Config/Routing.php` `$routeFiles` (a literal list of `APPPATH . 'Config/...'`), else
|
|
139
|
+
`app/Config/Routes.php`, in order. Each rule cites its item in a `docs-check ci4` comment. The
|
|
140
|
+
`codeigniter4/framework` version comes from `composer.lock`; where it matters and is unread,
|
|
141
|
+
`codeigniter-version-unread` is counted once.
|
|
142
|
+
|
|
143
|
+
Covered:
|
|
144
|
+
|
|
145
|
+
- `get`, `post`, `put`, `patch`, `delete`, `options`, `head`; `match()` (verbs lowercased);
|
|
146
|
+
`add()` and `map()` as all nine `Router::HTTP_METHODS`.
|
|
147
|
+
- String handlers `Ctl::method/$1`, prefixed with the `namespace` option or the default namespace
|
|
148
|
+
(`App\Controllers`, `Routing::$defaultNamespace`, or a literal `setDefaultNamespace()`) unless
|
|
149
|
+
they start with `\`: `Admin\Users::index` is prefixed. Array callables `[Ctl::class, 'm']` are
|
|
150
|
+
fully qualified through the imports. Closures are published with `handler_kind: "closure"`.
|
|
151
|
+
- `route_path` is the path as written, with a leading `/`. `(:num)`, `(:alpha)`, `(:alphanum)`,
|
|
152
|
+
`(:segment)`, `(:hash)`, a literal `addPlaceholder()` declared before use, and a raw group
|
|
153
|
+
that cannot match `/` become `{1}`, `{2}`... by position. `(:any)`, `.*`, or a `.` in the path
|
|
154
|
+
give `route_template: ""` with `route-template-multi-segment`.
|
|
155
|
+
- `group()` prefixes. Group options merge into inner groups from 4.5.0 (inner replaces before);
|
|
156
|
+
group filters merge into route filters from 4.5.4. Before 4.5.4, or with no version read, no
|
|
157
|
+
group filter is claimed (`codeigniter-group-filter-version`).
|
|
158
|
+
- `resource()` and `presenter()` tables with `only`, `except` (list or CSV), `websafe`,
|
|
159
|
+
`controller` and `placeholder`. The id placeholder follows the source (`any`, `.*`), not the
|
|
160
|
+
guide's `(:segment)`, so member templates are `""` unless a placeholder is given.
|
|
161
|
+
- Route `filter` options as route-scope guards (`_via: "filter"`, the label keeps arguments).
|
|
162
|
+
`app/Config/Filters.php` before-filters as route-scope guards keyed
|
|
163
|
+
`codeigniter:config#app/Config/Filters.php:<index>` (`_via: "filter_config"`): `$required`
|
|
164
|
+
(4.5.0+), `$globals` minus `except`, `$methods` for routes of only that verb, and `$filters`
|
|
165
|
+
when a pattern provably matches every URL of the route. A partial or undecidable match is
|
|
166
|
+
counted, and makes the route `undecided` when the filter is authorization or unknown.
|
|
167
|
+
- Guard kinds: Shield (only with a direct `codeigniter4/shield` requirement) `session`,
|
|
168
|
+
`tokens`, `hmac`, `jwt`, `chain` are authentication, `group` and `permission` authorization;
|
|
169
|
+
the built-ins, `auth-rates` and `force-reset` are middleware. An alias the application maps to
|
|
170
|
+
another class, and every other alias or class, is `unknown`.
|
|
171
|
+
- `#[Filter(by, having)]` on controller classes and methods from 4.7.0, where
|
|
172
|
+
`Routing::$useControllerAttributes` defaults to true: the label is the route filter spec
|
|
173
|
+
`by` or `by:having,csv`, on the route filter's guard node. A literal `false` is counted per
|
|
174
|
+
attribute (`codeigniter-controller-attributes-disabled`), as is any attribute before 4.7.0
|
|
175
|
+
(`codeigniter-controller-attributes-version`). A non-literal setting, no readable
|
|
176
|
+
`Routing.php`, or no version read is counted once and leaves the routes of `#[Filter]`
|
|
177
|
+
holders `undecided`. A string `having` is a TypeError at runtime
|
|
178
|
+
(`codeigniter-controller-attribute-invalid`). `#[Restrict]` is a route condition
|
|
179
|
+
(`codeigniter-controller-attribute-restrict`), not a guard; `#[Cache]` is ignored.
|
|
180
|
+
- Per key, a verb route beats an `add()`/`map()` route (`RouteCollection.php:504`), which keeps
|
|
181
|
+
the remaining verbs. A verb route with no `filter` option key runs the `*` route's filters
|
|
182
|
+
(`loadRoutesOptions()`, `:1568-1575`); when either key's presence or the `*` route is
|
|
183
|
+
runtime-dependent the route is `undecided` (`codeigniter-route-any-options-undecided`).
|
|
184
|
+
- `$methods`: the exact uppercase key, or from 4.5.0 the deprecated lowercase key when the
|
|
185
|
+
uppercase one is missing. An empty `$filters` path (`''` or `[]`) matches every route; an
|
|
186
|
+
empty `except` matches none. A filter spec with more than one `:` is unread
|
|
187
|
+
(`codeigniter-filter-spec-unread`) and makes a route it may apply to `undecided`.
|
|
188
|
+
`codeigniter-methods-filter-case-bypass` means a route's only authorization guard is a
|
|
189
|
+
`$methods` filter, which a lowercase request method skips, so the route is `undecided`
|
|
190
|
+
(`access-control-undecided`) while the guard edge stays published.
|
|
191
|
+
|
|
192
|
+
Counted under a `codeigniter-*` reason, never published: `cli()`, `view()`, `addRedirect()`,
|
|
193
|
+
routes inside `environment()`, a `$routes` passed to any call (`service('auth')->routes($routes)`),
|
|
194
|
+
module route discovery, auto routing, a duplicate path and verb after the first, an
|
|
195
|
+
unconditional route that shares its key and table with a conditional one, and `match()` with
|
|
196
|
+
TRACE or CONNECT (`codeigniter-match-verb-no-method`: no such `RouteCollection` method).
|
|
197
|
+
Hostname routes are published and counted (`codeigniter-hostname-route`); a `subdomain` is
|
|
198
|
+
ignored when `hostname` is set, else counted as `codeigniter-subdomain-route`.
|
|
199
|
+
A route that loses its GET to a `view()` on its key is refused as
|
|
200
|
+
`codeigniter-route-key-view-collision`; its other verbs still publish. Every route on the key of
|
|
201
|
+
an `addRedirect()` is refused as `codeigniter-route-key-redirect-collision`, unless an
|
|
202
|
+
unconditional `add()`/`map()` route on that key came first and voids the redirect.
|
|
203
|
+
|
|
204
|
+
Not covered: auto-routed controllers, module `Config/Routes.php` files, Shield's own routes,
|
|
205
|
+
`$user->can()` grant calls (a typed receiver; follow-up), filter regex patterns beyond `*`,
|
|
206
|
+
Registrar-added globals, and `{locale}` rewriting.
|
|
207
|
+
|
|
208
|
+
## Access guards
|
|
209
|
+
|
|
210
|
+
Guards are `access_guard` nodes. Three relations reach them:
|
|
211
|
+
|
|
212
|
+
- `guarded_by` with `_via: "attribute"`: from a method or class to each `#[IsGranted]` on it.
|
|
213
|
+
A literal role is one shared node (`guard#ROLE_X`); any other first argument is kept as source
|
|
214
|
+
text and scoped to its class. The edge carries `guard_scope` and `guard_attribute: "IsGranted"`.
|
|
215
|
+
- `checks_access` with `_via: "call"`: from a route handler to the guard named by a direct
|
|
216
|
+
`$this->isGranted(...)` (`conditional: true`) or `$this->denyAccessUnlessGranted(...)`
|
|
217
|
+
(`conditional: false`) in its body. These share the `#[IsGranted]` node. A call whose name
|
|
218
|
+
matches `^can[A-Z]` or `^assert\w*Access` goes to a class-scoped node labelled with the method
|
|
219
|
+
name (`conditional: null`). `GRAPHIFY_PHP_ACCESS_CHECK_PATTERNS` replaces the patterns with a
|
|
220
|
+
comma-separated list; an invalid list falls back to the defaults and is counted. Every
|
|
221
|
+
`checks_access` edge carries `check_kind`: `framework` for `isGranted` and
|
|
222
|
+
`denyAccessUnlessGranted`, `pattern` for a name-matched project method.
|
|
223
|
+
- `guarded_by` with `_via: "access_control"`: from a route node to the
|
|
224
|
+
`config/packages/security.yaml` rule Symfony applies to it. The edge is added only when that
|
|
225
|
+
rule is proved to be the first match for every URL the route template can produce.
|
|
226
|
+
Otherwise the route is counted under `access-control-undecided`. The proof compares the
|
|
227
|
+
literal text before the first placeholder, then goes segment by segment: a placeholder is one
|
|
228
|
+
segment with the value set of its literal requirement (`\d+`, a bounded `\d{n}` or `\d{n,m}`
|
|
229
|
+
with n >= 1, a word alternation, or Symfony's default `[^/]+`), checked against rule segments that are literal, `\d+` or `[^/]+`, an optional
|
|
230
|
+
trailing group of literal alternatives, and an optional `$`. A rule without `$` is a prefix
|
|
231
|
+
match. A same-class `self::NAME` requirement counts as literal, as in `route_template`. Any
|
|
232
|
+
other non-literal requirement, a defaulted or optional placeholder at the deciding segment,
|
|
233
|
+
`{_locale}`/`{_format}`, or any other rule shape leaves the route undecided. A routes import
|
|
234
|
+
that sets `requirements`, `defaults`, `locale` or `format` turns the segment step off
|
|
235
|
+
(`access-control-segment-facts-unread`).
|
|
236
|
+
|
|
237
|
+
Every guard node and every `guarded_by` and `checks_access` edge carries `guard_kind`, and every
|
|
238
|
+
guard node carries `guard_key`, the key its id is hashed from. Symfony keys are unchanged
|
|
239
|
+
(`guard#ROLE_X`, `Class::guard#<text>`, `Class::check#<method>`, `access_control#<index>`).
|
|
240
|
+
Other providers key a guard `guard#<provider>:<guard_kind>:<label>` (or
|
|
241
|
+
`Class::guard#<provider>:<guard_kind>:<text>`) and a config rule
|
|
242
|
+
`<provider>:config#<file>:<index>`. Symfony's `guard_kind`:
|
|
243
|
+
|
|
244
|
+
- an `access_control` rule without `allow_if`: `public` for no roles or a `PUBLIC_ACCESS` /
|
|
245
|
+
`IS_AUTHENTICATED_ANONYMOUSLY` role, `authentication` for an `IS_AUTHENTICATED_*`,
|
|
246
|
+
`IS_REMEMBERED` or `IS_IMPERSONATOR` role, else `authorization`. A request passes on any one
|
|
247
|
+
role, so the weakest role decides;
|
|
248
|
+
- `allow_if`: split at top-level `and` / `&&`; `authorization` when one of those conjuncts is
|
|
249
|
+
exactly a positive `is_granted('X')` with X a role, else `unknown`. A top-level `or` or `||`
|
|
250
|
+
gives `unknown`; one inside parentheses does not. With `roles` too, the weaker of the two kinds
|
|
251
|
+
wins;
|
|
252
|
+
- `#[IsGranted]` and `isGranted` / `denyAccessUnlessGranted`: a literal goes through the role
|
|
253
|
+
rule, anything else is `unknown`;
|
|
254
|
+
- a pattern-matched helper call is `unknown`.
|
|
255
|
+
|
|
256
|
+
The `php_routes` status record carries `route_schema: 2`, `authorization_state` (route nodes per
|
|
257
|
+
state) and `authorization_reason` (undecided routes per reason). It counts `handlers_total` and
|
|
258
|
+
`handlers_unguarded` (handlers with no `authorization` guard edge from the method, its class or
|
|
259
|
+
its routes, and no `check_kind: framework` edge). A
|
|
260
|
+
pattern-only check does not cover a handler. Handlers with no `guarded_by` edge fall into exactly
|
|
261
|
+
one of `handlers_check_framework`, `handlers_check_pattern_only` and `handlers_unchecked`, and
|
|
262
|
+
`handlers_unguarded` equals the last two summed. The record also counts
|
|
263
|
+
`checks_access_declarations`, `checks_access_edges_added`, `access_control_edges_added` and
|
|
264
|
+
`routes_access_control_undecided`.
|
|
265
|
+
|
|
266
|
+
Route schema 2 changes what the `handlers_*` counters mean, so their numbers move without any
|
|
267
|
+
change in the application. Before, any guard counted; now only an `authorization` guard does,
|
|
268
|
+
and a sign-in-only or public `access_control` rule no longer covers a handler. On the reference
|
|
269
|
+
Symfony application (220 handlers) `handlers_unguarded` went from 40 to 130,
|
|
270
|
+
`handlers_check_framework` from 2 to 17, `handlers_check_pattern_only` from 13 to 20 and
|
|
271
|
+
`handlers_unchecked` from 27 to 110. That is a stricter count, not a regression.
|
|
272
|
+
|
|
273
|
+
Limits:
|
|
274
|
+
|
|
275
|
+
- Inherited route methods are not followed, although Symfony reads routes from parent methods.
|
|
276
|
+
- A `use ... as` alias for `Route` or `IsGranted` is not followed.
|
|
277
|
+
- Two stacked routes with the same path on one method collapse to one node.
|
|
278
|
+
- A shared literal guard node keeps the subject and location of the first declaration seen.
|
|
279
|
+
- `access_control` is read from top-level `security.yaml` only, and only a proved first match
|
|
280
|
+
gets an edge. When a `when@<env>` block, another file under `config/packages/`, or a PHP/XML
|
|
281
|
+
file there may declare `access_control`, every such edge is refused as
|
|
282
|
+
`access-control-overridden-elsewhere`.
|
|
283
|
+
- `route_path` is the attribute-declared path. A routes-config import prefix is not applied,
|
|
284
|
+
and when one exists access_control edges are refused as `access-control-route-prefix-unread`.
|
|
285
|
+
Routing PHP and XML files and `src/Kernel.php` get a text check for `prefix` calls only.
|
|
286
|
+
- `checks_access` reads only direct `$this` calls in handler bodies. Closures, arrow functions,
|
|
287
|
+
anonymous classes and helper methods are not followed.
|
|
@@ -30,7 +30,9 @@ dependencies = ["pyyaml>=6.0"]
|
|
|
30
30
|
# graphifyy is the PyPI name of graphify. It declares tree-sitter and tree-sitter-php itself, so
|
|
31
31
|
# listing it here is what makes the parser tests runnable: syntax/nodes.py sets the tree-sitter
|
|
32
32
|
# modules to None when the import fails and the tests then fail rather than skip.
|
|
33
|
-
|
|
33
|
+
# The cap is the newest release tests/test_core_guard.py PINNED_SHAPE was checked against, so a
|
|
34
|
+
# red CI run means a code change. .github/workflows/graphify-canary.yml tests the newest release.
|
|
35
|
+
test = ["pytest>=7.0", "graphifyy>=0.9.66,<=0.9.115"]
|
|
34
36
|
lint = ["ruff>=0.15"]
|
|
35
37
|
|
|
36
38
|
[project.scripts]
|
|
@@ -16,7 +16,9 @@ file after registration and before the build.
|
|
|
16
16
|
|
|
17
17
|
The record also lists the exact core edges the suppression prevented, so the shrink guard can tell
|
|
18
18
|
them from a regression. After the real run, core's original runs once more as a dry run over the
|
|
19
|
-
proved raw calls only, against copies: what it would append is what was withheld.
|
|
19
|
+
proved raw calls only, against copies: what it would append is what was withheld. From graphify
|
|
20
|
+
0.9.115 core appends one edge per site and the build folds repeats of a pair into `also_seen`, so
|
|
21
|
+
the dry run counts a pair once and skips pairs the graph already holds. Each such edge
|
|
20
22
|
is listed only when a graphify-php edge from the same caller, line and method name proves the
|
|
21
23
|
site. The dry run is safe only because core appends edges and writes nothing else but a parked
|
|
22
24
|
note on a caller node (extract.py `_park_unresolved_member_call`, graphify 0.9.103/0.9.104); those
|
|
@@ -124,6 +126,10 @@ def _without(
|
|
|
124
126
|
return kept_files
|
|
125
127
|
|
|
126
128
|
|
|
129
|
+
def _pair(edge: dict) -> tuple:
|
|
130
|
+
return edge.get("source"), edge.get("target"), edge.get("relation")
|
|
131
|
+
|
|
132
|
+
|
|
127
133
|
def _dry_run(
|
|
128
134
|
original: Callable,
|
|
129
135
|
per_file: Sequence[dict],
|
|
@@ -151,19 +157,28 @@ def _dry_run(
|
|
|
151
157
|
if (len(all_nodes), len(all_edges)) != (n_nodes, n_edges) or edges[:n_edges] != all_edges:
|
|
152
158
|
record.suppressed_unlisted[REASON_DRY_RUN_TOUCHED_BUILD] = 1
|
|
153
159
|
return
|
|
154
|
-
|
|
160
|
+
# graphify 0.9.115+ appends one edge per site, and the build folds a pair already in the
|
|
161
|
+
# graph into `also_seen`, so only the first edge of a pair new to the graph is withheld.
|
|
162
|
+
seen = {_pair(e) for e in all_edges if isinstance(e, dict)}
|
|
163
|
+
withheld = []
|
|
164
|
+
for edge in edges[n_edges:]:
|
|
165
|
+
if isinstance(edge, dict):
|
|
166
|
+
if _pair(edge) in seen:
|
|
167
|
+
continue
|
|
168
|
+
seen.add(_pair(edge))
|
|
169
|
+
withheld.append(edge)
|
|
155
170
|
proofs = SiteProofs(nodes, all_edges)
|
|
156
171
|
rows = []
|
|
157
172
|
for edge in withheld:
|
|
158
173
|
if not isinstance(edge, dict):
|
|
159
174
|
continue
|
|
160
|
-
|
|
161
|
-
if
|
|
175
|
+
site_proof = proofs.proof_for(edge)
|
|
176
|
+
if site_proof is None:
|
|
162
177
|
record.suppressed_unlisted[REASON_NO_PROOF_EDGE] = (
|
|
163
178
|
record.suppressed_unlisted.get(REASON_NO_PROOF_EDGE, 0) + 1
|
|
164
179
|
)
|
|
165
180
|
continue
|
|
166
|
-
source, target, relation, proof =
|
|
181
|
+
source, target, relation, proof = site_proof
|
|
167
182
|
rows.append(
|
|
168
183
|
{
|
|
169
184
|
"source": source,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Framework providers for the route pass. See `provider.py` for how to add one.
|
|
2
|
+
|
|
3
|
+
`REGISTRY` lists every provider; `detect.select_providers` picks the ones a repository's root
|
|
4
|
+
`composer.json` requires directly. Selected providers never share roles: each one's guards and
|
|
5
|
+
grant calls apply only to the routes it produced.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from .codeigniter import PROVIDER as CODEIGNITER
|
|
11
|
+
from .laravel import PROVIDER as LARAVEL
|
|
12
|
+
from .symfony import PROVIDER as SYMFONY
|
|
13
|
+
|
|
14
|
+
REGISTRY = (SYMFONY, LARAVEL, CODEIGNITER)
|
|
15
|
+
|
|
16
|
+
__all__ = ["CODEIGNITER", "LARAVEL", "REGISTRY", "SYMFONY"]
|