|
8 | 8 | from typing import Generator
|
9 | 9 | from typing import Iterable
|
10 | 10 | from typing import List
|
| 11 | +from typing import Optional |
11 | 12 | from typing import Set
|
12 | 13 | from typing import Tuple
|
13 | 14 | from typing import TYPE_CHECKING
|
@@ -196,7 +197,7 @@ def scan_diff(diff: str) -> Generator[PotentialSecret, None, None]:
|
196 | 197 | return
|
197 | 198 |
|
198 | 199 | for filename, lines in _get_lines_from_diff(diff):
|
199 |
| - yield from _process_line_based_plugins(lines, filename=filename) |
| 200 | + yield from _process_line_based_plugins(lines, filename=filename, is_scan_diff=True) |
200 | 201 |
|
201 | 202 |
|
202 | 203 | def scan_for_allowlisted_secrets_in_file(filename: str) -> Generator[PotentialSecret, None, None]:
|
@@ -338,6 +339,7 @@ def _get_lines_from_diff(diff: str) -> \
|
338 | 339 | def _process_line_based_plugins(
|
339 | 340 | lines: List[Tuple[int, str, bool, bool]],
|
340 | 341 | filename: str,
|
| 342 | + is_scan_diff: Optional[bool] = False, |
341 | 343 | ) -> Generator[PotentialSecret, None, None]:
|
342 | 344 | line_content = [line[1] for line in lines]
|
343 | 345 |
|
@@ -384,6 +386,7 @@ def _process_line_based_plugins(
|
384 | 386 | line_number=line_number,
|
385 | 387 | context=code_snippet,
|
386 | 388 | raw_context=raw_code_snippet,
|
| 389 | + is_scan_diff=is_scan_diff, |
387 | 390 | ):
|
388 | 391 | secret.is_removed = is_removed
|
389 | 392 | secret.is_added = is_added
|
|
0 commit comments