npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

serviceopa

v0.0.17

Published

simplified interface to Open Policy Agent

Downloads

22

Readme

Open Policy Agent - OPA - Step By Step

A quoi cela sert ?

"Qui peut faire quoi avec un microservice ? "tel est la question de base au moment de la mise en oeuvre d'un microservice.

Si votre microservice est destiné a être utilisé par une application ou une interface externe à votre Cloud, il sera indispensable de véréfier systématique que le demandeur de l'API a bien les droits pour faire l'opération sur le service. En plus il peut etre utile de s'assurer que le demandeur n'accéder qu'a une partie des informations gérées et délivrées par l'API de votre service.

OPA (Open Policy Agent) est un service open source hébergé par le CNCF qui permet :

  • de definir des régles définissant de droits
  • de construire un contexte de vérification (les données )
  • d'évaluer si un lot de données ouvre droit à une opération

Comment cela marche ?

OPA se présente sous la forme d'un éxécutable (ou d'une librairie GO) qui est lancée en mode server . Le serveur fonctionne avec un fichier de régles .rego et un fichier de context .json . Ces données q-peuvent etre chargées au lancement de l'application (en mode server ou en mode container) ou ajoutée / rafraichiés par un HTTP PUT + body JSON.

  1. L'application appel le PEP (policy Enforcment Point) server en mode APIRest pour demande à verifier un ensemble de données dans un body JSON
  2. le server OPA analyse les données et les valide en fonction d'un fichier de régles décrites dans le langage rego ET(eventuelement) de données locales qui servent de contexte.

Quick start

  • Run OPA en mode server HTTP:
# Check the latest OPA release and download it.
# On macOS (64-bit):
curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/v0.10.2/opa_darwin_amd64
# extraire le fichier binaire dans le chemin de votre systeme (ou ajouter au $PATH)
# Rendre exécutable
chmod 755 ./opa
# Run opa en mode interactif pour tester
opa run
# Run en mode server
opa run -s -w rules
# -s is to run it in server mode instead of opening the REPL -> un fichier ou tous les fichiers d'un dossier
# -w is for watching the changes of the data/policy files
# rules : directory where .rego and .json files are located

Mise en place

  1. Ajout du module Open Policy Agent à VSCODE pour tester les régles.
  2. creation d'un dossier serviceOPA
  3. creation d'un dossie de régles rego
  4. creation d'un fichier de regles

3 mini tuto pour démarrer

  1. Régles à verifier : l'utilisateur X est il référencé ?
  2. L'utilisateur X a t'il le droit d'executer la méthode GET

Busines Case

Mise en place

Developpement

Questions

  • comment synchroniser la base de contexte avec un référentiel

Ressources

  • policy Enforcment point standard : https://tools.ietf.org/html/rfc2904#section-4.4