|
| 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