GithubHelp home page GithubHelp logo

hexa-org / policy-mapper Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 989 KB

Policy Mapper defines packages for use in mapping of Identity Policy between Hexa IDQL and other formats.

License: Apache License 2.0

Go 99.21% Shell 0.15% Open Policy Agent 0.65%
aws bind cedar cel gcp hexa idql

policy-mapper's Introduction

Hexa

Hexa Policy Mapper Project

The Hexa Policy-Mapper Project provides administrative tools and development libraries for provisioning and mapping various policy systems into a common policy format known as IDQL. With Policy Mapper and IDQL, you can manage all your access policies consistently across software providers and cloud systems. The project includes a number of prebuilt integrations (we call them providers) as well as guidance on how to build your own providers.

This project provides:

  • a GoLang SDK which can be used in open source and commercial implementations to leverage this community library.
  • a Hexa CLI command line tool which can be used to provision policies to web accessible policy systems.
  • a GoLang interface (policyprovider.Provider) enabling the development of new policy provisioning providers.

Tip

Policy-Orchestrator is available as a sample web server implementation that uses Policy-Mapper.

Note

This project is currently under initial development and documentation may be out of date.

Supported Provider Integrations

Policy Mapper supports the following capabilities:

Syntactical Mapping : Policy formats that have a parsable format or language, and can be represented in a "tuple" (subject, action, resource, conditions, scope) are considered "syntactical". Policy-Mapper can map these formats to and from IDQL JSON format. Examples include: IDQL, Cedar, GCP Bind among others.

RBAC API Mapping : Some systems do not directly have a policy language but support role or group based access control settings through an API.

Policy Provisioning : Policy Mapper combines a set of Providers that call APIs to retrieve and map access policy as well as be able to set policy.

Syntactical Mapping support is provided for:

  • Google Bind Policy and Google Conditional Expression Language (CEL)
  • AWS Verified Permissions and Cedar policy language including support for CEL

Provisioning support is provided for:

Getting Started

Installation

Install go 1.21, clone and build the project as follows:

git clone https://github.com/hexa-org/policy-mapper.git

cd policy-mapper

sh ./build.sh

Hexa CLI Tool

To test the Hexa SDK and or develop using scripts, use the Hexa CLI tool.

To run the Hexa CLI, simply type hexa at the command line once installed.

Note

Hexa CLI currently does not support filenames with spaces. Valid example: add gcp --file=my_key.json

Hexa Developer Documentation

To start using the Hexa Mapper SDK in your GoLang project, perform the following get command:

go get github.com/hexa-org/policy-mapper

For more details on how to map or provision policy in either console (shell) form or GoLang, see: Developer documentation.

Provider Documentation

Each provider in the providers directory structure has its own README.md that describes the provider and its capabilities and limitations.

Provider Folder Description Type Support
AWS AVP providers/aws/avpProvider Mapping to/from Cedar Policy language with Get/Set/Reconcile using AVP API Syntactic Map SDK,Console
AWS API Gateway providers/aws/awsapigwProvider Support for the Amazon API Gateway (experimental) RBAC SDK,Console
AWS Cognito providers/aws/cognitoProvider Virtual policy support using Cognito Userpools and Groups RBAC SDK,Console
Azure Provider providers/azure/azureProvider Support for Azure Application Role Policy RBAC SDK,Console
Google Cloud IAP Provider providers/googlecloud/iapProvider Mapping to/from Google Bind policy and IAP support for Google App Engine and GKE Syntactic Map SDK,Console
Open Policy Agent providers/openpolicyagent Integrates with Hexa Policy-OPA and interprets IDQL directly with conditions clause support IDQL Interpreter SDK,Console

policy-mapper's People

Contributors

barinek avatar ggebel avatar independentid avatar saurabh-io avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

policy-mapper's Issues

Enhance Cedar mapper to support when true

For some reason, the default policy generated by AVP often includes a when { true }; clause

permit(
  principal,
  action in [hexa_avp::Action::"ReadAccount",hexa_avp::Action::"Transfer",hexa_avp::Action::"Deposit",hexa_avp::Action::"Withdrawl"],
  resource
) when {
  true
};

The above when clause should be converted or just ignored.

Add Export Integration Function to Hexa CLI

The export function enables an administrator to export an existing integration to a json file that can be used by the web admin of Policy-Orchestrator

In particular Hexa CLI can be used to create itnegration files by doing the following:

hexa add opa http mybundle --cacert=ca-cert.pem --url=https://mybundlerserver:8889/
hexa export mybundle mybundleserver.json

Migrate DemoConfig to Policy-Mapper

The orchestrator "democonfig" service is an implementation of a bundle server that can be used for testing.

This would be moved over to the "examples" directory of policy-mapper to let evaluators set up and run a bundle server and OPA server.

Switch to Cedar Parser

Currently Cedar where clause expression parsing is using Google CEL (because they are almost the same). In the dependencies update, the CEL parser is now failing to parse Cedar where clauses (see Hexa cli test suite).

Now that Cedar is published, it is time to switch to the Cedar libraries

SDK: Complete Provider Support of WithHttpClient Option

Occasionally for testing purposes and other integration work there is the need to initialize a custom HTTP Client when calling cloud APIs. For example, the custom client can mock the remote server and its responses.

This is currently implemented inside many of Hexa Providers but is not yet exposed through the SDK interface.

OPA Provider - Support for OAuth2 Client Credential flow for access to HTTP Bundle Servers

Currently the OPA HTTP Provider accepts a fixed authorization which can be a token for authorization with the HexaBundleServer.

The Policy-OPA AuthZen Server takes a certificate PEM to validate tokens provided.

This functionality would allow the provider client to authenticate to an OAuth2 server using the client credentials flow to receive a rotating token for access.

Note: #47 will allow this to be done outside the provider because an http.Client could be configured in the provider which handles token use and refreshing automatically. This enhancement means that each integration can have it's own client credential and OAuth2 server making it possible to connect to multiple provisioning domains while at the same time simplifying configuration inside of Policy-Orchestrator and Hexa CLI

Add Support for IDQL Scopes

This adds support for Scopes which are obligations returned to a PEP. For example a SQL Filter, or IDQL Filter, or a set of attributes or columns allowed to be returned.

Use cases:

  • SQL Servers (filters expressed as WHERE clauses)
  • SCIM (use IDQL Filter expressions)
  • LDAP (can convert IDQL filter to LDAP filter)

OPA Provider HTTP Bundle Has Wrong Structure

The OPA Provider Get Policies function is expecting OPA Bundle server to respond with a file structure of
/bundle/

Instead the current testBundleServer is returning
/default/bundle/

This causes an unexpected file not found error

Remove ProjectId from OpaProvider

Unlike projectid in AWS providers or GCP provider, projectid is never actually used. Instead the platform project is wrapped up in the bundle url and the access token.

This is important to simplify and avoid confusion.

Fix Slice error in Options

When no credential is required (and thus not supplied), the hexa cli will panic building WithHttpOptions

Fix random test failures in hexa_policy_test.go

Issues with using pass by reference was causing occasional failures.

A for loop in hexa_policy was not resetting the reference but allowed random passes. By forcing direct use of objects, the reference problem is blocked.

Breaking change:
PolicyDif struct -> PolicyExist attribute is no longer passed by reference.

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.