]> git.kaiwu.me - njs.git/commit
QueryString: use null prototypes for parsed arguments
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 17 Nov 2026 00:19:41 +0000 (16:19 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Tue, 17 Nov 2026 20:41:43 +0000 (12:41 -0800)
commit437bfdbf516ead51c5397ebfd899e6722e29285b
tree78a2bdb878ffeb3ca543dd88c48f983b4654b0f2
parent14f8ae4dd8bede83f4e4fc9f7fd532ab5e2c05b8
QueryString: use null prototypes for parsed arguments

Previously, querystring.parse() and r.args consulted inherited
properties when collecting duplicate parameters. Keys such as
"toString" included inherited functions in their values, and
"__proto__" replaced the prototype of the result with an array.

Now both engines create results with a null prototype, matching
Node.js and treating all parsed names as data. Object.prototype
methods, including hasOwnProperty(), are no longer inherited.

The njs regression was introduced in 8b9b297d (0.8.0). The QuickJS
r.args implementation introduced the same issue in 201b1276
(0.8.6), followed by querystring.parse() in f289dcb9 (0.8.10).

The issue was found by Basavaraj S m (basavaraj-sm05) in PR #1147:
https://github.com/nginx/njs/pull/1147
external/njs_query_string_module.c
external/qjs_query_string_module.c
nginx/ngx_http_js_module.c
nginx/t/js_args.t
src/njs.h
src/njs_object.c
src/njs_object.h
src/njs_vm.c
test/querystring.t.mjs
ts/ngx_http_js_module.d.ts
ts/njs_modules/querystring.d.ts