Fuzz introspector
For issues and ideas: https://github.com/ossf/fuzz-introspector/issues

Fuzzer details

Fuzzer: fuzz_transformer

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 396 74.0%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 139 25.9%
All colors 535 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
193 227 libcst._parser.parso.python.tokenize._compile call site: 00227 libcst._parser.grammar.get_grammar
102 426 libcst._parser.parso.utils._parse_version call site: 00426 libcst._parser.parso.pgen2.generator.generate_grammar
75 151 libcst._parser.entrypoints._parse call site: 00151 libcst._parser.entrypoints._pure_python_parse
4 23 libcst.matchers._visitors._gather_constructed_visit_funcs call site: 00023 libcst.matchers._visitors._gather_constructed_leave_funcs
3 15 libcst.matchers._visitors._gather_matchers call site: 00015 libcst.matchers._visitors._gather_constructed_visit_funcs
3 47 libcst.matchers._visitors._verify_return_annotation call site: 00047 .type
3 52 libcst.matchers._visitors._get_possible_annotated_classes call site: 00052 .isinstance
3 76 libcst._parser.detect_config._detect_encoding call site: 00076 io.BytesIO
2 11 libcst.matchers._visitors._gather_matchers call site: 00011 typing.cast
2 532 libcst.codemod._command.CodemodCommand.transform_module call site: 00532 libcst.codemod._command.CodemodCommand._instantiate_and_run
1 6 libcst.matchers._visitors.MatcherDecoratableTransformer.__init__ call site: 00006 libcst.matchers._visitors._gather_matchers
1 34 libcst.matchers._visitors._gather_constructed_leave_funcs call site: 00034 constructed_visitors.get

Runtime coverage analysis

Covered functions
1572
Functions that are reachable but not covered
247
Reachable functions
276
Percentage of reachable functions covered
10.51%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_transformer 5
libcst.codemod._visitor 2
libcst.codemod._codemod 1
libcst.matchers._visitors 31
libcst._parser.entrypoints 14
libcst._parser.detect_config 90
libcst._parser.parso.utils 11
libcst._parser.wrapped_tokenize 14
libcst._parser.parso.python.tokenize 59
libcst._parser.grammar 17
libcst._parser.parso.pgen2.generator 36
libcst._parser.parso.pgen2.grammar_parser 18
libcst._parser.python_parser 3
libcst.codemod._command 4

Analyses and suggestions

Optimal target analysis

Remaining optimal interesting functions

The following table shows a list of functions that are optimal targets. Optimal targets are identified by finding the functions that in combination, yield a high code coverage.

Func name Functions filename Arg count Args Function depth hitcount instr count bb count cyclomatic complexity Reachable functions Incoming references total cyclomatic complexity Unreached complexity
libcst.codegen.gen_matcher_classes._get_clean_type_and_aliases libcst.codegen.gen_matcher_classes 1 ['N/A'] 6 0 1 2 4 816 2 2657 1839
libcst.codemod.commands.rename.RenameCommand.leave_ImportFrom libcst.codemod.commands.rename 3 ['N/A', 'N/A', 'N/A'] 1 0 7 8 6 206 1 629 623
libcst.metadata.scope_provider.ImportAssignment.get_qualified_names_for libcst.metadata.scope_provider 2 ['N/A', 'N/A'] 2 0 1 8 6 77 0 241 223
libcst.metadata.scope_provider.Scope.get_qualified_names_for libcst.metadata.scope_provider 2 ['N/A', 'N/A'] 1 0 1 5 5 72 0 226 214
libcst.codemod.visitors._apply_type_annotations.ImportedSymbolCollector._handle_NameOrAttribute libcst.codemod.visitors._apply_type_annotations 2 ['N/A', 'N/A'] 2 0 1 4 5 143 3 440 207
libcst.tool._codemod_impl libcst.tool 2 ['N/A', 'N/A'] 6 0 27 9 7 304 0 1016 201
libcst.codemod.visitors._apply_type_annotations.ApplyTypeAnnotationsVisitor.transform_module_impl libcst.codemod.visitors._apply_type_annotations 2 ['N/A', 'N/A'] 3 0 6 3 4 74 0 237 116

Implementing fuzzers that target the above functions will improve reachability such that it becomes:

Functions statically reachable by fuzzers
15.0%
477 / 3087
Cyclomatic complexity statically reachable by fuzzers
17.0%
1687 / 9856

All functions overview

If you implement fuzzers for these functions, the status of all functions in the project will be:

Func name Functions filename Args Function call depth Reached by Fuzzers Fuzzers runtime hit Func lines hit % I Count BB Count Cyclomatic complexity Functions reached Reached by functions Accumulated cyclomatic complexity Undiscovered complexity

Runtime coverage analysis

This section shows analysis of runtime coverage data.

For futher technical details on how this section is generated, please see the Glossary .

Complex functions with low coverage

Func name Function total lines Lines covered at runtime percentage covered Reached by fuzzers
libcst._nodes.expression.Param._codegen_impl 37 10 27.02% []
libcst._nodes.expression.Parameters._codegen_impl 45 10 22.22% []
libcst._nodes.statement.Try._codegen_impl 31 10 32.25% []
libcst._nodes.statement.ImportFrom._codegen_impl 39 7 17.94% []
libcst._nodes.statement.get_docstring_impl 36 16 44.44% []
libcst._nodes.statement.ClassDef._codegen_impl 31 0 0.0% []
libcst._nodes.statement.With._codegen_impl 46 14 30.43% []
libcst._nodes.statement.For._codegen_impl 31 10 32.25% []
libcst._type_enforce.is_value_of_type 58 0 0.0% []
libcst.matchers._matcher_base._sequence_matches 55 20 36.36% []
libcst.matchers._matcher_base._attribute_matches 41 14 34.14% []
libcst.matchers._matcher_base._metadata_matches 32 0 0.0% []
libcst.metadata.scope_provider.ImportAssignment.get_qualified_names_for 31 2 6.451% []
inspect.getclasstree 614 268 43.64% []
libcst._parser.parso.python.tokenize._create_token_collection 80 1 1.25% ['fuzz_transformer']
libcst._parser.parso.python.tokenize._tokenize_lines_py36_or_below.dedent_if_necessary 217 0 0.0% ['fuzz_transformer']
libcst._parser.parso.python.tokenize._tokenize_lines_py37_or_above.dedent_if_necessary 174 0 0.0% ['fuzz_transformer']
libcst.codemod._cli._execute_transform 46 2 4.347% []
libcst.codemod._cli.parallel_exec_transform_with_prettyprint 41 0 0.0% []
libcst._parser.conversions.params.convert_argslist.add_param 51 1 1.960% []
libcst._parser.wrapped_tokenize._convert_token 44 0 0.0% ['fuzz_transformer']
libcst.codemod.visitors._apply_type_annotations.ApplyTypeAnnotationsVisitor._get_module_imports 33 0 0.0% []

Files and Directories in report

This section shows which files and directories are considered in this report. The main reason for showing this is fuzz introspector may include more code in the reasoning than is desired. This section helps identify if too many files/directories are included, e.g. third party code, which may be irrelevant for the threat model. In the event too much is included, fuzz introspector supports a configuration file that can exclude data from the report. See the following link for more information on how to create a config file: link

Files in report

Source file Reached by Covered by
libcst.codemod._command ['fuzz_transformer'] []
[] []
traceback [] []
libcst.helpers.paths [] []
libcst._nodes.expression [] []
libcst._parser.parso.utils ['fuzz_transformer'] []
subprocess [] []
libcst._tabs [] []
libcst._parser.parso.python.token [] []
libcst._metadata_dependent [] []
sys [] []
libcst.codegen.gen_type_mapping [] []
libcst._parser.parso [] []
libcst.testing [] []
libcst._type_enforce [] []
libcst._types [] []
argparse [] []
importlib [] []
libcst.codemod.commands.convert_type_comments [] []
libcst._nodes.op [] []
libcst.codemod.visitors._gather_imports [] []
libcst._parser.parso.pgen2.generator ['fuzz_transformer'] []
libcst.codemod.visitors._gather_comments [] []
libcst._parser.parso.python.py_token [] []
libcst.codemod.visitors._gather_exports [] []
contextlib [] []
libcst._nodes.statement [] []
os [] []
libcst.tool [] []
libcst._add_slots [] []
libcst.codemod.commands.fix_pyre_directives [] []
libcst._parser.parso.pgen2 [] []
libcst._nodes.base [] []
libcst._parser.types.py_token [] []
pathlib [] []
libcst._parser.types.conversions [] []
libcst.helpers.common [] []
libcst.helpers.expression [] []
libcst._parser.conversions.module [] []
libcst.metadata.type_inference_provider [] []
libcst.matchers._decorators [] []
libcst.codegen.transforms [] []
libcst._parser.types.token [] []
libcst.metadata.reentrant_codegen [] []
libcst.metadata.position_provider [] []
libcst.metadata.scope_provider [] []
libcst._parser.types.production [] []
ast [] []
atheris [] []
libcst._parser.grammar ['fuzz_transformer'] []
libcst.codemod.visitors._add_imports [] []
libcst._visitors [] []
libcst._parser.conversions.expression [] []
libcst._nodes.whitespace [] []
libcst.codemod.visitors [] []
json [] []
typing_inspect [] []
libcst.codemod.commands.noop [] []
libcst.codemod.commands.strip_strings_from_types [] []
libcst._parser [] []
re [] []
textwrap [] []
inspect [] []
libcst._parser.whitespace_parser [] []
libcst._parser.conversions.params [] []
yaml [] []
libcst_native [] []
libcst._parser.types.py_config [] []
libcst.helpers._template [] []
io [] []
libcst.metadata [] []
libcst.metadata.span_provider [] []
libcst._nodes.module [] []
libcst.codemod._visitor ['fuzz_transformer'] []
libcst._parser.entrypoints ['fuzz_transformer'] []
libcst.metadata.full_repo_manager [] []
libcst._removal_sentinel [] []
libcst.codegen.generate [] []
libcst._position [] []
libcst.codemod.commands.remove_unused_imports [] []
libcst.codemod.commands.convert_percent_format_to_fstring [] []
libcst._batched_visitor [] []
libcst._parser.py_whitespace_parser [] []
copy [] []
dataclasses [] []
libcst.helpers.module [] []
libcst._typed_visitor [] []
libcst.codemod.visitors._gather_unused_imports [] []
libcst.metadata.base_provider [] []
libcst._parser.wrapped_tokenize ['fuzz_transformer'] []
libcst._parser.base_parser [] []
libcst._maybe_sentinel [] []
types [] []
libcst._parser.types.whitespace_state [] []
libcst.codegen [] []
enum [] []
libcst._parser.python_parser ['fuzz_transformer'] []
typing [] []
libcst.helpers [] []
libcst.codemod.commands.add_pyre_directive [] []
libcst.codemod [] []
libcst._parser.types [] []
libcst.codemod._runner [] []
[] []
tokenize [] []
libcst.codemod.commands.ensure_import_present [] []
libcst.codemod._testing [] []
libcst._parser.types.config [] []
libcst._parser.parso.python [] []
libcst._nodes.internal [] []
libcst.codemod.commands.rename [] []
libcst.codemod.commands.remove_pyre_directive [] []
libcst._parser.parso.python.tokenize ['fuzz_transformer'] []
libcst.matchers [] []
abc [] []
libcst.metadata.name_provider [] []
shutil [] []
libcst._parser.parso.pgen2.grammar_parser ['fuzz_transformer'] []
libcst._parser.conversions.terminals [] []
libcst.codegen.gather [] []
libcst._parser.types.py_whitespace_state [] []
libcst.codemod.visitors._gather_global_names [] []
libcst._nodes [] []
multiprocessing [] []
libcst.codemod.commands [] []
libcst.metadata.accessor_provider [] []
codecs [] []
libcst.codemod.visitors._apply_type_annotations [] []
libcst.codemod._context [] []
libcst [] []
libcst.codemod.visitors._remove_imports [] []
libcst.metadata.parent_node_provider [] []
libcst._parser.production_decorator [] []
collections [] []
libcst.codegen.gen_visitor_functions [] []
libcst.codemod._codemod ['fuzz_transformer'] []
libcst.codemod.commands.add_trailing_commas [] []
libcst.codemod.visitors._imports [] []
libcst._typed_visitor_base [] []
libcst._exceptions [] []
libcst._parser.types.partials [] []
...fuzz_transformer ['fuzz_transformer'] []
libcst._parser.conversions [] []
libcst.matchers._matcher_base [] []
libcst._flatten_sentinel [] []
libcst.codegen.gen_matcher_classes [] []
libcst.codemod.visitors._gather_string_annotation_names [] []
libcst.metadata.wrapper [] []
libcst._parser.custom_itertools [] []
libcst.metadata.file_path_provider [] []
libcst.matchers._return_types [] []
libcst._version [] []
libcst._parser.conversions.statement [] []
functools [] []
libcst.codemod.commands.convert_format_to_fstring [] []
libcst.codemod.commands.unnecessary_format_string [] []
libcst.testing.utils [] []
libcst.matchers._visitors ['fuzz_transformer'] []
libcst._parser.detect_config ['fuzz_transformer'] []
libcst.codemod._cli [] []
time [] []
itertools [] []
libcst._nodes.deep_equals [] []
libcst.metadata.expression_context_provider [] []
difflib [] []
libcst.codemod._dummy_pool [] []
libcst.codemod.commands.convert_namedtuple_to_dataclass [] []

Directories in report

Directory