dolevf / Open-Policy-Agent-Alfred

Reasonably Usable Self-hosted Version of OPA's Playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alfred

Table of Contents

OPA Alfred

Reasonably usable self-hosted version of OPA's Playground

About

Ever wanted to have your own version of OPA's Playground? now it's possible with a reasonably usable version of the original Playground, called Alfred!

Features

  • Syntax Highlighting
  • Policy Publishing
  • Coverage Highlighting
  • Data / Input / Policy Editor
  • Restrict Execution of Builtins, such as: http.send or opa.runtime
  • Download Policy as File / Copy to Clipboard

Screenshot

Alfred

Configuration

There is not a whole lot of configurations required for Alfred. If you want to restrict certain builtins from running in policies, you can do so in config.py:

RESTRICTED_BUILTINS = [
    'http.send',
    'opa.runtime'
]

By default, all builtins are allowed.

How to Install

Clone repository

git clone https://github.com/dolevf/Open-Policy-Agent-Alfred

cd Open-Policy-Agent-Alfred

Docker

Build Docker Image

docker build -t alfred .

Run Alfred Container

docker run -d -p 5000:5000 alfred

Docker Registry

Pull Alfred from Registry

docker pull dolevf/alfred

Run Alfred Container

docker run -d -p 5000:5000 dolevf/alfred

Server

Install requirements

pip3 install -r requirements.txt

Download OPA binary

For Linux:

curl -L -o bin/opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64_static

For MacOSX:

curl -L -o bin/opa https://openpolicyagent.org/downloads/latest/opa_darwin_amd64

Set permissions

chmod u+x bin/opa

Run Alfred

python3 alfred.py

Open Alfred

http://localhost:5000

Maintainers

  • Dolev Farhi

License

It is distributed under the MIT License. See LICENSE for more information.

About

Reasonably Usable Self-hosted Version of OPA's Playground

License:MIT License


Languages

Language:CSS 91.8%Language:HTML 4.6%Language:Python 3.2%Language:Dockerfile 0.3%Language:JavaScript 0.1%