hex0punk / wally

Function callpath mapping analysis tool for Go
Mozilla Public License 2.0
28 stars 0 forks source link

better call sit to function checks #61

Closed hex0punk closed 3 months ago

dryrunsecurity[bot] commented 3 months ago

DryRun Security Summary

The provided code changes focus on improving the accuracy, reliability, and maintainability of the call graph analysis functionality, including enhancements to handle closures, method calls, and provide more detailed logging and output, without introducing any obvious security concerns.

Expand for full summary
**Summary:** The provided code changes cover various improvements and modifications to the `CallMapper` struct and its associated functions in the `callmapper.go` file, as well as changes to the `GetFunctionFromSite` and `SiteMatchesFunc` functions in the `core.go` file. Additionally, there are changes to the `map` and `search` commands in the `cmd` directory. The key changes include: 1. Improved handling of closures and ensuring that the site (call instruction) matches the function of the current node during call graph traversal. 2. Enhancements to the function call resolution, particularly for method calls, to improve accuracy and robustness. 3. Improvements to logging and output, providing more detailed information about the analysis process. 4. Input validation checks to ensure that user-provided parameters are within the expected range and format. From an application security perspective, these changes do not introduce any obvious security concerns. The code modifications appear to be focused on improving the accuracy, reliability, and maintainability of the call graph analysis functionality, which is an important aspect of static code analysis and program understanding. **Files Changed:** 1. `wallylib/callmapper/callmapper.go`: - Improvements to the `BFS` and `shouldSkipNode` functions to ensure that the site (call instruction) matches the function of the current node during the call graph traversal. - Enhancements to the `handleClosure` function to properly handle cases where the current node is a closure. 2. `wallylib/core.go`: - Improvements to the `GetFunctionFromSite` function to handle method calls more robustly, including retrieving the receiver type and iterating through the method set to find the matching method. - Simplification of the `SiteMatchesFunc` function by combining the logic for static and method calls. 3. `cmd/map.go`: - Updating the log message in the `SolveCallPaths` function call to include the length of the `nav.RouteMatches` slice. - Consideration of input validation, configuration file loading, callgraph algorithms, and closure handling for potential security implications. 4. `cmd/search.go`: - Adding more context to the log message "Solving call paths" by including the number of matches found. - Reviewing input validation, potential denial of service (DoS) issues, untrusted data handling, secure graph generation, and secure server graph implementation for potential security considerations. Overall, the changes in this pull request appear to be focused on improving the functionality and reliability of the call graph analysis, with a particular emphasis on handling closures, method calls, and providing more detailed logging and output. While there are no obvious security concerns, it's important to continue reviewing the entire codebase and considering potential security implications, especially in the context of how the library is used within the application.

Code Analysis

We ran 9 analyzers against 4 files and 0 analyzers had findings. 9 analyzers had no findings.

Riskiness

:green_circle: Risk threshold not exceeded.

View PR in the DryRun Dashboard.