deps: add ata JSON Schema validator for node.config.json#62603
deps: add ata JSON Schema validator for node.config.json#62603mertcanaltin wants to merge 6 commits intonodejs:mainfrom
Conversation
Add ata-validator (v0.4.3) as a new dependency for JSON Schema validation. Built with ATA_NO_RE2 to avoid RE2/abseil dependencies. Uses simdjson (already in core) for JSON parsing. Refs: nodejs#62598
Validate the configuration file against its JSON Schema using ata-validator as a supplementary check after the existing parser. This provides a safety net for type errors the parser might miss. Refs: nodejs#62598
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62603 +/- ##
==========================================
- Coverage 91.53% 89.70% -1.83%
==========================================
Files 352 695 +343
Lines 147833 214544 +66711
Branches 23148 41083 +17935
==========================================
+ Hits 135321 192466 +57145
- Misses 12255 14122 +1867
- Partials 257 7956 +7699
🚀 New features to boost your workflow:
|
|
IMHO this is a bit too much, an extra dep for a schema parser inside Node.js (not to mention that is not even v1.x) This is not a blocker, this is just my personal opinion |
|
That's a fair concern. The dependency is intentionally minimal, it only uses simdjson which is already in core (no new external dependencies since it's built with ATA_NO_RE2). On the version, you're right it's pre-1.0, but it already passes 96.9% of the official JSON Schema Test Suite. Happy to work toward 1.0 if that's a requirement. |
|
Maybe ata could also be exposed to JS userland as an API if it ends up being vendored in? |
|
Yes, that's the plan! The initial PR focuses on The main prerequisite is getting the security story solid first, we've already submitted to OSS-Fuzz and all 283 nst/JSONTestSuite tests are passing. |
|
@mertcanaltin check also https://www.npmjs.com/package/@exodus/schemasafe testsuite |
|
Thanks @ChALkeR, I ran the schemasafe test suite against ata (draft2020-12): 95.3% pass rate, 1103/1157, 59 skipped (remote refs). Main gaps are unevaluatedProperties/Items annotation tracking, some $ref URI edge cases (URN, absolute-path), grapheme counting in minLength/maxLength, and a few optional format semantics. Running the suite also helped me catch a few things I fixed since: recursion depth guard for circular $ref, proto handling in const/enum, and date format range checks. $dynamicRef is fully passing now (42/42). Working on the rest. |
Notable changes: - $anchor, $dynamicAnchor, $dynamicRef support (42/42 spec tests) - Recursion depth guard for circular $ref (prevents stack overflow) - __proto__ key handling in const/enum comparison - Date format month/day range validation - 94.2% Draft 2020-12 spec compliance (1156/1227 tests) - 95.3% @exodus/schemasafe test suite pass rate
Adds ata-validator (v0.8.0) to validate
node.config.jsonagainst its JSON Schema before parsing.Clear error messages for invalid config instead of generic "Invalid value" errors.
Example output:
What's included:
deps/ata/with ata-validator built usingATA_NO_RE2(no extra dependencies, only simdjson which is already in core)node_config_file.ccbefore existing parsingprocess.versions.ataSpec compliance:
@exodus/schemasafetest suite$dynamicRef/$anchor: 42/42 (100%)Security:
$ref__proto__safeconst/enumcomparisonrefs: #62598