fix: Reject filesystem paths in HTTP_CALLS route extraction so client routes can join server routes#485
Open
mvanhorn wants to merge 1 commit into
Conversation
1 task
… routes can join server routes Signed-off-by: mvanhorn <mvanhorn@gmail.com>
16662d1 to
3ee3129
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a large Python repo, HTTP route / HTTP_CALLS extraction emits false data: 1062/1213 Route nodes are empty URL-string stubs with no method/route_path, and filesystem paths like /root/.aws/credentials, /etc/crio/crio.conf and str.split('/locations/') delimiters are misclassified as HTTP routes (os.remove / os.path.join become HTTP_CALLS). Because of this, the client HTTP_CALLS set and the server HANDLES set are fully disjoint: zero client calls resolve to a handled endpoint.
Changes
In internal/cbm/service_patterns.c the HTTP client heuristic matches callee names by method suffix (.get/.post/...) and library prefix (requests, etc.) and lifts the call's first string argument into url_path. Add a URL-vs-filesystem guard before classifying an argument string as a route: reject absolute filesystem-looking paths (leading / followed by known fs roots like etc/, root/, var/, usr/, home/, tmp/, or a path segment carrying a file extension such as .conf/.credentials/.json on disk) and reject str.split/str.join delimiter literals, so only HTTP-shaped paths produce HTTP_CALLS edges with a populated url_path.
Fixes #455