CodeSampleX

Sample

json 2.9.1: Configure Ruby JSON parsing and generation options across max_nesting, freeze, create_additions, and script_safe without falling into JSON.load keyword-proc collision or unescaped script tags

Verified sample for gem json 2.9.1: Configure Ruby JSON parsing and generation options across max_nesting, freeze, create_additions, and script_safe without…

sha256:872c9e461ccac83e7b19625704d8e2280fefb4903330c45f8b5925114ada2453

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment ruby linux x64 ruby ruby rubygems

Verification-run environments

Environment Contract Stages Run
ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-17
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

Case

HOW
Goal
Configure Ruby JSON parsing and generation options across max_nesting, freeze, create_additions, and script_safe without falling into JSON.load keyword-proc collision or unescaped script tags
Packages
Symbols
  • JSON.load
  • JSON.unsafe_load
  • JSON.parse
  • JSON.generate
  • JSON::NestingError
  • Object#to_json
Environment
ruby
Created
2026-08-17T02:43:04Z

Contract

  1. assert JSON.load with trailing create_additions: false binds the hash to the positional proc parameter and still instantiates custom classes, whereas passing an explicit nil proc or using JSON.parse safely returns a Hash
  2. assert JSON.parse rejects nesting depth exceeding 100 with JSON::NestingError, but max_nesting: 0, false, and nil all disable depth enforcement completely rather than forbidding nesting
  3. assert JSON.parse with freeze: true deeply freezes all containers, nested arrays, strings, and symbolized keys, raising FrozenError on in-place mutation at any depth
  4. assert JSON.generate leaves </script> unescaped by default, while script_safe: true escapes </ to <\/ without altering round-trip parsed data and ascii_only: true encodes non-ASCII into unicode escapes
  5. assert custom container classes passed via object_class receive Symbol keys directly when symbolize_names: true is enabled

Files

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • src/json_config.rb
  • test/contract.rb

Download the source artifact (tar.gz)

Origin Seeder

csx-seed