{"id":44646839,"url":"https://github.com/observatorium/opa-openshift","last_synced_at":"2026-02-14T20:09:09.598Z","repository":{"id":41870051,"uuid":"383769725","full_name":"observatorium/opa-openshift","owner":"observatorium","description":"An OPA-compatible API for making OpenShift access review requests ","archived":false,"fork":false,"pushed_at":"2025-04-07T16:36:11.000Z","size":8194,"stargazers_count":4,"open_issues_count":3,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-07T17:40:35.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/observatorium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-07T11:07:05.000Z","updated_at":"2025-04-07T16:36:16.000Z","dependencies_parsed_at":"2024-06-21T18:54:25.384Z","dependency_job_id":"1d9ddac4-768e-4cd4-953c-97309e1296ff","html_url":"https://github.com/observatorium/opa-openshift","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/observatorium/opa-openshift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/observatorium%2Fopa-openshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/observatorium%2Fopa-openshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/observatorium%2Fopa-openshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/observatorium%2Fopa-openshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/observatorium","download_url":"https://codeload.github.com/observatorium/opa-openshift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/observatorium%2Fopa-openshift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29454909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-14T20:09:09.083Z","updated_at":"2026-02-14T20:09:09.591Z","avatar_url":"https://github.com/observatorium.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opa-openshift\nAn OPA-compatible API for making OpenShift access review requests.\n\n## API\n\n### POST /v1/data/{package}/{rule}\n\nThe `opa-openshift` HTTP server exposes a single endpoint of the [OPA Data API](https://www.openpolicyagent.org/docs/latest/rest-api/#data-api) and fulfills requests by translating them into [Kubernetes SubjectAccessReviews](https://docs.openshift.com/container-platform/latest/rest_api/authorization_apis/subjectaccessreview-authorization-k8s-io-v1.html). This endpoint expects an OPA [Input Document](https://www.openpolicyagent.org/docs/latest/kubernetes-primer/#input-document) in the body of the request with the following structure:\n\n```json\n{\n    \"input\": {\n        \"groups\": [\"string\"],\n        \"permission\": \"string\",\n        \"resource\": \"string\",\n        \"subject\": \"string\",\n        \"tenant\": \"string\"\n    }\n}\n```\n\nIt returns a response with the following structure:\n\n```json\n{\n    \"result\": \"boolean\"\n}\n```\n\nOptionally, if a label set matcher is set by `--opa.matcher`, it returns a response with the following structure:\n\n```json\n{\n    \"result\": {\n        \"allowed\": \"boolean\",\n        \"data\": [{\n            \"name\": \"string\", \n            \"type\": \"string\", \n            \"value\": \"string\"\n        }]\n    }\n}\n```\n\nThe `data` section represents a PromQL-style Label matcher:\n\n| Key   | Description                            |\n| ---   | :--                                    |\n| name  | The value of the `--opa.matcher` flag  |\n| type  | The value is per default `MatchRegexp` |\n| value | A comma-separated list of OpenShift projects the subject has access to. |\n\n### Design\n\nThe `opa-openshift` authorization process translates in general an [OPA Data Request V1](https://www.openpolicyagent.org/docs/latest/rest-api/#data-api) into a\n[SubjectAccessReview](https://docs.openshift.com/container-platform/latest/rest_api/authorization_apis/subjectaccessreview-authorization-k8s-io-v1.html). \n\nTo authorize the subject against a resource for a tenant, the server requires a list of tenant to api group mappings, e.g.:\n\n```shell\n./opa-openshift \\\n   --openshift-mappings=tenant-a=observatorium.openshift.io\n```\n\nAssuming an input data request, e.g.:\n```json\n{\n    \"input\": {\n        \"groups\": [\"system:authenticated\"],\n        \"permission\": \"read\",\n        \"resource\": \"resource-name\",\n        \"subject\": \"k8suser\",\n        \"tenant\": \"tenant-a\"\n    }\n}\n```\n\nThe input is translated to the following `SelfSubjectAccessReview`:\n\n```json\n{\n    \"apiVersion\": \"authorization.k8s.io/v1\",\n    \"kind\": \"SelfSubjectAccessReview\",\n    \"spec\": {\n        \"resourceAttributes\": {\n            \"resource\": \"tenant-a\",\n            \"resourceName\": \"resource-name\",\n            \"verb\": \"get\",\n            \"apiGroup\": \"observatorium.openshift.io\"\n        }\n    }\n}\n```\n\nIf the subject's `k8suser` role bindings allow an access to the resource description in `resourceAttributes`, then the `SelfSubjectAccessReview`'s  status will result in:\n\n```json\n{\n    \"apiVersion\": \"authorization.k8s.io/v1\",\n    \"kind\": \"SelfSubjectAccessReview\",\n    \"spec\": {},\n    \"status\": {                                                                                                                                                                                  \n        \"allowed\": true,\n        \"reason\": \"RBAC: allowed by RoleBinding \\\"tenant-a-binding\\\" of Role \\\"tenant-a\\\" to User \\\"k8suser\\\"\"\n    }\n}\n```\n\n## Usage\n\n[embedmd]:# (tmp/help.txt)\n```txt\nUsage of ./opa-openshift:\n      --debug.name string                      A name to add as a prefix to log lines. (default \"opa-openshift\")\n      --log.format string                      The log format to use. Options: 'logfmt', 'json'. (default \"logfmt\")\n      --log.level string                       The log filtering level. Options: 'error', 'warn', 'info', 'debug'. (default \"info\")\n      --memcached strings                      One or more Memcached server addresses.\n      --memcached.expire int32                 Time after which keys stored in Memcached should expire, given in seconds. (default 3600)\n      --memcached.interval int32               The interval at which to update the Memcached DNS, given in seconds; use 0 to disable. (default 10)\n      --opa.matcher string                     The label key of the OPA label matcher returned to the requesting client.\n      --opa.package string                     The name of the OPA package that opa-openshift should implement, see https://www.openpolicyagent.org/docs/latest/policy-language/#packages.\n      --opa.rule string                        The name of the OPA rule for which opa-openshift should provide a result, see https://www.openpolicyagent.org/docs/latest/policy-language/#rules. (default \"allow\")\n      --openshift.kubeconfig string            A path to the kubeconfig against to use for authorizing client requests.\n      --openshift.mappings strings             A map of tenantIDs to resource api groups to check to apply a given role to a user, e.g. tenant-a=observatorium.openshift.io\n      --tls.cipher-suites string               Comma-separated list of cipher suites for the server. Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). If omitted, the default Go cipher suites will be used. Note that TLS 1.3 ciphersuites are not configurable.\n      --tls.internal.server.ca-file string     File containing the TLS CA against which to verify servers. If no server CA is specified, the client will use the system certificates.\n      --tls.internal.server.cert-file string   File containing the default x509 Certificate for internal HTTPS. Leave blank to disable TLS.\n      --tls.internal.server.key-file string    File containing the default x509 private key matching --tls.internal.server.cert-file. Leave blank to disable TLS.\n      --tls.min-version string                 Minimum TLS version supported. Value must match version names from https://golang.org/pkg/crypto/tls/#pkg-constants. (default \"VersionTLS13\")\n      --tls.server.cert-file string            File containing the default x509 Certificate for HTTPS. Leave blank to disable TLS.\n      --tls.server.key-file string             File containing the default x509 private key matching --tls.server.cert-file. Leave blank to disable TLS.\n      --web.healthchecks.url string            The URL against which to run healthchecks. (default \"http://localhost:8080\")\n      --web.internal.listen string             The address on which the internal server listens. (default \":8081\")\n      --web.listen string                      The address on which the public server listens. (default \":8080\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobservatorium%2Fopa-openshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobservatorium%2Fopa-openshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobservatorium%2Fopa-openshift/lists"}