Repository navigation
fix(examples): reject non-finite Django revenue prices - #84
Merged
Merged
Conversation
ianmeyer
marked this pull request as ready for review
November 2, 2026 22:55
crleona
approved these changes
Nov 2, 2026
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.
Summary
The Django example previously accepted
price=NaNand infinite prices when tracking revenue. Reject NaN before float conversion, reject other non-finite prices, and return HTTP 400 for malformed price or quantity inputs.Fixes SDK-556.
Validation
nan-injectionrule check: one finding on the original view, zero after the fix.git diff --checkpasses.Checklist
Note
Low Risk
Example-only input validation in the Django demo view with no changes to SDK or production paths.
Overview
The Django example
track_revenueview no longer passes unchecked query parameters intoRevenue. It now rejectspricevalues that containnan, failfloatparsing, or are non-finite (viamath.isfinite), and rejectsquantityvalues that are not valid integers, responding with HTTP 400 and a short error message instead of tracking bad revenue data.This addresses the Semgrep nan-injection finding (SDK-556) in the sample app only; core SDK behavior is unchanged.
Reviewed by Cursor Bugbot for commit bb93020. Bugbot is set up for automated code reviews on this repo. Configure here.