Create OPA governance policies for Harness via MCP. Define policies that enforce compliance rules on pipelines, services, environments, feature flags, artifacts, code repositories, templates, SBOM, security tests, Terraform, GitOps, connectors, secrets, and more. Use when asked to create, write, fix, or explain an OPA policy, Rego rule, deny rule, governance policy, compliance rule, or policy-as-code for any Harness entity. Trigger phrases: create policy, OPA policy, governance policy, compliance rule, rego policy, deny rule, enforce policy, security policy, supply chain governance.
75
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Create OPA governance policies for Harness Software Supply Chain Assurance (SCS) via MCP.
Determine what the policy should enforce:
For writing Rego policies, consult references/rego-writing-guide.md for the complete Rego writing rules, entity types, package names, and common patterns. For entity-specific schemas and examples, see the entity reference files listed in that guide.
Call MCP tool: harness_create
Parameters:
resource_type: "policy"
org_id: "<organization>"
project_id: "<project>"
body: <policy definition>OPA policies are managed under the governance toolset — resource_type: "policy" supports full CRUD (list, get, create, update, delete).
After a policy is created, check compliance status on artifacts or repositories:
Call MCP tool: harness_list
Parameters:
resource_type: "scs_compliance_result"
org_id: "<organization>"
project_id: "<project>"Enforce that all artifacts have an SBOM before deployment:
package harness.artifact
deny[msg] {
not input.artifact.sbom
msg := "Artifact must have an SBOM before deployment"
}Deny deployment of artifacts with critical CVEs:
package harness.artifact
deny[msg] {
vuln := input.artifact.vulnerabilities[_]
vuln.severity == "CRITICAL"
msg := sprintf("Critical vulnerability %s found in artifact", [vuln.cve_id])
}Restrict container images to approved base images:
package harness.artifact
approved_bases := {"alpine", "distroless", "ubuntu"}
deny[msg] {
not approved_bases[input.artifact.base_image]
msg := sprintf("Base image '%s' is not in the approved list", [input.artifact.base_image])
}Enforce artifact signing before deployment:
package harness.artifact
deny[msg] {
not input.artifact.signed
msg := "Artifact must be signed before deployment"
}| Resource Type | Operations | Description |
|---|---|---|
policy | list, get, create, update, delete | OPA governance policies (governance toolset) |
policy_set | list, get, create, update, delete | Group policies with enforcement actions |
policy_evaluation | list, get | View policy evaluation results |
scs_compliance_result | list | Check SCS policy compliance status |
artifact_security | list, get | View artifact security posture |
code_repo_security | list, get | View repository security posture |
scs_chain_of_custody | get | Verify artifact provenance |
For writing Rego policies for any Harness entity, consult these reference files:
package harness.<domain> convention.resource_type: "policy")policy_set with an enforcement action (warn/deny) before they firescs_compliance_result or policy_evaluation to verify the policy is being evaluatedpackage harness.<domain> conventionmsg string explaining the violationpolicy_set to activate enforcement23e9b8b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.