Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
json-alexander
Advanced tools
Serenity now! Safe JSON.parse
import parseJSON from 'json-alexander'
/* Normal Valid JSON */
parseJSON('{"valid": "works"}')
// -> {"valid": "works"}
/* Javascript objects */
parseJSON({ key: 'val' })
// -> { key: 'val' }
/* Malformed JSON */
parseJSON("{'malformed': 'works'}")
// -> {"malformed": "works"}
/* Unbalanced JSON */
parseJSON('{"unbalanced": "object"')
// -> {"unbalanced": "object" }
Returns undefined
if value passed in is not parsable
This package makes use of regular expressions when fixing malformed json. As a result, it may be vulnerable to a REDOS attack.
I've run the regex patterns through vuln-regex-detector and the patterns used appear to be safe.
I'm leveraging this in Serverless Functions with max timeouts on requests, so redos is somewhat mitigated. If using in long running server... use at your own risk.
Use simple
parser if you want to ignore malformed JSON & disable the mechanism that leverage regex patterns.
import { simple as simpleParse } from 'json-alexander'
/* Normal Valid JSON */
simpleParse('{"valid": "works"}')
// -> {"valid": "works"}
/* Javascript objects */
simpleParse({ key: 'val' })
// -> { key: 'val' }
/* Malformed JSON */
simpleParse("{'malformed': 'works'}")
// -> null no autofix
FAQs
Serenity Now! Forgiving JSON parser
The npm package json-alexander receives a total of 5,197 weekly downloads. As such, json-alexander popularity was classified as popular.
We found that json-alexander demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.