Files
WRNexusJS/docs
ClintchizandClaude Opus 5 cc8085bcfa docs: fix memo-key cross-authorization in the Task 7 plan snippet
The middleware's per-request memo keyed resources by String(resource.id) with
an unserialisable fallback that shared one bucket. Six demonstrated cases
cross-authorized: {id:1} vs the primitive 1; {id:7} vs {id:"7"}; object ids;
and every circular / BigInt / throwing-getter row collapsing together so the
first verdict in a request became the verdict for all of them. filterCan
returned 3 of 3 rows where 1 was permitted - it leaked, rather than denied.

Object resources now memo by identity through a WeakMap; primitives key on
JSON-encoded [scope, permission, typeof, value] so 7 and "7" stay distinct
and a tenant id containing the separator cannot collide.

Scope is also read at decision time rather than frozen when the middleware
runs, and is part of the memo key, so switching tenant mid-request no longer
returns the previous tenant's verdict.

guardPermission additionally: denies instead of 500ing when getResource
throws (and no longer leaks the loader's message), skips redirectTo for API
requests using the same rule requireAuth applies, refuses a non-local
redirect target, and sets cache-control: private, no-store.

Adds eleven regression tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 18:35:05 +05:30
..
2026-08-01 01:09:58 +05:30
2026-07-22 17:29:08 +05:30
2026-07-27 12:42:18 +05:30
2026-07-22 17:29:08 +05:30
2026-07-29 12:51:10 +05:30
2026-07-29 12:51:10 +05:30
2026-08-02 23:18:51 +05:30
2026-07-27 12:42:18 +05:30
2026-08-02 23:18:51 +05:30
2026-08-02 23:18:51 +05:30
2026-08-02 23:18:51 +05:30
2026-08-02 23:18:51 +05:30
2026-08-02 23:18:51 +05:30
2026-08-02 23:18:51 +05:30
2026-07-22 17:29:08 +05:30
2026-07-27 12:42:18 +05:30
2026-07-22 17:29:08 +05:30
2026-07-27 12:42:18 +05:30
2026-08-03 19:47:30 +05:30
2026-08-04 12:19:09 +05:30