Gathering detailed insights and metrics for objection-visibility
Gathering detailed insights and metrics for objection-visibility
Gathering detailed insights and metrics for objection-visibility
Gathering detailed insights and metrics for objection-visibility
Objectionjs plugin to whitelist/blacklist model properties
npm install objection-visibility
Typescript
Module System
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
45 Stars
83 Commits
9 Forks
1 Watchers
8 Branches
4 Contributors
Updated on Oct 07, 2023
Latest Version
1.2.0
Package Id
objection-visibility@1.2.0
Unpacked Size
15.75 kB
Size
5.70 kB
File Count
19
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This plugin adds the ability to whitelist or blacklists model properties.
1npm install objection-visibility
You can enable this plugin by either setting the static property hidden
or visible
to your model.
It is possible to have a model which have both properties defined, note that the visible
method is called first and the hidden
method second.
To enable blacklisting on your model add the static property hidden
on your model and return an array with the fields you want to blacklist.
The listed fields are gone after being serialized to json
1const Model = require('objection').Model 2const visibilityPlugin = require('objection-visibility').default; 3 4class User extends visibilityPlugin(Model) { 5 static get hidden() { 6 return ['hashed_password']; 7 } 8} 9
To enable whitelisting on your model add a static property visible
on your model and return an array with the fields you want to be whitelisted
The listed fields will be the only properties available after being serialized to json
1const Model = require('objection').Model 2const visibilityPlugin = require('objection-visibility').default; 3 4class User extends visibilityPlugin(Model) { 5 static get visible() { 6 return ['firstName', 'id'] 7 } 8}
Can be used on a base model and have it readily available on all your models
Models that dont have the static properties visible
or hidden
will remain untouched.
1 2 // base.js 3 class BaseModel extends visibilityPlugin(Model) {} 4 5 // post.js 6 class Post extends BaseModel { 7 static get visible () { 8 return ['description', 'title'] 9 } 10 } 11 12 // user.js 13 class User extends BaseModel { 14 static get hidden () { 15 return ['hashedPassword'] 16 } 17 }
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More