Gathering detailed insights and metrics for exegesis-plugin-roles
Gathering detailed insights and metrics for exegesis-plugin-roles
Gathering detailed insights and metrics for exegesis-plugin-roles
Gathering detailed insights and metrics for exegesis-plugin-roles
npm install exegesis-plugin-roles
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2 Stars
131 Commits
3 Watching
30 Branches
2 Contributors
Updated on 19 Sept 2022
TypeScript (92.84%)
JavaScript (7.16%)
Cumulative downloads
Total Downloads
Last day
-48.1%
14
Compared to previous day
Last week
-24%
76
Compared to previous week
Last month
57.8%
322
Compared to previous month
Last year
94.9%
3,251
Compared to previous year
3
Adds support for the "x-exegesis-roles" vendor extension, which adds support for restricting which operations are available to which users after they have been authenticated. Authenticators can optionally return "roles" for a user. "x-exegesis-roles" can be specified either as an array of "role" strings, or as an array of such arrays.
For example:
1x-exegesis-roles: 2 - a 3 - b
would only allow access to an operation if a user has both the 'a' and 'b' role, or:
1x-exegesis-roles: 2 - [a] 3 - [b, c]
would only allow access to an operation if a user has the 'a' role, or has both the 'b' and 'c' role.
"x-exegesis-roles" can be defined on the root OpenAPI object, in which case all operations in the document will require those roles. This can be overridden by specifying "x-exegesis-roles" in an individual operation. An empty array indicates a user requires no roles:
1x-exegesis-roles: []
If "x-exegesis-roles" is defined on an operation which has no security requirements defined, this will throw an error.
Roles do not apply to security schemes with the "oauth2" type; scopes apply there instead.
Allowed in:
1npm install exegesis-plugin-roles
Add this to your Exegesis options:
1import exegesisRolesPlugin from 'exegesis-plugin-roles'; 2 3options = { 4 plugins: [ 5 exegesisRolesPlugin({ 6 // List of all allowed roles. If you try to use any roles that 7 // aren't in this list in your document, an error will be thrown. 8 allowedRoles: ['user', 'admin', 'ops'] 9 }) 10 ] 11};
In your OpenAPI 3.x document:
1paths: 2 '/kittens': 3 get: 4 description: Get a list of kittens 5 security: 6 - basicAuth: [] 7 - oauth: ['readOnly'] 8 post: 9 description: Add a new kitten 10 security: 11 - basicAuth: [] 12 - oauth: ['readWrite'] 13 x-exegesis-roles: ['admin'] # Only users with the "admin" role may call this.
The "get" operation can only be executed if the request matches one of the two listed security requirements. The "post" operation can only be executed if the security requirements are matched, and the current "user" has the "admin" role.
Copyright 2018 Jason Walton
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
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
Score
Last Scanned on 2024-11-25
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