fix: sort and sort_natural filters bypass ownPropertyOnly (#869)

Use _getFromScope for property access in sort/sort_natural filters to respect the ownPropertyOnly security option, preventing prototype chain traversal that could leak sensitive inherited properties.

Also extract shared sortBy helper, add orderedCompare with nil handling consistent with caseInsensitiveCompare and Ruby Liquid.

Made-with: Cursor
This commit is contained in:
Yang Jun
2026-04-07 21:01:20 +08:00
committed by GitHub
parent 8f69a08399
commit e743da0020
4 changed files with 60 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { Drop } from '../drop/drop'
interface ScopeObject extends Record<string, any> {
interface ScopeObject extends Record<string | number | symbol, any> {
toLiquid?: () => any;
}