Skip to content

feat: add agent-shield.yml workflow for compliance#83

Open
don-petry wants to merge 1 commit intomainfrom
claude/issue-40-20260407-1731
Open

feat: add agent-shield.yml workflow for compliance#83
don-petry wants to merge 1 commit intomainfrom
claude/issue-40-20260407-1731

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

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

Summary

  • Adds the required agent-shield.yml workflow copied from standards/workflows/agent-shield.yml
  • This workflow runs AgentShield security scans and org-specific structural checks on every push/PR to main

Closes #40

Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Implemented automated security scanning and repository validation checks in the continuous integration workflow to ensure code quality and compliance standards.

Closes #40

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

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Added a new GitHub Actions workflow file .github/workflows/agent-shield.yml that performs two validation layers: runs an AgentShield security scan via npx ecc-agentshield@1.4.0 scan with high severity threshold, and executes shell-based checks verifying required files (CLAUDE.md, AGENTS.md) exist, contain proper cross-references, and that all SKILL.md files include valid YAML frontmatter with required name: and description: fields.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/agent-shield.yml
New CI workflow implementing AgentShield security scanning and repository compliance checks for required metadata files and SKILL.md YAML frontmatter validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 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 clearly and concisely describes the primary change: adding the agent-shield.yml workflow for compliance purposes, which directly addresses the PR's main objective.
Linked Issues check ✅ Passed The PR successfully implements the required agent-shield.yml workflow as specified in issue #40, addressing the missing workflow compliance finding and bringing the repository into compliance.
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 address the compliance requirement stated in issue #40 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-40-20260407-1731

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

@don-petry
Copy link
Copy Markdown
Contributor Author

Self-review: The change adds .github/workflows/agent-shield.yml as an exact copy of the standards template. Verified: minimal permissions (contents: read), pinned checkout SHA, AgentShield scan at 1.4.0 with --min-severity high, structural checks for CLAUDE.md/AGENTS.md/SKILL.md. No issues found. @don-petry please review and merge once CI passes.

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/agent-shield.yml:
- Around line 73-103: The workflow step named "Validate SKILL.md frontmatter"
relies on bash process substitution and should be explicit about the shell;
update that GitHub Actions step to include a "shell: bash" property so the run
block executes under bash (ensuring the use of process substitution and
bash-specific features in the frontmatter extraction and validation logic).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 26e326a5-3f46-4c81-9e04-2fefa8faa592

📥 Commits

Reviewing files that changed from the base of the PR and between ecca69f and cfc40d4.

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

Comment on lines +73 to +103
- name: Validate SKILL.md frontmatter
run: |
status=0

while IFS= read -r file; do
frontmatter=$(awk \
'/^---$/{n++; next} n==1{print} n>=2{exit}' \
"$file")

if [ -z "$frontmatter" ]; then
echo "::error file=$file::Missing YAML frontmatter"
status=1
continue
fi

if ! echo "$frontmatter" | grep -q '^name:'; then
echo "::error file=$file::Missing 'name' field"
status=1
fi
if ! echo "$frontmatter" | grep -q '^description:'; then
echo "::error file=$file::Missing 'description' field"
status=1
fi
done < <(find . -name 'SKILL.md' \
-not -path '*/node_modules/*' \
-not -path '*/.git/*')

if [ "$status" -eq 0 ]; then
echo "All SKILL.md frontmatter validated."
fi
exit $status
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

LGTM with minor suggestion.

The awk-based frontmatter extraction and field validation logic is correct. The process substitution < <(find ...) works because GitHub Actions defaults to bash on ubuntu-latest.

For explicit clarity and cross-platform safety, consider adding shell: bash to this step, though it's not strictly required:

- name: Validate SKILL.md frontmatter
  shell: bash
  run: |
🤖 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 workflow step
named "Validate SKILL.md frontmatter" relies on bash process substitution and
should be explicit about the shell; update that GitHub Actions step to include a
"shell: bash" property so the run block executes under bash (ensuring the use of
process substitution and bash-specific features in the frontmatter extraction
and validation logic).

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds an agent-shield.yml GitHub Actions workflow to run AgentShield scans and enforce org-required agent repo structure on pushes/PRs to main.

Changes:

  • Introduces a new AgentShield workflow triggered on push/pull_request to main
  • Runs ecc-agentshield scan with --min-severity high
  • Adds shell-based checks for required files, cross-references, and SKILL.md YAML frontmatter

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

Comment on lines +78 to +80
frontmatter=$(awk \
'/^---$/{n++; next} n==1{print} n>=2{exit}' \
"$file")
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The frontmatter/key detection is overly strict: it only recognizes --- with no surrounding whitespace and keys that start at column 1. If any SKILL.md uses common variations (e.g., --- with trailing spaces, or indented name:/description:), this will incorrectly fail validation. Consider relaxing the patterns (e.g., allow leading/trailing whitespace around --- and optional indentation before keys) to avoid false negatives.

Copilot uses AI. Check for mistakes.
continue
fi

if ! echo "$frontmatter" | grep -q '^name:'; then
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The frontmatter/key detection is overly strict: it only recognizes --- with no surrounding whitespace and keys that start at column 1. If any SKILL.md uses common variations (e.g., --- with trailing spaces, or indented name:/description:), this will incorrectly fail validation. Consider relaxing the patterns (e.g., allow leading/trailing whitespace around --- and optional indentation before keys) to avoid false negatives.

Copilot uses AI. Check for mistakes.
echo "::error file=$file::Missing 'name' field"
status=1
fi
if ! echo "$frontmatter" | grep -q '^description:'; then
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The frontmatter/key detection is overly strict: it only recognizes --- with no surrounding whitespace and keys that start at column 1. If any SKILL.md uses common variations (e.g., --- with trailing spaces, or indented name:/description:), this will incorrectly fail validation. Consider relaxing the patterns (e.g., allow leading/trailing whitespace around --- and optional indentation before keys) to avoid false negatives.

Copilot uses AI. Check for mistakes.
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