smol-toml @1.5.2
A small, fast, and correct TOML parser/serializer
Maintainers
Keywords
Dev Dependencies (11)
| Package | Constraint | Registry Status |
|---|---|---|
| vitest | ^4.0.8 | auto_approved |
| esbuild | ^0.27.0 | auto_approved |
| fast-toml | ^0.5.4 | Not imported |
| @vitest/ui | ^4.0.8 | auto_approved |
| typescript | ^5.9.3 | auto_approved |
| @iarna/toml | 3.0.0 | auto_approved |
| @ltd/j-toml | ^1.38.0 | auto_approved |
| @types/node | ^24.10.1 | auto_approved |
| pin-github-action | ^3.4.0 | auto_approved |
| @tsconfig/node-lts | ^22.0.3 | pending |
| @tsconfig/strictest | ^2.0.8 | pending |
Risk Dispositions (1 applicable to this version, 0 other)
Accepted rules are downgraded to INFO on future analyses; rejected rules escalate to CRITICAL.
| Rule | Source | Disposition | Author | Reason | |
|---|---|---|---|---|---|
osv:GHSA-v3rj-xjv7-4jmq |
osv | reject | AI | AI (osv): DoS via recursive comment parsing; fixed in 1.6.1. All versions < 1.6.1 are affected; verdict generalizes across those versions. |
SAST Findings (2)
CVSS 5.3 (MEDIUM) — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L ### Summary An attacker can send a maliciously crafted TOML to cause the parser to crash, because of a stack overflow caused by thousands of consecutive commented lines. The library uses recursion internally while parsing to skip over commented lines, which can be exploited to crash an application that is processing arbitrary TOML documents. ### Proof of concept ```js require("smol-toml").parse('# comment\n'.repeat(8000) + 'key = "value"') ``` ### Impact Applications which parse arbitrary TOML documents may suffer availability issues if they receive malicious input. If uncaught, the crash may cause the application itself to crash. The impact is deemed minor, as the function is already likely to throw errors on invalid input. Downstream users are supposed to properly handle errors in such situations. Due to the design of most JavaScript runtimes, the uncontrolled recursion does not lead to excessive memory usage and the execution is quickly aborted. As a reminder, it is **strongly** advised when working with untrusted user input to expect errors to occur and to appropriately catch them. ### Patches Version 1.6.1 uses a different approach for parsing comments, which no longer involves recursion. ### Workarounds Wrap all invocations of `parse` and `stringify` in a try/catch block when dealing with untrusted user input.
Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.
Review Summary
Risk score: 40. Findings: 1 critical (+40), 1 info (+0).
Published to npm: