Refuse non-string plugin refs and Bot ids before the store - #487
Merged
davidmckayv merged 2 commits intoSep 11, 2026
Merged
Conversation
Ayush7614
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 11, 2026 09:58
# Conflicts: # CHANGELOG.md
davidmckayv
approved these changes
Sep 11, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Deep-reviewed clean (validation, no secret leak, fail-closed, agrees with existing layers). CI green.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this changes
POST /api/plugins/grantsandPOST /api/plugins/callchecked presence (!body?.ref), not shape. The body is JSON, so{"ref":123,"agentId":[]}is truthy, passed the guard, and reached the store where Drizzle compares a text column against a number/object — a 500 instead of a 400, with no sentence naming what is required. Both routes now require non-empty strings (trimmed) for ref/agentId. Query-paramDELETE /grantsalready deals in strings and is untouched.Where it runs
Boundary and audit
canUseBot, the grant store, and vendors.Changelog
CHANGELOG.mdunderUnreleased: non-string grant/call entry.Proof
bun test server/tests/plugin-grants-validation.test.ts: 10 pass (number/object/array/whitespace refs and agentIds each 400 with the existing message, zero store calls).bun run format:check: clean.bun run lint: clean.embla-carousel-reactfailure identical on clean main).