From d4a753551f655b313036d159fea8593f0cac15e2 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Martinez Date: Mon, 23 Sep 2024 21:56:43 +0200 Subject: [PATCH] chore(iast): add re.match with an index to the leak testing script (#10742) ## Checklist - [X] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Signed-off-by: Juanjo Alvarez --- scripts/iast/mod_leak_functions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/iast/mod_leak_functions.py b/scripts/iast/mod_leak_functions.py index 9b8389ae765..e43db154dbf 100644 --- a/scripts/iast/mod_leak_functions.py +++ b/scripts/iast/mod_leak_functions.py @@ -74,10 +74,11 @@ def test_doit(): re_match = re.compile(r"(\w+)", re.IGNORECASE) re_match_result = re_match.match(string21) # 1 propagation: 'HIROOT - string22 = re_match_result.group(0) # 1 propagation: '_HIROOT - # string22 = re_match_result.groups()[0] + string22_1 = re_match_result[0] # 1 propagation: '_HIROOT + string22_2 = re_match_result.groups()[0] # 1 propagation: '_HIROOT + string22 = string22_1 + string22_2 # 1 propagation: _HIROOT_HIROOT tmp_str = "DDDD" - string23 = tmp_str + string22 # 1 propagation: 'DDDD_HIROOT + string23 = tmp_str + string22 # 1 propagation: 'DDDD_HIROOT_HIROOT re_match = re.compile(r"(\w+)(_+)(\w+)", re.IGNORECASE) re_match_result = re_match.search(string23)