Skip to content

fix(backend): validate incoming plugin run input context against empty payloads#366

Open
annukumar123 wants to merge 2 commits into
imDarshanGK:mainfrom
annukumar123:fix/plugins-wordcount-validation
Open

fix(backend): validate incoming plugin run input context against empty payloads#366
annukumar123 wants to merge 2 commits into
imDarshanGK:mainfrom
annukumar123:fix/plugins-wordcount-validation

Conversation

@annukumar123

Copy link
Copy Markdown

This PR addresses an input validation vulnerability across the backend plugin run router inside backend/routes/plugins.py.

The Problem: Previously, if a user submitted an empty string "" or whitespace-only inputs like " ", the text would bypass initial checks. This caused edge-case logic calculations to output erratic statistics (e.g., registering Sentences: 1 on an empty string inside the _wordcount plugin), executing unnecessary subprocess sandboxes, or writing meaningless telemetry logs to the database.

The Fix: Added a robust boundary validation check right at the entry point of the run_plugin route handler. If the stripped input string is empty, the server now halts execution immediately and raises a clean, structured HTTPException(status_code=400, detail="..."). This protects all downstream plugin functions and keeps server resources stable.

Hackathon Association

Program: Social Summer of Code (SSoC) 2026
Please label this PR with the appropriate SSoC difficulty tags (e.g., ssoc, level-1) so it registers for leaderboard points.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@annukumar123 is attempting to deploy a commit to the Darshan's projects Team on Vercel.

A member of the Team first needs to authorize it.

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