GithubHelp home page GithubHelp logo

fdw-spicedb-poc's Introduction

One Purpose SpiceDB Plugin for Steampipe

Imagine you have workspaces, permissions, and users in your system, and you decide to use SpiceDB as the underlying authorization system to control access to those resources. However, you prefer the SQL language. What can we do with this?

We can utilize Foreign Data Wrapper in PostgreSQL! It's not necessary to start from scratch with implementing an FDW extension, as we can use Steampipe.

This plugin leverages the spicedb schema from another POC.

Let's pose an authorization question:

Which workspaces have granted the 'inventory_all_read' permission to user 'userlarge'?

I can ask with zed command this way:

zed permission lookup-resources workspace inventory_all_read user:userlarge

But with SQL and using this Steampipe plugin, I can query this way:

SELECT name FROM workspaces 
WHERE user_name='userlarge' AND permission='inventory_all_read'

How to use this plugin ?

First, learn about Steampipe and install it from Steampipe

Prerequisite

You need to have SpiceDB installed and update the SpiceDB configuration in ./fdw-spicedb-poc/utils.go I use mentioned [POC](https://github.com/merlante/inventory_access_poc/ for these reasons.

You also need to generate some relations; you can use the script gen_relations.sh:

For example - This generates 60000 workspaces for user60000 with permission inventory_all_read:

./gen_relations.sh 60000 user60000

Then, install Go, and follow these steps:

$ git clone https://github.com/lpichler/fdw-spicedb-poc.git

$ cp ./config/fdw-spicedb-poc.spc ~/.steampipe/config

$ make

$ steampipe query

> SELECT name FROM workspaces WHERE user_name='userlarge' AND permission='inventory_all_read'

fdw-spicedb-poc's People

Contributors

lpichler avatar

Watchers

 avatar

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.