Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/hooks/useGitHubData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ export const useGitHubData = (
let q = `author:${username} is:${type}`;

if (filters.search) {
q += ` ${filters.search} in:title`;
// Strip GitHub search qualifiers (key:value pairs) from the free-text
// search term before appending it to the query string. Allowing raw
// qualifier injection lets a caller override repo:, author:, is:, and
// other operators already set by the hook, potentially leaking data
// from repositories outside the intended scope.
const sanitizedSearch = filters.search
.replace(/[a-zA-Z_-]+:[^\s]*/g, '')
.trim();
if (sanitizedSearch) {
q += ` ${sanitizedSearch} in:title`;
}
}

if (filters.repo) {
Expand Down
Loading