Skip to content

fix(agents): sanitize and validate slug parameter on listing details endpoint - #1474

Open
jihadMo wants to merge 1 commit into
SuperteamDAO:mainfrom
jihadMo:fix/agent-listing-details-slug-validation
Open

fix(agents): sanitize and validate slug parameter on listing details endpoint#1474
jihadMo wants to merge 1 commit into
SuperteamDAO:mainfrom
jihadMo:fix/agent-listing-details-slug-validation

Conversation

@jihadMo

@jihadMo jihadMo commented Aug 19, 2026

Copy link
Copy Markdown

Summary of Changes

  • Sanitizes and validates the \slug\ query parameter in \src/pages/api/agents/listings/details/[slug].ts.
  • Handles potential string arrays (\string[]), trims whitespace, and rejects empty strings with HTTP 400 Bad Request (\Missing required query parameters: slug).
  • Prevents Prisma query errors and ensures consistent validation with \src/pages/api/agents/listings/live.ts.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of listing detail requests when the listing identifier is missing, empty, or provided in an unexpected format.
    • Prevented invalid requests from triggering unnecessary listing detail lookups.

@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

@jihadMo is attempting to deploy a commit to the Superteam Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68fa4553-0e79-4a44-95cc-8222152ba68d

📥 Commits

Reviewing files that changed from the base of the PR and between 145486c and 1b4d3f9.

📒 Files selected for processing (1)
  • src/pages/api/agents/listings/details/[slug].ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

The listing details API handler now normalizes req.query.slug from string or array input, trims whitespace, and rejects missing or empty slugs before querying listing details.

Changes

Listing slug validation

Layer / File(s) Summary
Normalize and validate listing slug
src/pages/api/agents/listings/details/[slug].ts
The handler extracts the slug from string or array query values, trims whitespace, and rejects missing or whitespace-only values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 1b4d3

This localized API validation change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Poem

I’m a rabbit guarding the route,
Trimming each slug before it goes out.
Empty ones hop to an error lane,
Clean ones fetch listing details again.
Safe little inputs, neat and bright—
The API burrows on right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes sanitizing and validating the slug parameter on the listing details endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant