Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Cerbos helps you super-charge your authorization implementation by writing context-aware access control policies for your application resources.
Cerbos helps you super-charge your authorization implementation by writing context-aware access control policies for your application resources. Author access rules using an intuitive YAML configuration language, use your Git-ops infrastructure to test and deploy them and, make simple API requests to the Cerbos PDP to evaluate the policies and make dynamic access decisions.
The Cerbos JavaScript client library - sometimes known as an SDK - makes it easy to interact with the Cerbos PDP from your server-side JavaScript applications.
To use the Cerbos JavaScript client library, you'll need:
Note: You can only use the library in server-side JavaScript applications developed in Node.js. It won't work in frontend applications that run in your users' browsers.
$ npm i cerbos
or
$ yarn add cerbos
import { Cerbos } from "cerbos";
const cerbos = new Cerbos({
hostname: "http://localhost:9090", // The Cerbos PDP instance
});
const result = await cerbos.check({
actions: ["view", "edit"],
resource: {
policyVersion: "default", // optional
kind: "blogPost", // the name of the resource kind in the policies
instances: {
// Map of instances of resource where the key is the ID
article123: {
// optional user-defined attributes used in policies
attr: {
authorId: "212324",
status: "DRAFT",
},
},
article456: {
// optional user-defined attributes used in policies
attr: {
authorId: "56756",
status: "PUBLISHED",
},
},
},
},
principal: {
id: "userId1", // the ID of the principal accessing the resource
policyVersion: "default", // optional
roles: ["USER"], // from your authentication provider
// optional user-defined attributes used in policies
attr: {
department: "marketing",
},
},
});
// Check whether the principal can view article123
const canView = result.isAuthorized("article123", "view"); // boolean
// Check whether the principal can edit article456
const canEdit = result.isAuthorized("article456", "edit"); // boolean
The Cerbos JavaScript client library is written in TypeScript and comes with types.
A number of configuration options are avaliable when creating the Cerbos SDK instance:
The hostname to the Cerbos PDP instance must be defined when creating the Cerbos instance.
It is possible to define a timeout value for all calls to the Cerbos instance. This is defined in milliseconds.
You can turn on debug logging if you want to check what endpoints are being called and with what arguments.
const cerbos = new Cerbos({
hostname: "http://localhost:9090", // The Cerbos PDP instance
logLevel: "debug",
timeout: 5000, // timeout in ms
});
You can learn more about the Cerbos in our documentation.
FAQs
The cerbos binary
We found that cerbos demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.