-
Notifications
You must be signed in to change notification settings - Fork 17
fix: implement robust PR URL validation and sanitization #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ojaswa072
wants to merge
9
commits into
OWASP-BLT:main
Choose a base branch
from
ojaswa072:fix/pr-url-input-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c2243c9
fix: add dual-layer PR URL validation and UI error feedback
ojaswa072 e8c0de1
Merge branch 'main' into fix/pr-url-input-validation
ojaswa072 b23fc17
fix: implement robust PR URL validation and sanitization
ojaswa072 f08457d
fix: implement robust PR URL validation with composite-key dedupe and…
ojaswa072 9ec3961
fix: verify inline findings for dedupe, URL validation accessibility,…
ojaswa072 79911b1
fix: normalize PR identity matching and harden Windows cmd argument q…
ojaswa072 24413dd
fix: terminate Windows wrangler process tree during runtime test cleanup
ojaswa072 0fd5f79
fix: resolve remaining review findings for validation, identity match…
ojaswa072 0d3324d
fix: consolidate PR URL validation, fix org URL misrouting, and ensur…
ojaswa072 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
migrations/0004_add_canonical_url_and_composite_uniqueness.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| -- Migration: Add canonical_url metadata and composite uniqueness for PR identity | ||
| -- Created: 2026-03-25 | ||
| -- Description: | ||
| -- 1) Adds canonical_url column for normalized PR URL storage | ||
| -- 2) Backfills canonical_url for existing rows | ||
| -- 3) Removes duplicate rows by (repo_owner, repo_name, pr_number), keeping latest id | ||
| -- 4) Enforces uniqueness on (repo_owner, repo_name, pr_number) | ||
|
|
||
| ALTER TABLE prs ADD COLUMN canonical_url TEXT; | ||
|
|
||
| UPDATE prs | ||
| SET canonical_url = 'https://github.com/' || repo_owner || '/' || repo_name || '/pull/' || pr_number | ||
| WHERE canonical_url IS NULL OR canonical_url = ''; | ||
|
|
||
| WITH ranked_prs AS ( | ||
| SELECT | ||
| id, | ||
| ROW_NUMBER() OVER ( | ||
| PARTITION BY LOWER(repo_owner), LOWER(repo_name), pr_number | ||
| ORDER BY readiness_computed_at DESC NULLS LAST, | ||
| updated_at DESC NULLS LAST, | ||
| id DESC | ||
| ) AS row_num | ||
| FROM prs | ||
| ) | ||
| DELETE FROM prs | ||
| WHERE id IN ( | ||
| SELECT id | ||
| FROM ranked_prs | ||
| WHERE row_num > 1 | ||
| ); | ||
|
|
||
| CREATE UNIQUE INDEX IF NOT EXISTS idx_prs_identity_unique | ||
| ON prs(repo_owner COLLATE NOCASE, repo_name COLLATE NOCASE, pr_number); |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.