paramsFromClient pollutes context by default · Issue #730 · feathersjs-ecosystem/feathers-hooks-common · GitHub
Skip to content

paramsFromClient pollutes context by default #730

Closed

Description

@FossPrime

While whitelisting is a good security feature, it is the adapter's job to complain about invalid query parameters, not ours.

It makes it difficult to compose hooks with this as it damages the context if used at app level/around/provider and also in services.

Proposal:

   const foreignParamCount = 0
    // in an Object.keys(ctx.params.query?.$client) loop, foreignParamCount++
	if (foreignParamCount === 0) {
      delete ctx.params.query.$client
    }

The alternative is to dump repetitive code like this in all over userland hooks:

delete ctx.params.query.$client.sudo
if (Object.keys(ctx.params.query.$client).length === 0) {
  delete ctx.params.query.$client
}

Activity

  1. fratzinger commented on Feb 18, 2025

    @fratzinger
    Collaborator

    Just a quick headsup. I started working on a massive rewrite of the package (#764). It's not released yet and will take a few weeks.

    This should be fine then, see https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/modernize/src/hooks/params-from-client2/params-from-client2.ts

  2. fratzinger commented on Sep 8, 2026

    @fratzinger
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions