Skip to content

Fix pollbot invalid inputs - #355

Merged
michalz-zoom merged 1 commit into
masterfrom
dev/michal/fix-bad-votes
Sep 1, 2026
Merged

Fix pollbot invalid inputs#355
michalz-zoom merged 1 commit into
masterfrom
dev/michal/fix-bad-votes

Conversation

@michalz-zoom

Copy link
Copy Markdown
Contributor

No description provided.

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

This PR hardens pollbot’s vote handling by rejecting malformed/invalid vote payloads and out-of-range choices before writing to the database or updating poll results.

Changes:

  • Update NewVoteFromEncoded to return (Vote, error) and properly handle decode/msgpack failures plus missing poll IDs.
  • In the HTTP vote handler, reject invalid vote payloads and enforce Choice bounds based on the poll’s numChoices before casting the vote.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pollbot/pollbot/vote.go Adds error-returning decode path and validates required fields when decoding votes.
pollbot/pollbot/http.go Validates decoded vote payloads and enforces choice range before persisting and updating tallies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pollbot/pollbot/http.go Outdated
@michalz-zoom
michalz-zoom force-pushed the dev/michal/fix-bad-votes branch from 8cc1eab to 97366ce Compare August 31, 2026 15:53
@michalz-zoom
michalz-zoom merged commit d5b781c into master Sep 1, 2026
1 check passed
@michalz-zoom
michalz-zoom deleted the dev/michal/fix-bad-votes branch September 1, 2026 19:09
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.

3 participants