API Reference

Reference of all available HTTP endpoints provided by the Policy Reporter UI.

Core APIs

Push API

MethodAPIDescriptionCodes
POST/api/pushReceive a single PolicyReport result and store it in memory.200, 500

Example

curl -X POST -H "Content-type: application/json" -d '{"Message":"validation error: Running as root is not allowed. The fields spec.securityContext.runAsNonRoot, spec.containers[*].securityContext.runAsNonRoot, and spec.initContainers[*].securityContext.runAsNonRoot must be `true`. Rule check-containers[0] failed at path /spec/securityContext/runAsNonRoot/. Rule check-containers[1] failed at path /spec/containers/0/securityContext/.","Policy":"require-run-as-non-root","Rule":"check-containers","Priority":"warning","Status":"fail","Category":"Pod Security Standards (Restricted)","Source":"Kyverno","Scored":true,"CreationTimestamp":"2021-12-04T10:13:02Z","Resource":{"APIVersion":"v1","Kind":"Pod","Name":"nginx2","Namespace":"test","UID":"ac4d11f3-0aa8-43f0-8056-98f4eae0d956"}}' "http://localhost:8080/api/push"

Body JSON

{   "Message":"validation error: Running as root is not allowed. The fields spec.securityContext.runAsNonRoot, spec.containers[*].securityContext.runAsNonRoot, and spec.initContainers[*].securityContext.runAsNonRoot must be `true`. Rule check-containers[0] failed at path /spec/securityContext/runAsNonRoot/. Rule check-containers[1] failed at path /spec/containers/0/securityContext/.",   "Policy":"require-run-as-non-root",   "Rule":"check-containers",   "Priority":"warning",   "Status":"fail",   "Category":"Pod Security Standards (Restricted)",   "Source":"Kyverno",   "Scored":true,   "CreationTimestamp":"2021-12-04T10:13:02Z",   "Resource":{      "APIVersion":"v1",      "Kind":"Pod",      "Name":"nginx2",      "Namespace":"test",      "UID":"ac4d11f3-0aa8-43f0-8056-98f4eae0d956"   }}
  • Response 200
{}
  • Response 500
{ "message": "Error Message" }

Results API

MethodAPIDescriptionCodes
GET/api/result-logReturns the logs of received results.200, 500

Example

curl -X GET "http://localhost:8080/api/result-log"
  • Response 200
[   {      "message":"validation error: Running as root is not allowed. The fields spec.securityContext.runAsNonRoot, spec.containers[*].securityContext.runAsNonRoot, and spec.initContainers[*].securityContext.runAsNonRoot must be `true`. Rule check-containers[0] failed at path /spec/securityContext/runAsNonRoot/. Rule check-containers[1] failed at path /spec/containers/0/securityContext/.",      "policy":"require-run-as-non-root",      "rule":"check-containers",      "priority":"warning",      "status":"fail",      "category":"Pod Security Standards (Restricted)",      "scored":true,      "resource":{         "apiVersion":"v1",         "kind":"Pod",         "name":"nginx2",         "namespace":"test",         "uid":"ac4d11f3-0aa8-43f0-8056-98f4eae0d956"      },      "creationTimestamp":"2021-12-04T10:13:02Z"   }]
  • Response 500
{ "message": "Error Message" }

Config API

MethodAPIDescriptionCodes
GET/api/configReturns configured plugins and the default displayMode.200, 500

Example

curl -X GET "http://localhost:8080/api/config"
  • Response 200
{{  "views": {    "dashboard": {      "policyReports": true,      "clusterPolicyReports": true    },    "logs": true,    "policyReports": true,    "clusterPolicyReports": true,    "kyvernoPolicies": true,    "kyvernoVerifyImages": true  },  "displayMode": "",   "plugins":[      "kyverno"   ]}
  • Response 500
{ "message": "Error Message" }

Proxy APIs

Policy Reporter

MethodAPIDescription
GET/api/v1/*Proxy to the configured Policy Reporter host URL.

See Policy Reporter - API Reference for all available endpoints.

Kyverno Plugin

MethodAPIDescription
GET/api/kyverno/*Proxy to the configured Policy Reporter Kyverno plugin host URL.

See Kyverno Plugin - API Reference for all available endpoints.