-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add CI/CD pipeline policy template with intent fixtures #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| schema_id: gait.gate.policy | ||
| schema_version: 1.0.0 | ||
| default_verdict: block | ||
| fail_closed: | ||
| enabled: true | ||
| risk_classes: [critical] | ||
| required_fields: [targets, arg_provenance] | ||
| rules: | ||
| - name: allow-read-build-artifacts | ||
| priority: 10 | ||
| effect: allow | ||
| match: | ||
| tool_names: [artifact.read, artifact.download, artifact.list, tool.read] | ||
| risk_classes: [low, medium] | ||
| reason_codes: [safe_artifact_read] | ||
|
|
||
| - name: allow-staging-deploy | ||
| priority: 15 | ||
| effect: allow | ||
| match: | ||
| tool_names: [deploy.apply, deploy.push] | ||
| risk_classes: [medium] | ||
| workspace_prefixes: [/ci/staging, /deploy/staging] | ||
|
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The staging deploy allow rule only checks tool name, risk class, and workspace prefix, so a request can still target production infrastructure while presenting Useful? React with 👍 / 👎. |
||
| reason_codes: [staging_deploy_allowed] | ||
|
|
||
| - name: block-production-deploy | ||
| priority: 20 | ||
| effect: block | ||
| match: | ||
| tool_names: [deploy.apply, deploy.push] | ||
| risk_classes: [critical] | ||
| workspace_prefixes: [/ci/production, /deploy/production] | ||
| reason_codes: [production_deploy_blocked_in_ci] | ||
| violations: [unauthorized_production_deploy] | ||
|
|
||
| - name: require-approval-secret-access | ||
| priority: 25 | ||
| effect: require_approval | ||
| min_approvals: 1 | ||
| match: | ||
| tool_names: [secret.read, vault.read, secret.rotate] | ||
| risk_classes: [high, critical] | ||
| reason_codes: [approval_required_for_secret_access] | ||
| violations: [secret_access_requires_approval] | ||
|
|
||
| - name: block-infrastructure-mutation | ||
| priority: 30 | ||
| effect: block | ||
| match: | ||
| tool_names: [infra.destroy, infra.delete, db.drop, db.truncate] | ||
| reason_codes: [infrastructure_mutation_blocked] | ||
| violations: [destructive_infrastructure_operation] | ||
|
|
||
| - name: require-approval-infra-create | ||
| priority: 35 | ||
| effect: require_approval | ||
| min_approvals: 2 | ||
| require_distinct_approvers: true | ||
| match: | ||
| tool_names: [infra.create, infra.update] | ||
| risk_classes: [high, critical] | ||
| reason_codes: [approval_required_for_infrastructure_change] | ||
| violations: [infrastructure_change_requires_review] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "schema_id": "gait.gate.intent_request", | ||
| "schema_version": "1.0.0", | ||
| "created_at": "2026-03-23T00:00:00Z", | ||
| "producer_version": "0.0.0-example", | ||
| "tool_name": "deploy.apply", | ||
| "args": { | ||
| "environment": "production", | ||
| "image": "app:sha-abc123" | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "kind": "host", | ||
| "value": "api.production.example", | ||
| "operation": "write", | ||
| "endpoint_class": "net.http", | ||
| "endpoint_domain": "api.production.example" | ||
| } | ||
| ], | ||
| "arg_provenance": [ | ||
| { | ||
| "arg_path": "$.image", | ||
| "source": "system", | ||
| "source_ref": "ci:build_output" | ||
| } | ||
| ], | ||
| "context": { | ||
| "identity": "ci-agent", | ||
| "workspace": "/ci/production", | ||
| "risk_class": "critical" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "schema_id": "gait.gate.intent_request", | ||
| "schema_version": "1.0.0", | ||
| "created_at": "2026-03-23T00:00:00Z", | ||
| "producer_version": "0.0.0-example", | ||
| "tool_name": "deploy.apply", | ||
| "args": { | ||
| "environment": "staging", | ||
| "image": "app:sha-abc123" | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "kind": "host", | ||
| "value": "staging.internal.example", | ||
| "operation": "write", | ||
| "endpoint_class": "net.http", | ||
| "endpoint_domain": "staging.internal.example" | ||
| } | ||
| ], | ||
| "arg_provenance": [ | ||
| { | ||
| "arg_path": "$.image", | ||
| "source": "system", | ||
| "source_ref": "ci:build_output" | ||
| } | ||
| ], | ||
| "context": { | ||
| "identity": "ci-agent", | ||
| "workspace": "/ci/staging", | ||
| "risk_class": "medium" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "schema_id": "gait.gate.intent_request", | ||
| "schema_version": "1.0.0", | ||
| "created_at": "2026-03-23T00:00:00Z", | ||
| "producer_version": "0.0.0-example", | ||
| "tool_name": "infra.destroy", | ||
| "args": { | ||
| "resource": "rds-cluster-prod", | ||
| "region": "us-east-1" | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "kind": "other", | ||
| "value": "rds-cluster-prod", | ||
| "operation": "delete", | ||
| "destructive": true | ||
| } | ||
| ], | ||
| "arg_provenance": [ | ||
| { | ||
| "arg_path": "$.resource", | ||
| "source": "user" | ||
| } | ||
| ], | ||
| "context": { | ||
| "identity": "ci-agent", | ||
| "workspace": "/ci/workspace", | ||
| "risk_class": "high" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "schema_id": "gait.gate.intent_request", | ||
| "schema_version": "1.0.0", | ||
| "created_at": "2026-03-23T00:00:00Z", | ||
| "producer_version": "0.0.0-example", | ||
| "tool_name": "artifact.read", | ||
| "args": { | ||
| "artifact_id": "build-output-abc123", | ||
| "path": "/ci/artifacts/build.tar.gz" | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "kind": "path", | ||
| "value": "/ci/artifacts/build.tar.gz", | ||
| "operation": "read" | ||
| } | ||
| ], | ||
| "arg_provenance": [ | ||
| { | ||
| "arg_path": "$.artifact_id", | ||
| "source": "system" | ||
| } | ||
| ], | ||
| "context": { | ||
| "identity": "ci-agent", | ||
| "workspace": "/ci/workspace", | ||
| "risk_class": "low" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "schema_id": "gait.gate.intent_request", | ||
| "schema_version": "1.0.0", | ||
| "created_at": "2026-03-23T00:00:00Z", | ||
| "producer_version": "0.0.0-example", | ||
| "tool_name": "secret.read", | ||
| "args": { | ||
| "secret_name": "DATABASE_URL", | ||
| "vault_path": "ci/production/database" | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "kind": "other", | ||
| "value": "vault://ci/production/database", | ||
| "operation": "read" | ||
| } | ||
| ], | ||
| "arg_provenance": [ | ||
| { | ||
| "arg_path": "$.secret_name", | ||
| "source": "system", | ||
| "source_ref": "ci:env_config" | ||
| } | ||
| ], | ||
| "context": { | ||
| "identity": "ci-agent", | ||
| "workspace": "/ci/workspace", | ||
| "risk_class": "high" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including
tool.readin the artifact-read rule allows any generic read call at low/medium risk, not just artifact access. In adapters that surface secret or vault retrieval astool.read, those requests bypass therequire-approval-secret-accessrule and are approved asallow, which weakens the template’s stated secret-access guardrail. Restrict this rule to artifact-specific tool names (or add strict target/path constraints) so non-artifact reads do not auto-pass.Useful? React with 👍 / 👎.