File size: 443 Bytes
23ac194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict'

const { test } = require('node:test')
const build = require('..')

test('sanitize 6', t => {
  const payload = '(throw "pwoned")'

  const stringify = build({
    type: 'object',
    properties: {
      '/*': { type: 'object' },
      x: {
        type: 'object',
        properties: {
          a: { type: 'string', default: `*/}${payload};{//` }
        }
      }
    }
  })
  t.assert.doesNotThrow(() => { stringify({}) })
})