Skip to content

Commit b745c3c

Browse files
committed
Create pipeline for symbol reachability
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent c64ab56 commit b745c3c

6 files changed

Lines changed: 664 additions & 229 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ run = "scancodeio:combined_run"
136136
analyze_docker_image = "scanpipe.pipelines.analyze_docker:Docker"
137137
analyze_root_filesystem_or_vm_image = "scanpipe.pipelines.analyze_root_filesystem:RootFS"
138138
analyze_windows_docker_image = "scanpipe.pipelines.analyze_docker_windows:DockerWindows"
139+
analyze_patch_reachability = "scanpipe.pipelines.analyze_patch_reachability:PatchReachability"
139140
benchmark_purls = "scanpipe.pipelines.benchmark_purls:BenchmarkPurls"
140141
collect_strings_gettext = "scanpipe.pipelines.collect_strings_gettext:CollectStringsGettext"
141142
collect_symbols_ctags = "scanpipe.pipelines.collect_symbols_ctags:CollectSymbolsCtags"
142143
collect_symbols_pygments = "scanpipe.pipelines.collect_symbols_pygments:CollectSymbolsPygments"
143144
collect_symbols_tree_sitter = "scanpipe.pipelines.collect_symbols_tree_sitter:CollectSymbolsTreeSitter"
144-
collect_symbols_patches = "scanpipe.pipelines.collect_patch_symbols:CollectPatchSymbols"
145145
enrich_with_purldb = "scanpipe.pipelines.enrich_with_purldb:EnrichWithPurlDB"
146146
fetch_scores = "scanpipe.pipelines.fetch_scores:FetchScores"
147147
find_vulnerabilities = "scanpipe.pipelines.find_vulnerabilities:FindVulnerabilities"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/aboutcode-org/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
10+
from scanpipe.pipelines import Pipeline
11+
from scanpipe.pipes import reachability
12+
13+
14+
class PatchReachability(Pipeline):
15+
"""
16+
Patch reachability analysis, for given a vulnerability patches
17+
"""
18+
download_inputs = False
19+
is_addon = True
20+
results_url = "/project/{slug}/resources/?extra_data=reachability"
21+
22+
@classmethod
23+
def steps(cls):
24+
return (cls.analyze_and_store_patch_reachability,)
25+
26+
def analyze_and_store_patch_reachability(self):
27+
"""
28+
Perform symbol-level reachability analysis for each patch.
29+
This step compares the AST of patched/vulnerable files against the codebase resources.
30+
Results are stored directly in the 'extra_data' of each CodebaseResource.
31+
"""
32+
reachability.analyze_and_store_patch_reachability_results(
33+
project=self.project, logger=self.log
34+
)

scanpipe/pipelines/collect_patch_symbols.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)