Skip to content

Commit e034ced

Browse files
authored
docs: add documentation for reachability analysis (#2211)
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 6bdfe5a commit e034ced

5 files changed

Lines changed: 121 additions & 0 deletions

docs/built-in-pipelines.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ Analyze Docker Windows Image
4848

4949
.. _pipeline_benchmark_purls:
5050

51+
Analyze Symbol Reachability
52+
----------------------------
53+
.. autoclass:: scanpipe.pipelines.analyze_symbols_reachability.SymbolReachability()
54+
:members:
55+
:member-order: bysource
56+
57+
.. _analyze_symbols_reachability:
58+
5159
Benchmark PURLs (addon)
5260
-----------------------
5361

109 KB
Loading

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Learn via practical step-by-step guides.
4747
- :ref:`tutorial_vulnerablecode_integration`
4848
- :ref:`tutorial_web_ui_symbol_and_string_collection`
4949
- :ref:`tutorial_cli_end_to_end_scanning_to_dejacode`
50+
- :ref:`tutorial_analyze_symbols_reachability`
5051

5152
.. rst-class:: column column2 bottom-left
5253

@@ -116,6 +117,7 @@ Indices and tables
116117
tutorial_vulnerablecode_integration
117118
tutorial_web_ui_symbol_and_string_collection
118119
tutorial_cli_end_to_end_scanning_to_dejacode
120+
tutorial_analyze_symbols_reachability
119121
scanpipe-concepts
120122
built-in-pipelines
121123
custom-pipelines

docs/scanpipe-pipes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,8 @@ Windows
134134
-------
135135
.. automodule:: scanpipe.pipes.windows
136136
:members:
137+
138+
Reachability
139+
-------------
140+
.. automodule:: scanpipe.pipes.reachability
141+
:members:
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
.. _tutorial_analyze_symbols_reachability:
2+
3+
Analyze Symbol Reachability
4+
===========================
5+
6+
In this tutorial, we will introduce the add-on pipeline that can be used to
7+
analyze symbols reachability from codebase resources.
8+
9+
Requirements
10+
------------
11+
12+
To successfully complete this tutorial, you first need to:
13+
14+
- Install **ScanCode.io** locally :ref:`installation`.
15+
- Have an existing project resource affected
16+
by a vulnerability advisory that has a corresponding fix commit.
17+
- Run the ``find_vulnerabilities`` pipeline :ref:`tutorial_vulnerablecode_integration`.
18+
19+
Reachability Status
20+
-------------------
21+
22+
The reachability status can have one of the following values:
23+
24+
- ``REACHABLE``: "yes"
25+
(We found evidence that the vulnerable symbol is reachable and the vulnerable code exists.)
26+
- ``UNKNOWN``: "unknown"
27+
(We cannot determine reachability with confidence.)
28+
- ``NOT_REACHABLE``: "no"
29+
(We found evidence that the vulnerable symbol is not reachable.)
30+
31+
32+
Run the ``analyze_symbols_reachability`` pipeline
33+
-------------------------------------------------
34+
35+
- Open any existing project containing a few resources.
36+
- Click the **"Add pipeline"** button and select the **"analyze_symbols_reachability"**
37+
pipeline from the dropdown list.
38+
- Select **"Execute pipeline now"** and click **"Add pipeline"** to start the
39+
reachability analysis.
40+
- Once the pipeline run completes successfully, you can reach the **Resources** list view
41+
by clicking the count number under the **"RESOURCES"** header.
42+
- Click on one of the affected code files and navigate to
43+
the **Extra** tab to view the ``symbols_reachability``.
44+
45+
.. image:: images/tutorial-web-ui-analyze-symbol-reachability.png
46+
47+
- The pipeline output also includes a JSON file containing the reachability
48+
status for each advisory and resource, including the overall reachability
49+
status (e.g., ``reachability-2026-08-18-15-12-51.json``).
50+
51+
.. code-block:: json
52+
:emphasize-lines: 2
53+
54+
{
55+
"purl": "pkg:pypi/b2sdk@1.14.0",
56+
"advisories": [
57+
{
58+
"advisory_uid": "pypa/b2sdk/PYSEC-2022-33",
59+
"is_reachable": "yes",
60+
"details": [
61+
{
62+
"resource_path": "b2sdk-1.14.0/b2sdk/account_info/sqlite_account_info.py",
63+
"patch": {
64+
"vcs_url": "https://github.com/backblaze/b2-sdk-python",
65+
"commit_hash": "62476638986e5b6d7459aca5ef8ce220760226e0"
66+
},
67+
"is_reachable": "yes",
68+
"tool_details": [
69+
{
70+
"symbol_name": "SqliteAccountInfo._create_database",
71+
"is_called": true,
72+
"is_defined": true,
73+
"is_imported": false,
74+
"is_exact": true,
75+
"reachable_from": [
76+
"SqliteAccountInfo._validate_database"
77+
]
78+
},
79+
{
80+
"symbol_name": "SqliteAccountInfo",
81+
"is_called": false,
82+
"is_defined": true,
83+
"is_imported": false,
84+
"is_exact": true,
85+
"reachable_from": []
86+
}
87+
],
88+
"vulnerable_symbols": [
89+
"SqliteAccountInfo",
90+
"SqliteAccountInfo._create_database"
91+
],
92+
"fixed_symbols": [
93+
"SqliteAccountInfo",
94+
"SqliteAccountInfo._create_database"
95+
]
96+
},
97+
// ... more details
98+
]
99+
}
100+
}
101+
102+
.. note::
103+
An advisory is considered ``REACHABLE`` if it is reachable through at least
104+
one resource. If no resource is ``REACHABLE`` and at least one result is
105+
``UNKNOWN``, the advisory status is ``UNKNOWN``. Otherwise, its status is
106+
``NOT_REACHABLE``.

0 commit comments

Comments
 (0)