All Projects → anderseknert → pre-commit-opa

anderseknert / pre-commit-opa

Licence: Apache-2.0 license
Pre-commit git hooks for Open Policy Agent (OPA) and Rego development

Projects that are alternatives of or similar to pre-commit-opa

opa-kafka-plugin
Open Policy Agent (OPA) plug-in for Kafka authorization
Stars: ✭ 46 (-13.21%)
Mutual labels:  opa, openpolicyagent, rego
conftest-action
A GitHub Action for using Conftest
Stars: ✭ 30 (-43.4%)
Mutual labels:  openpolicyagent, conftest
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+643.4%)
Mutual labels:  pre-commit, git-hooks
k8s-opa-boilerplate
Boilerplate example of managing OPA with kustomize
Stars: ✭ 14 (-73.58%)
Mutual labels:  opa, rego
Conftest
Write tests against structured configuration data using the Open Policy Agent Rego query language
Stars: ✭ 2,047 (+3762.26%)
Mutual labels:  openpolicyagent, rego
postee
Simple message routing system that receives input messages through a webhook interface and can enforce actions using predefined outputs via integrations.
Stars: ✭ 160 (+201.89%)
Mutual labels:  opa, rego
prancer-compliance-test
This repository includes cloud security policies for IaC and live resources.
Stars: ✭ 32 (-39.62%)
Mutual labels:  opa, rego
pre-commit-hooks-safety
A pre-commit hook to check your Python dependencies against safety-db
Stars: ✭ 69 (+30.19%)
Mutual labels:  pre-commit, git-hooks
awesome-opa
A curated list of OPA related tools, frameworks and articles
Stars: ✭ 316 (+496.23%)
Mutual labels:  opa, openpolicyagent
pre-commit-hooks
git pre-commit hooks
Stars: ✭ 71 (+33.96%)
Mutual labels:  pre-commit, git-hooks
ccheck
A command line tool for validating Kubernetes configs with rego
Stars: ✭ 63 (+18.87%)
Mutual labels:  opa, rego
opa-spring-security
Open Policy Agent for Spring Security
Stars: ✭ 19 (-64.15%)
Mutual labels:  opa, openpolicyagent
detect-secrets
A developer-friendly secrets detection tool for CI and pre-commit hooks based on Yelp's detect-secrets
Stars: ✭ 43 (-18.87%)
Mutual labels:  pre-commit, git-hooks
opa-java-client
No description or website provided.
Stars: ✭ 25 (-52.83%)
Mutual labels:  opa, openpolicyagent
k8s-security-policies
This repository provides a security policies library that is used for securing Kubernetes clusters configurations. The security policies are created based on CIS Kubernetes benchmark and rules defined in Kubesec.io.
Stars: ✭ 160 (+201.89%)
Mutual labels:  conftest
commithelper
A tool to create and lint commit messages
Stars: ✭ 35 (-33.96%)
Mutual labels:  git-hooks
captain-git-hook
✅ define git hooks as scripts in your package.json
Stars: ✭ 25 (-52.83%)
Mutual labels:  git-hooks
dotnet-opa-wasm
Call Open Policy Agent (OPA) policies in WASM (Web Assembly) from .NET Core
Stars: ✭ 36 (-32.08%)
Mutual labels:  opa
blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-24.53%)
Mutual labels:  pre-commit
ready
A program to run tasks before a commit.
Stars: ✭ 16 (-69.81%)
Mutual labels:  pre-commit

pre-commit-opa

Python application

Pre-commit git hooks for Open Policy Agent (OPA) and Rego development

Using pre-commit-opa with pre-commit

Add the pre-commit-opa repo to the .pre-commit-config.yaml file in your git root directory, and add any number of the available hooks:

repos:
- repo: https://github.com/anderseknert/pre-commit-opa
  rev: v1.4.1
  hooks:
  - id: opa-fmt
  - id: opa-check
  - id: opa-test
  - id: conftest-test
  - id: conftest-verify

Once saved, run pre-commit install to install git pre-commit hooks.

Hooks available

opa-fmt

Runs opa fmt on any rego files in the repository.

Note that any files changed by this hook will need to be re-added (git add) to be included in the commit.

opa-check

Runs opa check on any rego files in the repository.

opa-test

If rego files are present in commit, runs opa test in git root directory.

Since it doesn't make sense to only provide opa test with the files changed (as these might not include tests), the default is to run opa test . in the project root directory. If you keep your policies, tests and data in a specific directory, you'll likely want to change this by pointing out the location of that, like:

- id: opa-test
  args: ['my/policies', 'my/other/policies/']

conftest-fmt

Runs conftest fmt on any Rego files in the repository.

Note that any files changed by this hook will need to be re-added (git add) to be included in the commit.

conftest-test

Runs conftest test on any configuration file format supported by conftest.

Just like with opa-test you'll likely want to specify the location of your conftest policies, and possibly what type of files changed should trigger the hook:

- id: conftest-test
  args: ['--policy', 'conftest/policy']
  files: conftest/.*\.yaml$

conftest-verify

If rego files are present in commit, runs conftest verify in git root directory.

Just like with conftest-test you'll likely want to specify the location of your conftest policies, and possibly what type of files changed should trigger the hook:

- id: conftest-verify
  args: ['--policy', 'conftest/policy']
  files: conftest/.*\.yaml$
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].