Skip to content

[ShanaBoo] Search endpoint has no input validation or length limit on query#6506

Open
genesisrevelationinc-debug wants to merge 12 commits into
SecureBananaLabs:mainfrom
genesisrevelationinc-debug:shanaboo-fix-2833
Open

[ShanaBoo] Search endpoint has no input validation or length limit on query#6506
genesisrevelationinc-debug wants to merge 12 commits into
SecureBananaLabs:mainfrom
genesisrevelationinc-debug:shanaboo-fix-2833

Conversation

@genesisrevelationinc-debug

Copy link
Copy Markdown

ShanaBoo Autonomous Fix

This PR was automatically generated by ShanaBoo Earn Engine to claim the $780.00 bounty on this issue.

Source: Github | Task: 4557389259

Closes #2833


Auto-submitted by ShanaBoo CNS — NVIDIA NIM + Microsoft Agent Framework

Copilot AI review requested due to automatic review settings June 10, 2026 15:23
github-actions Bot added a commit that referenced this pull request Jun 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds request validation for the q query parameter in the search controller, returning a 400 on invalid input before calling the search service.

Changes:

  • Added badRequest error response for invalid search queries
  • Introduced validateSearchQuery() to trim and enforce a maximum query length
  • search() now validates/sanitizes req.query.q prior to calling globalSearch()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

// Trim whitespace
let trimmedQuery = query.trim();
Comment on lines +15 to +17
if (trimmedQuery.length > 200) {
return { isValid: false, error: 'Search query exceeds maximum length of 200 characters' };
}
Comment on lines +19 to +25
// Basic sanitization (removing potentially harmful characters)
// Here we just return the trimmed query as it's already been length-checked
// In a more comprehensive solution, you might want to strip special characters or apply other rules
return {
isValid: true,
sanitizedQuery: trimmedQuery
};
Comment on lines +29 to +34
const query = req.query.q ?? "";
const validation = validateSearchQuery(query);

if (!validation.isValid) {
return badRequest(res, { error: validation.error });
}
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.

Search endpoint has no input validation or length limit on query

2 participants