fix: sanitize taxonomy JSON output#324
Open
OpadijoIdris wants to merge 1 commit into
Open
Conversation
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.
Title:
fix: sanitize taxonomy JSON output
Body:
Summary
This PR hardens the taxonomy export pipeline by sanitizing text values and preserving large integer error codes without lossy JavaScript number coercion.
What changed
Added a TOML parsing and normalization step for the taxonomy export script
Trimmed and normalized whitespace in text fields to avoid layout-breaking newline/carriage-return issues
Validated numeric error codes so unsafe integers are preserved as strings instead of silently rounded in JavaScript
Wrote the final artifact using deterministic JSON serialization to disk
Why
The previous pipeline allowed raw TOML-derived strings and large numeric identifiers to pass through without safeguards, which could lead to:
silent precision loss for large error codes
unwanted whitespace/CRLF artifacts in UI-facing descriptions
Verification
Ran node --test index.test.js && node index.js
Result: 2 tests passed, 0 failed
Closes #309