Skip to content

fix(examples): reject non-finite Django revenue prices - #84

Merged
ianmeyer merged 1 commit into
mainfrom
ianmeyer/sdk-556
Nov 2, 2026
Merged

ianmeyer merged 1 commit into
mainfrom
ianmeyer/sdk-556

Conversation

@ianmeyer

@ianmeyer ianmeyer commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Django example previously accepted price=NaN and 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

  • All 118 existing SDK unit tests pass.
  • Local Semgrep nan-injection rule check: one finding on the original view, zero after the fix.
  • git diff --check passes.

Checklist

  • PR title follows the required conventional commit format.
  • Breaking change: No.

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_revenue view no longer passes unchecked query parameters into Revenue. It now rejects price values that contain nan, fail float parsing, or are non-finite (via math.isfinite), and rejects quantity values 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.

@linear-code

linear-code Bot commented Nov 2, 2026

Copy link
Copy Markdown

SDK-556

@ianmeyer
ianmeyer marked this pull request as ready for review November 2, 2026 22:55
@ianmeyer
ianmeyer requested a review from a team as a code owner November 2, 2026 22:55
@ianmeyer
ianmeyer merged commit c6a935c into main Nov 2, 2026
18 of 19 checks passed
@ianmeyer
ianmeyer deleted the ianmeyer/sdk-556 branch November 2, 2026 23:36
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.

2 participants