mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
fix: restore BLOCKED_SCOPE_KEYS gated by ownPropertyOnly
Dangerous keys (__proto__, constructor, prototype) are blocked only when ownPropertyOnly is true (default). With false, full prototype access is allowed as an explicit opt-out; use bourne for untrusted input. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -40,10 +40,11 @@ describe('scope security', function () {
|
||||
)).resolves.toBe('ab')
|
||||
})
|
||||
|
||||
it('should allow own blocked keys when ownPropertyOnly=true', async function () {
|
||||
it('should block own blocked keys when ownPropertyOnly=true', async function () {
|
||||
const scope = JSON.parse('{"__proto__": {"polluted": true}, "constructor": {"name": "Custom"}, "name": "Alice"}')
|
||||
await expect(liquid.parseAndRender('{{ __proto__.polluted }}', scope)).resolves.toBe('true')
|
||||
await expect(liquid.parseAndRender('{{ constructor.name }}', scope)).resolves.toBe('Custom')
|
||||
await expect(liquid.parseAndRender('{{ __proto__.polluted }}', scope)).resolves.toBe('')
|
||||
await expect(liquid.parseAndRender('{{ constructor.name }}', scope)).resolves.toBe('')
|
||||
await expect(liquid.parseAndRender('{{ name }}', scope)).resolves.toBe('Alice')
|
||||
})
|
||||
|
||||
it('should block inherited properties when ownPropertyOnly=true', async function () {
|
||||
|
||||
Reference in New Issue
Block a user