Skip to content

Commit da128db

Browse files
committed
feat: create pipeline for symbol reachability and add a test
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 904373a commit da128db

9 files changed

Lines changed: 1364 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ 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_symbols_reachability = "scanpipe.pipelines.collect_symbols_reachability:SymbolReachability"
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"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 SymbolReachability(Pipeline):
15+
"""
16+
Patch reachability analysis, for given a vulnerability patches
17+
"""
18+
19+
download_inputs = False
20+
is_addon = True
21+
results_url = "/project/{slug}/resources/?extra_data=symbol_reachability"
22+
23+
@classmethod
24+
def steps(cls):
25+
return (cls.analyze_and_store_symbol_reachability,)
26+
27+
def analyze_and_store_symbol_reachability(self):
28+
"""
29+
Perform symbol-level reachability analysis for each patch.
30+
This step compares the AST of patched/vulnerable files against the codebase resources.
31+
Results are stored directly in the 'extra_data' of each CodebaseResource.
32+
"""
33+
reachability.collect_and_store_symbol_reachability_results(
34+
project=self.project, logger=self.log
35+
)

0 commit comments

Comments
 (0)