Creating policies
Skill pvnarp/harness-agentic-skills/skills/harness/creating-policies
Create OPA governance policies for Harness supply chain security via MCP. Define policies that enforce compliance rules on artifacts, code repositories, and deployment pipelines. Use when asked to create a governance policy, OPA policy, compliance rule, supply chain policy, or enforce security standards. Trigger phrases: create policy, OPA policy, governance policy, compliance rule, supply chain governance, enforce policy, security policy.From its SKILL.md
npx -y skills add pvnarp/harness-agentic-skills --skill creating-policiesAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.1 KB, as published. Nobody here has run it
Create Policy
What this skill uses
Harness MCP tools: harness:harness_create, harness:harness_list
Resource types: policy, scs_compliance_result
Create OPA governance policies for Harness Software Supply Chain Assurance (SCS) via MCP.
Instructions
Step 1: Identify Policy Requirements
Determine what the policy should enforce:
- What artifact or repository standard must be met?
- What is the enforcement action (warn, deny)?
- What scope should the policy apply to?
Step 2: Create the Policy
Call MCP tool: harness:harness_create
Parameters:
resource_type: "policy"
org_id: "<organization>"
project_id: "<project>"
body: <policy definition>
Step 3: Verify Compliance Results
After a policy is created, check compliance status on artifacts or repositories:
Call MCP tool: harness:harness_list
Parameters:
resource_type: "scs_compliance_result"
org_id: "<organization>"
project_id: "<project>"
Common Policy Patterns
Require SBOM Generation
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"
}
Block Critical Vulnerabilities
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])
}
Enforce Approved Base Images
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])
}
Require Signed Artifacts
Enforce artifact signing before deployment:
package harness.artifact
deny[msg] {
not input.artifact.signed
msg := "Artifact must be signed before deployment"
}
Related Resource Types
| Resource Type | Operations | Description |
|---|---|---|
policy | list, get, create, update, delete | OPA / Rego governance policies |
policy_set | list, get, create, update, delete | Group policies into enforced sets |
policy_evaluation | list, get | Inspect policy evaluation results |
scs_compliance_result | list | Check policy compliance status on artifacts |
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 |
Examples
- "Create a policy to block critical CVEs" -- Create OPA deny rule for critical severity
- "Enforce SBOM generation for all artifacts" -- Create policy requiring SBOM presence
- "Only allow approved base images" -- Create policy with allowed base image list
- "Require artifact signing before production" -- Create policy checking signature status
- "Check which artifacts violate our policies" -- List scs_compliance_result
Related skills
Composes with (skills commonly invoked together):
Follow-ups (skills commonly chained after this one):
Performance Notes
- Validate Rego syntax before submitting. Common issues: missing package declaration, deny rules without msg return.
- Ensure the policy package name follows
package harness.<domain>convention. - Test policy logic mentally against expected inputs before creating.
Troubleshooting
Policy Not Enforcing
- Policies are create-only via MCP -- verify the policy was created successfully
- Check that the policy scope matches the target artifacts/repositories
- Use
scs_compliance_resultto verify the policy is being evaluated
Policy Syntax Errors
- OPA policies use Rego language -- validate syntax before submitting
- Package names should follow
package harness.<domain>convention - Deny rules must return a
msgstring explaining the violation
Limitations
- MCP supports create-only for OPA policies (no list, update, or delete via MCP)
- For managing existing policies, use the Harness UI under Supply Chain Assurance settings
- Policies apply within the project scope where they are created