If you want to add a new bug type that can be reduced to reachability analysis on a data-dependency graph (a data-flow bug), you should follow the pattern used by DFBScanAgent.
To implement a new data-flow bug detector, follow these two steps:
- Implement a
DFBScanExtractor subclass: Create a new class that inherits from DFBScanExtractor to define the source and sink extractors for your target programming language. Place this in the appropriate dfbscan_extractor directory. - Provide Prompt Templates: Add JSON files containing prompt templates for intra-procedural data-flow analysis and path feasibility validation. These should be placed in the corresponding sub-directories under
prompt/ (e.g., prompt/<Language>/dfbscan/).
Note on Prompt Templates: If your bug's data-flow facts propagate similarly to Null Pointer Dereference, Memory Leak, or Use-After-Free, you can reuse the existing templates found in intra_dataflow_analyzer.json and path_validator.json.
Running the Scan: When executing the scan, you must specify whether the bug is a "source-must-reach-sink" or "source-must-not-reach-sink" type by using the --is-reachable option in your run command.