Giter VIP home page Giter VIP logo

sentium's Introduction

πŸ” Sentium

license codecov discussions release

Lightning fast, global scale authorization service without the overhead of yet another DSL1.

What is Sentium?

Sentium is an authorization service for securing your applications and services using zero trust2 fine-grained authorization (FGA).

We designed Sentium to be as powerful and scalable as Zanzibar β€” Google’s Consistent, Global Authorization System yet simple enough to start using without the overhead of having to learn a new DSL to define authorization models or policies.

Why Sentium?

There are other open-source (and commercial) authorization services, some are inspired by Google Zanzibar while others tend to offer policy-as-code solutions. But almost all of these solutions require learning a new DSL to create authorization models or define policies, which adds unnecessary complexities.

Using an authorization service shouldn't come with a requirement to be an expert in building and maintaining authorization models or policies. It should be as easy as using an API.

Sentium lean on well known API design principals to provide an authorization service that's easy to integrate, quick to master and flexible enough to handle complex requirements.

Features

  • Schema-less fine-grained authorization (FGA)
  • Zero-trust, least privilege architecture (ZTA)
  • Predictable constant time authorization checks (O(1))
  • Strongly consistent with no cache
  • Cloud native at global scale3
  • ABAC, RBAC & ReBAC4
  • Multi-tenancy support, if you need it
  • Not just authorization checks, list users, entities a user can access and users with access to an entity
  • First class treatment for listing endpoints with pagination and limits to handle large datasets
  • Built using the fastest gRPC server implementation5

Getting started

Prerequisites

Compiling

❯ cmake -B .build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DPostgreSQL_ADDITIONAL_VERSIONS=16 \
  -DSENTIUM_ENABLE_COVERAGE=OFF
❯ cmake --build .build --target sentium

Setting-up

❯ psql --dbname=postgres
psql (16.1)
Type "help" for help.

postgres=# create user sentium;
CREATE ROLE
postgres=# create database sentium owner sentium;
CREATE DATABASE
❯ psql --username=sentium --dbname=sentium < db/schema.sql

Running

❯ PGDATABASE=sentium PGUSER=sentium ./.build/bin/sentium
Listening on [127.0.0.1:8080] ...

Usage

Creating a user

❯ grpcurl \
  -import-path proto \
  -import-path ./.build/_deps/googleapis-src \
  -proto proto/sentium/api/v1/principals.proto \
  -plaintext \
  localhost:8080 sentium.api.v1.Principals/Create

{
  "id": "cn7qtdu56a1cqrj8kur0"
}

Granting access

❯ grpcurl \
  -import-path proto \
  -import-path ./.build/_deps/googleapis-src \
  -proto proto/sentium/api/v1/authz.proto \
  -plaintext \
  -d '{
    "principal_id": "cn7qtdu56a1cqrj8kur0",
    "entity_type": "documents",
    "entity_id": "65bd28aaa076ee8c8463cff8"
  }' \
  localhost:8080 sentium.api.v1.Authz/Grant

{}

Checking access

❯ grpcurl \
  -import-path proto \
  -import-path ./.build/_deps/googleapis-src \
  -proto proto/sentium/api/v1/authz.proto \
  -plaintext \
  -d '{
    "principal_id": "cn7qtdu56a1cqrj8kur0",
    "entity_type": "documents",
    "entity_id": "65bd28aaa076ee8c8463cff8"
  }' \
  localhost:8080 sentium.api.v1.Authz/Check

{
  "ok": true
}

Listing users

❯ grpcurl \
  -import-path proto \
  -import-path ./.build/_deps/googleapis-src \
  -proto proto/sentium/api/v1/principals.proto \
  -plaintext \
  localhost:8080 sentium.api.v1.Principals/List

{
  "principals": [
    {
      "id": "cn7qtim56a1cqrj8kurg"
    },
    {
      "id": "cn7qtdu56a1cqrj8kur0"
    }
  ]
}

Listing entities a user can access

❯ grpcurl \
  -import-path proto \
  -import-path ./.build/_deps/googleapis-src \
  -proto proto/sentium/api/v1/entities.proto \
  -plaintext \
  -d '{
    "principal_id": "cn7qtdu56a1cqrj8kur0",
    "entity_type": "documents"
  }' \
  localhost:8080 sentium.api.v1.Entities/List

{
  "entities": [
    {
      "id": "65bd28aaa076ee8c8463cff8",
      "type": "documents"
    }
  ]
}

Listing users that has access to an entity

❯ grpcurl \
  -import-path proto \
  -import-path ./.build/_deps/googleapis-src \
  -proto proto/sentium/api/v1/entities.proto \
  -plaintext \
  -d '{
    "entity_type": "documents",
    "entity_id": "65bd28aaa076ee8c8463cff8"
  }' \
  localhost:8080 sentium.api.v1.Entities/ListPrincipals

{
  "principals": [
    {
      "id": "cn7qtdu56a1cqrj8kur0"
    }
  ]
}

Built with

  • fmt - For string formatting.
  • googleapis - For annotations to help with gRPC/JSON transcoding.
  • googletest - For tests.
  • grpcxx - For the gRPC server.
  • libpqxx - For PostgreSQL connections.
  • libxid - For globally unique IDs.

Acknowledgments

Footnotes

  1. Domain-Specific Language ↩

  2. Zero trust architecture (ZTA) ↩

  3. Scalability depends on underlying PostgreSQL protocol compatible database scalability. ↩

  4. RFC #72 ↩

  5. gRPCxx is benchmarked to be the fastest in February 2024. ↩

sentium's People

Contributors

dependabot[bot] avatar kw510 avatar neculalaura avatar pr301 avatar td0m avatar uatuko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sentium's Issues

Update FileShare example

We started on the FileShare example in #67 but it's incomplete and needs updating.

1. Missing features

1.1 Must have

  • UX flow to add a new user. Currently this is possible by manually navigating to /sign-up route but should integrate into the listing users UI.
  • UX flow to share files with other users.
  • Serve static HTML/JS from Go.
  • Documentation.

1.2 Should have

  • Make the Go server configurable (e.g. listing IP/port, Sentium endpoint).
  • Update run make target to generate static HTML/JS before running the Go server.
  • Update GitHub Workflows to run tests (and maybe track code coverage?).

Graceful shutdown

To ensure data consistency we need to intercept terminations signals and finish serving any in-flight requests and close connections to the DB before shutting down. This is very likely to require changes to gRPCxx.

Requirements

  1. Intercept termination signals (SIGTERM, SIGINT, SIGQUIT) and;
    1. Stop accepting any further incoming requests after the termination signal
    2. Finish serving any in-flight requests
    3. Close DB connection
    4. Shutdown gracefully

Verbose mode

Currently, there's only one "info" level log during startup and error logs. This is OK for hosted environments where requests logs can be acquired by other means (e.g. proxy, LB) but it makes it difficult to have visibility into requests and other metrics when running locally.

Requirements

  1. Add a verbose command-line arg to enable verbose mode.
  2. If in verbose mode, log request/response info (something similar to apache access logs but very basic).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.