Repository navigation
Add originalUrl to findings in findForUrl - #281
Merged
Merged
Conversation
Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
Contributor
|
@copilot please fix the linting issue in the new test file |
Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
Contributor
Author
Formatted the new test to satisfy Prettier. ESLint, Prettier, and all 22 focused tests pass. Commit: |
Contributor
|
ran workflows and they're passing |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The file action’s duplicated Finding type must include the new field to keep the producer-consumer contract consistent.
1 open finding
What changed in this PR
Adds the requested scan URL to findings while preserving the existing post-redirect url.
Changes:
- Adds optional
originalUrlto findings. - Populates it from the configured URL.
- Adds unit coverage.
| File | Description |
|---|---|
.github/actions/find/src/findForUrl.ts |
Adds the original URL to findings. |
.github/actions/find/src/types.d.ts |
Extends the finding type. |
.github/actions/find/tests/findForUrl.test.ts |
Tests original URL preservation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
Changed originalUrl from optional to required in the Solution type.
Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
JoyceZhu
approved these changes
Oct 14, 2026
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.

When we perform a scan, we may end up on a different url than the intended one (due to redirects for login or otherwise). The 'find' action only adds the scanned url (the url we land on) to the findings. There are situations where we need to preserve the original/intended url.
The ideal approach would be to call the existing 'url' field: 'scannedUrl', and populating the 'url' field with the original/intended url. The problem with this approach is it't not backward compatible. Existing codebases would have to account for this change. Instead, I decided to introduce a new 'originalUrl' field that captures the intended url that was supposed to be scanned. This leaves the existing url field as-is and doesnt disrupt existing codebases.
Copilot summary
Findings only carried the URL the page ended up on (
page.url()). If the page redirected, for example to a login page, the URL we were asked to scan was lost. This PR records that URL on every finding asoriginalUrl.findForUrl.ts:addFindingnow setsoriginalUrl: url, whereurlis the configured URL passed topage.goto. It is the last property in thefindings.push({...})call, so a plugin-suppliedoriginalUrlcan't overwrite it.types.d.ts:Findinggains an optionaloriginalUrl?: string.findForUrl.test.tschecks that findings carry the configured URL.Finding.urlis unchanged. It is still the post-redirect URL frompage.url().