feat: use first_location_detected to eliminate per-alert locations API calls#70
Draft
feat: use first_location_detected to eliminate per-alert locations API calls#70
first_location_detected to eliminate per-alert locations API calls#70Conversation
Agent-Logs-Url: https://github.com/advanced-security/secret-scanning-review-action/sessions/67a240a0-d0ab-46f2-90aa-d2897358261a Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance GHSP API integration for first location detected
feat: use Apr 13, 2026
first_location_detected to eliminate per-alert locations API calls
…e; collect all matched locations Agent-Logs-Url: https://github.com/advanced-security/secret-scanning-review-action/sessions/c6ad64b2-acd3-43c4-881e-8aa426b425d6 Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
| # Determine which locations to check | ||
| if alert.get('first_location_detected') and not alert.get('has_more_locations'): | ||
| # Single location: use first_location_detected directly, no locations API call needed | ||
| logging.debug(f"Using first_location_detected for alert {alert['number']} (single location, no API call needed)") |
| # consistent with the PowerShell runtime behavior. | ||
| matched_locs = alert_matched_locations.get(alert['number'], []) | ||
| if not matched_locs: | ||
| logging.warning(f"No matched locations found for alert #{alert['number']}; skipping output.") |
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.
first_location_detectedunconditionally is a correctness regression: whenhas_more_locationsis true, only the first (globally-oldest) location is checked, missing PR matches in later locationsaction.ps1: only usefirst_location_detectedwhenhas_more_locationsis falsy; otherwise call the locations APIaction.py: same fix for the match loop; also refactor to collect ALL matching locations per alert (not just the first match), consistent with PowerShell behavior