Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@cerbos/http

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerbos/http

Client library for interacting with the Cerbos policy decision point service over HTTP from browser-based applications

Source
npmnpm
Version
0.23.0
Version published
Maintainers
3
Created
Source

@cerbos/http

npm

Client library for interacting with the Cerbos policy decision point service over HTTP.

This is primarily intended for use in browsers, and requires fetch to be available globally. If you're targeting old browsers, you'll need to apply a polyfill.

You can use it in server-side Node.js applications, but the gRPC client might be more appropriate.

Prerequisites

  • Cerbos 0.16+
  • Node.js 20+
  • fetch

Installation

$ npm install @cerbos/http

Example usage

import { HTTP } from "@cerbos/http";

const cerbos = new HTTP("http://localhost:3592");

await cerbos.isAllowed({
  principal: {
    id: "user@example.com",
    roles: ["USER"],
    attr: { tier: "PREMIUM" },
  },
  resource: {
    kind: "document",
    id: "1",
    attr: { owner: "user@example.com" },
  },
  action: "view",
}); // => true

For more details, see the HTTP class documentation.

Further reading

Get help

Keywords

Cerbos

FAQs

Package last updated on 11 Aug 2025

Did you know?

Socket

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.

Install

Related posts