{"id":19195286,"url":"https://github.com/fixate/fixate-feathers-hooks","last_synced_at":"2026-06-15T18:31:47.685Z","repository":{"id":57237659,"uuid":"83549095","full_name":"fixate/fixate-feathers-hooks","owner":"fixate","description":"Some useful and miscellaneous feathers hooks","archived":false,"fork":false,"pushed_at":"2018-09-10T13:43:47.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T04:38:59.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fixate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-01T11:53:07.000Z","updated_at":"2019-05-15T15:47:41.000Z","dependencies_parsed_at":"2022-08-26T14:04:17.684Z","dependency_job_id":null,"html_url":"https://github.com/fixate/fixate-feathers-hooks","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/fixate/fixate-feathers-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Ffixate-feathers-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Ffixate-feathers-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Ffixate-feathers-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Ffixate-feathers-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fixate","download_url":"https://codeload.github.com/fixate/fixate-feathers-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Ffixate-feathers-hooks/sbom","scorecard":{"id":401862,"data":{"date":"2025-08-11","repo":{"name":"github.com/fixate/fixate-feathers-hooks","commit":"a7c6ed06eb0d657656fa03f329f4820e27a8f3b3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"18 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-g36h-6r4f-3mqp","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T20:15:13.673Z","repository_id":57237659,"created_at":"2025-08-18T20:15:13.673Z","updated_at":"2025-08-18T20:15:13.673Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34376121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T12:09:30.976Z","updated_at":"2026-06-15T18:31:47.667Z","avatar_url":"https://github.com/fixate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fixate-feathers-hooks\n\n### These are largely deprecated by the latest feathers-hooks-common \n\nA mixed bag of feathers hooks that are useful in almost all projects.\n\nThey all curry the hook function, so the 'outer' call is used for configuration and returns a\nfunction.\n\nDependencies:\n\n- lodash/fp (Many hooks use this)\n- bcryptjs (can remove see `optionalHashPassword` below)\n- deep-assign (defaults)\n- string (slugify)\n- feathers-errors (setUserField)\n- feathers-hooks (removeSensitiveFields)\n\nInstall: `npm install --save fixate-feathers-hooks`\n\nInclude:\n`const defaults = require('fixate-feathers-hooks/defaults')` or\n`const { defaults } = require('fixate-feathers-hooks');`\n\n## Hooks\n\n### defaults\n\nSpecify default query params or results. You can also use a function which\nreturns a calculated default.\n\n```javascript\ndefaults({ q: 'foo', complex(hook) { return hook.params.anotherField } }, { deep: true })(hook);\n// (before hook) params = { q: 'bar', anotherField: 'test123' } then params.query will have { q:'bar', complex: 'test123' }\n```\n\n### optionalHashPassword\n\nWorkaround for issue. Copy of feathers-authentication's `hashPassword` hook, but we can use this in\nupdates and patches because it doesn't try and hash a falsey password.\nTODO: remove; fixed in [PR#287](https://github.com/feathersjs/feathers-authentication/pull/287)\n\n### permitFields\n\nSelect fields in `data` (before hook) or `result` (after hook) to allow through using dot notation\n(lodash get). Handles deeply nested objects too.\n\n```javascript\npermitFields('public.object', 'private.item.name')(hook);\n```\n\n### removeSensitiveFields\n\nConfigure fields which should be removed from api responses.\nConfigure `sensitiveFields` in your `default.json` (uses `app.get` and `feathers-hooks.remove` hook).\n\n`\u003e= 1.0.4` - Will throw an error if you use this hook without a configuration for the \"model\". This is to prevent typos causing data to leak.\n\n```javascript\nremoveSensitiveFields('user')(hook);\n\n// default.json\n...\n\"sensitiveFields\": {\n  \"user\": [\"password\", \"forgottenPasswordToken\", ...],\n  \"creditCard\": [\"cvv\"],\n}\n```\n\n### requiredParams\n\nSpecify and validate required params - if params are missing throw an error (`BadRequest by default`)\n\n```javascript\nrequiredParams('firstName', 'lastName', 'email', { Error: new Error('My custom error') })(hook);\n```\n\n### scopeQueryTo\n\nWill ensure that `hook.params.query` has the specified values.\n\n```javascript\nscopeQueryTo({ status: 'active' })(hook);\n\n// with function\nconst scopeToOwner = scopeQueryTo(hook =\u003e ({ user: hook.user._id }));\nexports.before = {\n  find: scopeToOwner,\n  get: scopeToOwner,\n  update: scopeToOwner,\n  patch: scopeToOwner,\n  remove: scopeToOwner,\n};\n```\n\n### setUserField\n\nSets the `data` object to a field contained in `hooks.user` object.\nIf `overwrite` is `false`, then only set if data value is empty\n(probably want to be careful of doing that).\n\n```javascript\n// with default options (except field which is required)\nsetUserField({ field: 'user', userField: '_id', overwrite: true })(hook);\n```\n\n### Slugify\n\nSlugifies fields in object and sets the result to another field.\n\n```javascript\nslugify('mySlug', 'firstName'/*, overwrite = false*/);\n// Or\nslugify('mySlug', ['firstName', 'lastName']/*, overwrite = false*/);\n```\n\n\n### timestamps\n\nSets the current timestamp\n\n```javascript\n// true = Overwrites\nconst updatedAt = timestamp('updatedAt', true);\n// Does not overwrite - note: if your database defaults to now you won't need this :)\nconst createdAt = timestamp('createdAt');\nexport.before = {\n  create: createdAt,\n  update: updatedAt,\n  patch: updatedAt,\n}\n```\n\n### validateUnique\n\nCalls your `options.userService` service to check if `options.field` already exists. If not, it\nwill `BadRequest`, otherwise it'll let the request continue. Asynchronous, returns promise.\nUseful for protecting against mongoose duplicate key errors and returning a useful error.\n\n```javascript\n// with defaults\nvalidateUnique({ field: 'username', userService: '/users' })(hook);\n```\n\n## TODO\n\n* Tests\n* Remove optionalHashPassword\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixate%2Ffixate-feathers-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffixate%2Ffixate-feathers-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixate%2Ffixate-feathers-hooks/lists"}