@jspolicy/example-policies
v0.0.2
Published
A simple project that shows how to use typescript with jspolicy
Downloads
1
Readme
Example Policies for jsPolicy
The goal for this project is to provide a simple boilerplate to create custom js policies as npm packages that can be reused by other polices.
Compile
You can compile the policies via:
# Install dependencies
npm install
# Package the policies
npm run compile
Example Use Case
Use the policies in a webhook directly:
apiVersion: policy.jspolicy.com/v1beta1
kind: JsPolicy
metadata:
name: "pod-policy.example.com"
spec:
operations: ["CREATE"]
resources: ["pods"]
dependencies:
"@jspolicy/example-policies": "^0.0.1"
javascript: |
import {denyPodAddCapabilities} from '@jspolicy/example-policies';
// Call the example policy that denies pods that try to add capabilities
denyPodAddCapabilities(request, deny);