SShortSingh.
Back to feed

Python's JSON Parser Accepts NaN, Creating Silent Balance Corruption Bug

0
·1 views

A developer tutorial on DEV Community highlights a subtle but serious vulnerability in Python Flask-based web servers that handle numeric JSON input. Python's native json module silently accepts non-standard JSON constants like NaN, converting them to float('nan') and allowing them to pass standard numeric type checks. Once NaN enters the application state, all subsequent arithmetic operations also return NaN, effectively bypassing balance validation and enabling unlimited withdrawals. The problem compounds when persisting data: SQLite converts NaN to NULL while PostgreSQL stores it as an actual numeric value, corrupting the database in different ways. The article demonstrates why developers must explicitly validate parsed numbers for finiteness, not just type, when processing financial or sensitive numeric inputs.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

OpenAI Codex Moves Beyond Code Generation to Operate Windows Computers

OpenAI's May 29 Codex update introduces computer use on Windows, enabling the AI agent to see, click, and type within applications while testing and refining software. Unlike traditional code generators that return text patches and leave execution to the developer, Codex can now observe a running app, read the console, reproduce bugs, and verify fixes end-to-end. The update also adds remote control, allowing users to supervise ongoing work from ChatGPT on mobile or Codex on Mac while a Windows machine handles the project files and local environment. This shift matters because real software development involves navigating browsers, terminals, logs, and design tools — not just editing code in an IDE. By giving AI agents access to the full observe-diagnose-change-verify loop that engineers actually work in, the update represents a meaningful change in how AI-assisted development could function.

0
ProgrammingDEV Community ·

Transactional Outbox Pattern Has Hidden Throughput Limits, Load Tests Reveal

The transactional outbox pattern is widely used to ensure consistency between database writes and event publishing, but a load test of 1,000 requests exposed significant production gaps. A scheduled publisher configured with a 5-second delay and a batch size of 20 rows created a hard ceiling of just 4 events per second. During the test, inbound requests arrived at roughly 14 requests per second, causing a backlog of 720 rows and a peak event delay of 191 seconds. No data was lost, but the system was structurally incapable of meeting a 30-second event-freshness SLO at any input rate above 4 requests per second. The core finding is that throughput constraints set by arbitrary configuration values must be measured and documented explicitly in SLO catalogs, not left hidden in code.

0
ProgrammingDEV Community ·

Security Engineer Builds Go-Based Purple Team Scanner to Automate Recon and CVE Hunting

Mohamed Medjahdi, a Security Engineer and DevSecOps Specialist, has developed OmniScan, an offensive security tool written entirely in Go to address inefficiencies in Purple Team operations. The tool replaces fragile bash-based workflows by offering a DAG-driven pipeline orchestrator that lets users define multi-step attack chains in YAML, running independent steps concurrently via Go goroutines. OmniScan includes a headless Chrome-powered module called techFinder, which inspects live DOM structures and intercepts network requests to identify web technologies that standard fingerprinting methods often miss. It also ships with a built-in TLS-intercepting MITM proxy designed to automate privilege escalation and IDOR vulnerability testing across complex cloud environments. Medjahdi stated that the OmniScan repository is being prepared for open-source release on GitHub in the near future.

0
ProgrammingDEV Community ·

Developer reverse-engineers Windows-only cooler software to build Linux CPU monitor

A Linux user who purchased a Pichau Aqua 120X water cooler found that the manufacturer only provided Windows software, leaving the device's LCD display non-functional on Linux. Although the system recognised the hardware as a USB serial device at /dev/ttyACM0, no data was being sent to the screen. Using the Ghidra reverse-engineering tool, the developer analysed the official Windows binary to uncover the serial communication settings — 1,000,000 baud, 8N1 — and the byte format used to transmit CPU metrics. The investigation revealed that the software could push multiple system stats, including CPU temperature, frequency, utilisation, and fan speed, to the display. Armed with this protocol knowledge, the developer wrote a custom Linux script to periodically update the LCD with live CPU temperature data.

Python's JSON Parser Accepts NaN, Creating Silent Balance Corruption Bug · ShortSingh