refactor(appsec): extract rel_path and get_caller_frame_info to _patch_utils#17331
Closed
refactor(appsec): extract rel_path and get_caller_frame_info to _patch_utils#17331
Conversation
Move the native _stacktrace C extension from ddtrace/appsec/_iast/ to ddtrace/appsec/_shared/ so it can be reused by both IAST and SCA without creating a dependency from SCA into IAST internals. Split out from #17156 to keep PRs incremental and reviewable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…h_utils Move rel_path() and the frame-walking logic (_compute_file_line) from VulnerabilityBase in _iast/taint_sinks/_base.py to shared functions in _patch_utils.py so both IAST and SCA can reuse them without depending on IAST internals. Split out from #17156 to keep PRs incremental and reviewable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codeowners resolved as |
…aller_frame_info Update CookiesVulnerability.report_cookies() to use the shared get_caller_frame_info() instead of the removed _compute_file_line(). Update test mock target from get_info_frame to get_caller_frame_info. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
rel_path()and_compute_file_line()fromVulnerabilityBasein_iast/taint_sinks/_base.pyinto shared functions (rel_pathandget_caller_frame_info) in_patch_utils.py.os,sysconfig,CWD,PURELIB_PATH,STDLIB_PATHand theget_info_frameimport from_base.py— all now encapsulated in the sharedget_caller_frame_info().Split out from #17156 to keep PRs incremental and reviewable. Depends on #17329.
Test plan
VulnerabilityBase.report()which now delegates toget_caller_frame_info())tests/appsec/iast/test_stacktrace.py)tests/appsec/iast_memcheck/test_iast_mem_check.py)🤖 Generated with Claude Code