A Kubernetes operator that exports OpenSSF Scorecard metrics for GitHub organizations as Prometheus metrics.
The OpenSSF Scorecard Exporter is a kubebuilder-based Kubernetes operator that helps provide visibility into your organization's code security practices. It automatically:
- Discovers public repositories in specified GitHub organizations
- Fetches OpenSSF Scorecard data for each repository
- Exposes the security scores as Prometheus metrics
The operator reconciles native Kubernetes ConfigMaps that are labeled with openssf-scorecard.giantswarm.io/enabled=true, making it easy to manage multiple organization configurations.
helm install openssf-scorecard-exporter ./helm/openssf-scorecard-exportermake build-installer
kubectl apply -f dist/install.yamlTo monitor an organization's repositories, create a ConfigMap with the required label:
apiVersion: v1
kind: ConfigMap
metadata:
name: giantswarm-scorecard-config
namespace: default
labels:
openssf-scorecard.giantswarm.io/enabled: "true"
data:
organization: "giantswarm" # Required: GitHub organization nameTo avoid GitHub API rate limits, you can provide a GitHub token:
- Create a secret with your GitHub token:
apiVersion: v1
kind: Secret
metadata:
name: github-token
namespace: default
type: Opaque
stringData:
token: "ghp_your_github_token_here"- Reference it in your ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: giantswarm-scorecard-config
namespace: default
labels:
openssf-scorecard.giantswarm.io/enabled: "true"
data:
organization: "giantswarm"
tokenSecret: "github-token" # Name of the secret
tokenSecretKey: "token" # Key in the secret (defaults to "token")| Field | Required | Description |
|---|---|---|
organization |
Yes | Organization/group name to monitor |
providerType |
No | VCS provider type: github (default) |
baseURL |
No | Custom VCS API base URL (for self-hosted instances) |
tokenSecret |
No | Name of the Kubernetes Secret containing the VCS token |
tokenSecretKey |
No | Key in the Secret containing the token (defaults to "token") |
The operator exposes the following Prometheus metrics:
Overall OpenSSF Scorecard score for a repository (0-10 scale, -1 for unavailable).
Labels:
config: Name of the ConfigMap managing this repositoryorganization: GitHub organizationrepository: Repository name
Special Values:
-1: Scorecard data not yet available for this repository
Score for individual OpenSSF Scorecard checks (0-10 scale, -1 for unavailable).
Labels:
config: Name of the ConfigMap managing this repositoryorganization: GitHub organizationrepository: Repository namecheck: Name of the security check (e.g., "Branch-Protection", "Code-Review")
Binary status of individual checks.
Labels:
config: Name of the ConfigMap managing this repositoryorganization: GitHub organizationrepository: Repository namecheck: Name of the security check
Values:
1: Pass0: Fail-1: Unavailable/Unknown
Unix timestamp of the last scorecard data update.
Labels:
config: Name of the ConfigMap managing this repositoryorganization: GitHub organizationrepository: Repository name
Get overall scores for all repositories:
openssf_scorecard_overall_score
Find repositories with low scores (excluding unavailable data):
openssf_scorecard_overall_score < 5 and openssf_scorecard_overall_score >= 0
Find repositories without scorecard data:
openssf_scorecard_overall_score == -1
Check Branch Protection status across all repos:
openssf_scorecard_check_score{check="Branch-Protection"}
Count failing checks per repository:
count by (organization, repository) (openssf_scorecard_check_status{status="0"})
- Go 1.23 or later
- Kubernetes cluster (or Kind for local development)
- kubectl configured to access your cluster
Build the operator binary:
make buildBuild the Docker image:
make docker-build IMG=your-registry/openssf-scorecard-exporter:latestRun the operator outside the cluster (useful for development):
make runRun unit tests:
make testRun e2e tests (requires Kind):
make test-e2eRun the linter:
make lintAuto-fix linting issues:
make lint-fixCheck that the ConfigMap has the required label:
kubectl get configmap <name> -o jsonpath='{.metadata.labels}'View operator logs:
kubectl logs -n openssf-scorecard-exporter-system deployment/openssf-scorecard-exporter-controller-manager- Verify the ConfigMap is properly labeled
- Check operator logs for errors
- Verify the organization has public repositories
- Check that repositories have scorecard data available
Note: Repositories without scorecard data will show a score of -1. This is normal for:
- New repositories not yet analyzed by OpenSSF Scorecard
- Repositories that don't meet scorecard analysis criteria
- Private repositories (scorecard only analyzes public repos)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the Apache License 2.0. See LICENSE for details.