From 6b74f9ee00e4899816ef9937ffaad1b584e4310e Mon Sep 17 00:00:00 2001 From: Arthur Chan Date: Tue, 9 Jan 2024 10:45:50 +0000 Subject: [PATCH] Fix typing Signed-off-by: Arthur Chan --- src/fuzz_introspector/analyses/data/cwe_data.py | 4 +++- src/fuzz_introspector/analyses/sinks_analyser.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/fuzz_introspector/analyses/data/cwe_data.py b/src/fuzz_introspector/analyses/data/cwe_data.py index 453681377..303c9b8a5 100644 --- a/src/fuzz_introspector/analyses/data/cwe_data.py +++ b/src/fuzz_introspector/analyses/data/cwe_data.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -SINK_FUNCTION = { +from typing import Any, Dict + +SINK_FUNCTION: Dict[str, Dict[str, Any]] = { 'CWE79': { 'c-cpp': [ ('', 'system'), diff --git a/src/fuzz_introspector/analyses/sinks_analyser.py b/src/fuzz_introspector/analyses/sinks_analyser.py index 9a459c810..e949465d8 100644 --- a/src/fuzz_introspector/analyses/sinks_analyser.py +++ b/src/fuzz_introspector/analyses/sinks_analyser.py @@ -31,8 +31,8 @@ logger = logging.getLogger(name=__name__) # List of sink functions for different CWE -SINK_FUNCTION = cwe_data.SINK_FUNCTION -ALL_CWE = list(SINK_FUNCTION) +SINKS = cwe_data.SINK_FUNCTION +CWES = list(SINKS) class SinkCoverageAnalyser(analysis.AnalysisInterface): @@ -226,7 +226,7 @@ def _filter_function_list( continue # Add the function profile to the result list if it matches one of the target - if (package, func_name) in SINK_FUNCTION[target_cwe][target_lang]: + if (package, func_name) in SINKS[target_cwe][target_lang]: function_list.append(fd) return function_list