Repository navigation
chore: #264 follow-ups (changeset ranges, a dictionary type, a shadowed list) - #273
Merged
Merged
Conversation
… a shadowed list) - The pending changeset gave one affected range for both defects. The prototype pollution through `nest` affects 0.1.0-0.16.3; the filter grammar's `Object.prototype` 500 affects only 0.13.0-0.16.3, since `src/internal/filter.ts` first shipped in 0.13.0 (f59b77c, #86). - `nest`'s group literal no longer carries a `Record<string, unknown>` annotation, a `no-unsafe-dictionary-type` site the effect `Record` import hid from the linter; the cast after `getOrElse` already types the group, so the rule's true count is back to its pre-#264 base. - `Query.filter.test.ts` drops a nested `inherited` list that shadowed the identical module-level one. No behaviour change. Refs #260. Claude-Session: https://claude.ai/code/session_0187g2QpzaHqEzX8GJxiJBVc Co-Authored-By: Claude <noreply@anthropic.com>
3 tasks
The pending changeset's headline named two defects, but the change also
fixes a third request-triggerable 500: `nest`'s `??= {}` group write
throws a TypeError when a bracket key follows a bare key of the same
name (strict-mode assignment onto a string), the #260 title bug. It hits
the same no-family endpoints over the same range. Checked against the
published 0.1.0 and 0.16.3 packages: `Query.schema(R, {})` throws
`TypeError: Cannot create property ... on string` for that input on
both.
The headline now names three defects: the prototype pollution and that
500 on no-family endpoints (0.1.0-0.16.3), and the filter grammar's 500
(0.13.0-0.16.3). Still no request payload and no fixed version.
Refs #260.
Claude-Session: https://claude.ai/code/session_0187g2QpzaHqEzX8GJxiJBVc
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #264. Refs #260.
Three items from the security re-review of #264, plus a headline correction from the review of this PR. None changes behaviour.
Changeset ranges.
.changeset/undeclared-query-params.md(pending, unreleased) gave one affected range, 0.1.0–0.16.3, for both defects. Each defect now has its own range:The prototype pollution through
nestaffects 0.1.0–0.16.3.nestinsrc/internal/codecs.tsalready exists at the@thomasfosterau/effect-jsonapi@0.1.0tag, with the same??= {}group write.The filter grammar's
Object.prototype500 affects 0.13.0–0.16.3.git log --diff-filter=A -- src/internal/filter.tsgivesf59b77c(E3Query.filtercodec: URL ⇄ filter AST with error pointers #86, "Add the filter URL codec, filter AST and error pointers").git tag --contains f59b77cstarts at@thomasfosterau/effect-jsonapi@0.13.0, and the file is absent from the0.12.0tree. The 0.13.0 CHANGELOG lists f59b77c as thefilter: truecodec, and itsfilter.tsalready has the plainfields[field]lookups that fix(Query): drop undeclared query parameters when the query declares nothing (#260) #264 replaced.The headline now counts three defects, not two. The PR also fixes the bare/bracket key collision in
nest(bug: an endpoint whose query declares nothing passes every parameter to its handler, and?x=1&x[y]=2is a 500 #260's title bug), a third request-triggerable 500:nest's??= {}group write followed by an assignment onto a string throws in strict ESM. It hits the same no-family endpoints over the same range, 0.1.0–0.16.3. I checked this against the published 0.1.0 and 0.16.3 packages from npm:Query.schema(R, {})for a resource with no relationships throwsTypeError: Cannot create property ... on stringwhen a bare key precedes its bracket form, on both versions. The headline now reads "A prototype-pollution vulnerability (CWE-1321) and a request-triggerable 500 on endpoints whose query declares no family … affect versions 0.1.0–0.16.3; a second request-triggerable 500, in thefilter: truegrammar … affects versions 0.13.0–0.16.3".The wording still contains no request payload. It names no fixed version, because whether the fix ships as 0.17.0 or as a backported 0.16.4 is the owner's decision.
no-unsafe-dictionary-typeinnest. fix(Query): drop undeclared query parameters when the query declares nothing (#260) #264 addedconst made: Record<string, unknown> = {}, and the linter didn't report it becauseRecordis now imported fromeffect, which shadows the global name. The annotation is gone. Theas Record<string, unknown>cast afterOption.getOrElse(the same cast as before fix(Query): drop undeclared query parameters when the query declares nothing (#260) #264) already types the group. A local interface or an index-signature alias would not help, because the rule also reports anunknown-valued index signature.Rincodecs.ts,filter.tsandQuery.ts. The pre-fix(Query): drop undeclared query parameters when the query declares nothing (#260) #264 base (b1d774b^1) has 94. Trunk with the alias has 95, and the extra site iscodecs.ts:192:21, which ismade. This branch with the alias has 94.codecs.ts, two inQuery.ts) as visibleno-unsafe-dictionary-typewarnings. With the fourno-known-value-wideningsites the same alias unmasks, 11 warnings appear in total across rules (4353 → 4364), so it is not lint-neutral. The visiblevp lintoutput is identical to trunk's (4353 warnings).Shadowed
inherited.src/Query.filter.test.tsdeclared a secondinheritedlist inside adescribeblock, with the same five keys as the module-level one at line 45. The inner one is deleted. The twoit.each(inherited)blocks still run once for each ofconstructor,__proto__,toString,hasOwnPropertyandvalueOf(10 cases, all passing).Verification
pnpm install --frozen-lockfile: passvp run build: passvp check: pass (0 errors, 4353 warnings, the same as trunk)vp run check(sources, type-level tests, examples, emitted declarations): pass ("every type gate green")vp run -r test:unit: pass (root 2254/2254; every example suite passes)vp run docgen(every JSDoc@examplecompiled and executed): passfallow audit --format json --quiet --explain --gate-marker agent: verdictpassfallow audit --base origin/trunk: pass ("No issues in 3 changed files"; 3 inherited findings excluded)Re-run in this order on the headline-correction commit, with the same results.
Changeset
No new changeset. Item 1 corrects the text (affected ranges and the defect count in the headline) of the existing, still-pending
.changeset/undeclared-query-params.md(patch), and items 2 and 3 are lint and test hygiene..changeset/for every change to published behaviour (no published behaviour changes)Notes
effectpeer range changes.🤖 Generated with Claude Code
Generated by Claude Code