Skip to content

Add originalUrl to findings in findForUrl - #281

Merged
abdulahmad307 merged 7 commits into
mainfrom
copilot/add-original-url-to-finding
Oct 15, 2026
Merged

abdulahmad307 merged 7 commits into
mainfrom
copilot/add-original-url-to-finding

Conversation

Copilot AI commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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 as originalUrl.

  • findForUrl.ts: addFinding now sets originalUrl: url, where url is the configured URL passed to page.goto. It is the last property in the findings.push({...}) call, so a plugin-supplied originalUrl can't overwrite it.
  • types.d.ts: Finding gains an optional originalUrl?: string.
  • Tests: a new case in findForUrl.test.ts checks that findings carry the configured URL.
findings.push({...findingData, screenshotId, originalUrl: url})

Finding.url is unchanged. It is still the post-redirect URL from page.url().

Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
@abdulahmad307

Copy link
Copy Markdown
Contributor

@copilot please fix the linting issue in the new test file

Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>

Copilot AI commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please fix the linting issue in the new test file

Formatted the new test to satisfy Prettier. ESLint, Prettier, and all 22 focused tests pass. Commit: d6422b8.

@abdulahmad307

Copy link
Copy Markdown
Contributor

ran workflows and they're passing

@abdulahmad307
abdulahmad307 marked this pull request as ready for review October 13, 2026 18:04
@abdulahmad307
abdulahmad307 requested a review from a team as a code owner October 13, 2026 18:04
Copilot AI balanced review requested due to automatic review settings October 13, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 originalUrl to 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.

Comment thread .github/actions/find/src/types.d.ts Outdated
Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
Co-authored-by: abdulahmad307 <204748719+abdulahmad307@users.noreply.github.com>
@abdulahmad307
abdulahmad307 merged commit 45aea0e into main Oct 15, 2026
8 checks passed
@abdulahmad307
abdulahmad307 deleted the copilot/add-original-url-to-finding branch October 15, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants