Skip to content

ci: add agent-shield.yml workflow#78

Merged
don-petry merged 1 commit intomainfrom
claude/issue-51-20260408-0143
Apr 8, 2026
Merged

ci: add agent-shield.yml workflow#78
don-petry merged 1 commit intomainfrom
claude/issue-51-20260408-0143

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

@don-petry don-petry commented Apr 8, 2026

Summary

  • Copies the org-standard agent-shield.yml workflow verbatim from petry-projects/.github/standards/workflows/agent-shield.yml
  • Resolves the compliance finding: required workflow agent-shield.yml was missing

Changes

  • Added .github/workflows/agent-shield.yml — AgentShield security validation workflow that:
    1. Runs ecc-agentshield deep security scan (102 rules across secrets, permissions, hooks, MCP servers, agent config)
    2. Checks required agent files (CLAUDE.md, AGENTS.md) are present
    3. Validates cross-references between CLAUDE.mdAGENTS.md and AGENTS.md → org standards
    4. Validates SKILL.md frontmatter (name + description fields)

Closes #51

Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added automated security scanning to the CI/CD pipeline.
    • Added repository structure validation checks to ensure consistency across the codebase.

Copies the org-standard AgentShield workflow verbatim from
petry-projects/.github/standards/workflows/agent-shield.yml.

Closes #51

Co-authored-by: don-petry <don-petry@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 8, 2026 01:44
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow file is introduced to enforce security scanning and repository structure validation, including file existence checks, cross-reference validation, and YAML frontmatter requirements for skill definitions.

Changes

Cohort / File(s) Summary
AgentShield Workflow
.github/workflows/agent-shield.yml
Adds security scanning via ecc-agentshield with high-severity filtering, and repository structure validation checking for CLAUDE.md, AGENTS.md file existence and cross-references, and YAML frontmatter in all SKILL.md files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: add agent-shield.yml workflow' directly and concisely describes the main change: adding a new GitHub Actions workflow file.
Linked Issues check ✅ Passed The pull request successfully implements the remediation required by issue #51: adding the missing agent-shield.yml workflow file to bring the repository into compliance with organization CI workflow standards.
Out of Scope Changes check ✅ Passed The pull request contains only the addition of the agent-shield.yml workflow file, which is directly scoped to resolving the compliance finding in issue #51 with no extraneous changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-51-20260408-0143

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@don-petry
Copy link
Copy Markdown
Contributor Author

@don-petry CI is green — please review and merge when ready.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/agent-shield.yml (1)

73-103: Frontmatter validation logic is correct.

The awk extraction properly handles YAML frontmatter delimited by ---. Using find with exclusions and process substitution correctly handles the file iteration. The check gracefully succeeds when no SKILL.md files exist (which is acceptable).

💡 Optional: Validate that required fields have non-empty values

The current checks verify key presence but not that values are non-empty. If stricter validation is desired:

-            if ! echo "$frontmatter" | grep -q '^name:'; then
+            if ! echo "$frontmatter" | grep -qE '^name:\s*\S'; then
               echo "::error file=$file::Missing 'name' field"
               status=1
             fi
-            if ! echo "$frontmatter" | grep -q '^description:'; then
+            if ! echo "$frontmatter" | grep -qE '^description:\s*\S'; then
               echo "::error file=$file::Missing 'description' field"
               status=1
             fi

This ensures fields like name: (with no value) are rejected.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/agent-shield.yml around lines 73 - 103, The current
SKILL.md frontmatter checks only verify presence of the keys; update the two
validations that use grep for '^name:' and '^description:' so they also require
a non-empty value after the colon. Replace the simple grep checks with a regex
that asserts at least one non-whitespace character after the colon (e.g. grep
-qE '^name:[[:space:]]*[^[:space:]]' and similarly for '^description:') or
extract the value from the frontmatter variable and test it for non-empty;
update the checks in the while loop that references frontmatter and the lines
containing the '^name:' and '^description:' grep invocations accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/agent-shield.yml:
- Around line 73-103: The current SKILL.md frontmatter checks only verify
presence of the keys; update the two validations that use grep for '^name:' and
'^description:' so they also require a non-empty value after the colon. Replace
the simple grep checks with a regex that asserts at least one non-whitespace
character after the colon (e.g. grep -qE '^name:[[:space:]]*[^[:space:]]' and
similarly for '^description:') or extract the value from the frontmatter
variable and test it for non-empty; update the checks in the while loop that
references frontmatter and the lines containing the '^name:' and '^description:'
grep invocations accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5fa1813b-9d9b-4a8b-8bfb-875470923833

📥 Commits

Reviewing files that changed from the base of the PR and between 63cdca3 and 113139e.

📒 Files selected for processing (1)
  • .github/workflows/agent-shield.yml

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

Adds the org-required AgentShield GitHub Actions workflow to bring the repo into compliance and enforce agent/security validation in CI.

Changes:

  • Introduces .github/workflows/agent-shield.yml workflow triggered on pushes/PRs to main.
  • Runs ecc-agentshield scan plus repo-structure validations for CLAUDE.md, AGENTS.md, and SKILL.md frontmatter.

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

Comment on lines +5 to +6
# 1. affaan-m/agentshield action — deep security scan (102 rules across
# secrets, permissions, hooks, MCP servers, and agent config)
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The workflow comments say it uses the "affaan-m/agentshield action", but the implementation actually runs the AgentShield CLI via npx ecc-agentshield@.... Please align the comment with the actual mechanism (CLI vs action) to avoid confusion when maintaining/updating this workflow.

Suggested change
# 1. affaan-m/agentshield action — deep security scan (102 rules across
# secrets, permissions, hooks, MCP servers, and agent config)
# 1. AgentShield CLI via ecc-agentshield — deep security scan (102 rules
# across secrets, permissions, hooks, MCP servers, and agent config)

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +23
permissions:
contents: read

jobs:
agent-shield:
name: AgentShield
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

For consistency with other workflows in this repo (e.g., codeql-analysis.yml, sonarcloud.yml), consider setting workflow-level permissions: {} and moving contents: read under the job’s permissions:. This keeps the workflow least-privilege by default if additional jobs are added later.

Suggested change
permissions:
contents: read
jobs:
agent-shield:
name: AgentShield
permissions: {}
jobs:
agent-shield:
name: AgentShield
permissions:
contents: read

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,103 @@
# AgentShield — Agent configuration security validation
# See: standards/agent-standards.md
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The header comment points to standards/agent-standards.md, but this repository doesn’t contain that path. Consider changing it to a fully-qualified org-standards URL (or another local reference) so readers don’t assume there’s a missing file in this repo.

Suggested change
# See: standards/agent-standards.md
# See: https://github.com/petry-projects/.github/blob/main/standards/agent-standards.md

Copilot uses AI. Check for mistakes.
@don-petry don-petry merged commit 8aca587 into main Apr 8, 2026
20 checks passed
@don-petry don-petry deleted the claude/issue-51-20260408-0143 branch April 8, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compliance: missing-agent-shield.yml

2 participants