Skip to content

fix(guardrails): harden infrastructure agent permissions#114

Merged
terisuke merged 1 commit intodevfrom
fix/guardrails-agent-permission-hardening
Apr 6, 2026
Merged

fix(guardrails): harden infrastructure agent permissions#114
terisuke merged 1 commit intodevfrom
fix/guardrails-agent-permission-hardening

Conversation

@terisuke
Copy link
Copy Markdown

@terisuke terisuke commented Apr 6, 2026

Summary

  • Add missing secret file deny patterns to infrastructure agents
  • Restrict kubectl rollout mutating subcommands to ask mode
  • Add explicit docker push deny to deployment-engineer

Follow-up from PR #113 code review (CRITICAL-2, HIGH-3, HIGH-4).

Type of change

  • Bug fix (security permission hardening)

Changes

terraform-engineer, cloud-architect, deployment-engineer:

  • Added *.pem, *.key, *secret* deny to read and grep permissions (matching security-engineer pattern)

deployment-engineer only:

  • Split kubectl rollout*: allow into kubectl rollout status/history: allow + kubectl rollout restart/undo: ask
  • Added explicit docker push*: deny and docker compose push*: deny

Verification

  • bun turbo typecheck — 13/13 pass
  • YAML structure validated
  • Permission patterns consistent with security-engineer baseline

Checklist

…ow-up #113)

- Add *.pem, *.key, *secret* deny to terraform-engineer, cloud-architect, deployment-engineer
- Split kubectl rollout into read-only (allow) vs mutating (ask) subcommands
- Add explicit docker push/docker compose push deny to deployment-engineer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 6, 2026 09:02
@terisuke terisuke merged commit 5740b4e into dev Apr 6, 2026
5 of 8 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens guardrail permissions for infrastructure-focused agents to reduce accidental secret exposure and prevent mutating deployment actions without explicit approval.

Changes:

  • Added additional secret-related deny patterns (*.pem, *.key, *secret*) to read/grep for terraform/cloud/deployment agents.
  • Tightened deployment-engineer kubectl rollout permissions (status/history allow; restart/undo ask).
  • Explicitly denied image pushes for deployment-engineer (docker push*, docker compose push*).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/guardrails/profile/agents/terraform-engineer.md Adds extra secret-file deny patterns to reduce accidental key/secret access.
packages/guardrails/profile/agents/deployment-engineer.md Adds secret denies; restricts rollout mutators to ask; denies Docker push operations.
packages/guardrails/profile/agents/cloud-architect.md Adds extra secret-file deny patterns for a read-only infrastructure reviewer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"*.key": deny
"*secret*": deny
grep:
"*": allow
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the grep permission rules, *credentials* is not denied (unlike security-engineer.md, which denies it). Since grep permissions are evaluated against the search pattern, this agent can still grep for credentials and potentially surface secret values. Add a "*credentials*": deny entry in the grep block (keeping it after "*": allow).

Suggested change
"*": allow
"*": allow
"*credentials*": deny

Copilot uses AI. Check for mistakes.
"*secret*": deny
grep:
"*": allow
"*.env*": deny
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grep permission rules are missing "*credentials*": deny, which is present in the security-engineer baseline. Without it, this agent can still grep for credential-related patterns and potentially expose secret material in grep output. Add the credentials deny rule to the grep block.

Suggested change
"*.env*": deny
"*.env*": deny
"*credentials*": deny

Copilot uses AI. Check for mistakes.
"*secret*": deny
grep:
"*": allow
"*.env*": deny
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grep permission rules don’t deny *credentials* (the security-engineer agent does). Because grep permission checks apply to the search pattern, this still allows grepping for credential material and could leak secrets via grep results. Add "*credentials*": deny to the grep block.

Suggested change
"*.env*": deny
"*.env*": deny
"*credentials*": deny

Copilot uses AI. Check for mistakes.
Comment on lines 24 to +28
"*": deny
"docker build*": allow
"docker compose*": allow
"docker compose push*": deny
"docker push*": deny
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This agent now hard-denies docker push* / docker compose push*, but the guidance text later in the file says to never run docker push without explicit approval. Since deny means it can’t be approved at runtime, update the guidance to reflect that pushes are disallowed for this agent (or change the rule to ask if approval should be possible).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants