
Part 2: Ship It — GitHub Action, OIDC, and 12 Findings on a Real App
*Part 2 of 2 in the "Shift-Left Resiliency" series*
TL;DR: We take the agent from Part 1 and ship it as a reusable GitHub Action with zero stored secrets (OIDC only), test it against a real 3-tier Terraform application, and walk through the 12 findings it produced — 8 HIGH, 4 MEDIUM. Then we show how SARIF turns those findings into inline PR annotations on the exact code lines.
Tags:
#Resilience #DevOps #Well-Architected #InfrastructureAsCode #GitHubActions #Security Series: Shift-Left Resiliency (Part 2 of 2)
From Script to Reusable Action
In Part 1, we built the scanner, rules engine, and AI reviewer. Now we wrap it into a composite GitHub Action that any team can add to their repo with a single workflow file.
The Consumer Experience
To add resiliency review to your IaC repo, create one file:
# .github/workflows/resiliency-review.ymlname: Resiliency Review
on: pull_request: paths: ["**/*.tf", "**/*.yaml", "**/*.yml", "**/*.json"]
permissions: id-token: write # OIDC federation pull-requests: write # Post PR comment contents: read security-events: write # Upload SARIF
jobs: resiliency-review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0
- uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::<ACCOUNT_ID>:role/GitHubActions-ResiliencyAgent aws-region: us-west-2
- uses: sharp-eagle/resiliency-ai-agent-v1@main with: severity-threshold: MEDIUMThat's it. No package to install, no server to run, no database to manage.
Zero Stored Secrets: OIDC-Only Authentication
This is a strong architectural decision: the agent never uses IAM access keys. Instead, it uses GitHub's OIDC identity federation .
How it works:
GitHub Actions AWS───────────────── ──────────────────1. Workflow starts 2. Requests OIDC token ──────────────────── 3. Validates token (signed JWT proving (via OIDC provider repo identity) trust policy) 4. Issues 15-minute ◄──────────────── STS credentials (bedrock:InvokeModel only)5. Agent calls Bedrock with temp credentials6. Credentials expire automaticallyWhy this matters:
| Stored IAM keys | OIDC (used here) |
|---|---|---|
Long-lived secret in GitHub | Yes | No |
Risk from compromised fork PR | High | None — no secret exists |
Credential lifetime | Until rotated | ~15 minutes |
Permission scope | Whatever the key allows | Exactly bedrock:InvokeModel |
One-time setup script:
# Dry run (prints plan, makes no changes)./scripts/setup-oidc-role.sh \ --github-repo your-org/your-infra-repo \ --profile your-aws-profile
# Apply./scripts/setup-oidc-role.sh \ --github-repo your-org/your-infra-repo \ --profile your-aws-profile \ --applyThis creates:
- A GitHub OIDC identity provider in your AWS account (one-time, account-wide)
- An IAM role (
GitHubActions-ResiliencyAgent) trusted only by your specific repo
- An inline policy limited to
bedrock:InvokeModelon a single model ARN
No other repo, fork, or account can assume this role. And if you don't want any AWS integration at all, set
enable-ai: "false" — static rules still run and report to the PR.
The Action Internals: action.yml
The action is a composite action — it runs directly in the workflow job (no Docker build, no separate container). Here's the flow:
action.yml (composite)│├── Step 1: Setup Python 3.12├── Step 2: pip install requirements.txt├── Step 3: Run scan → SARIF output│ └── (fallback: empty SARIF if scan errors)├── Step 4: Upload SARIF to Code Scanning│ └── continue-on-error: true (non-blocking)├── Step 5: Run scan → PR comment output├── Step 6: Post PR comment via GitHub API│ └── continue-on-error: true└── Step 7: Summarize findings + exit code └── exit 1 if HIGH findings (gates merge)Key reliability decisions:
- SARIF upload is non-blocking (
continue-on-error: true) — if the repo doesn't have GitHub Advanced Security, the PR comment still posts.
- Empty SARIF fallback — if the scan fails for any reason, a valid empty SARIF is generated so
upload-sarifdoesn't error on a missing file.
- Separate scan runs for SARIF vs. PR comment — ensures one output format failing doesn't block the other.
Configuration:
Input | Default | Description |
|---|---|---|
path | . | Directory to scan |
enable-ai | true | Bedrock analysis; false for static-only |
aws-region | us-west-2 | Region for Bedrock |
severity-threshold | LOW | Minimum severity to report |
fail-on-high | true | Fail the job on HIGH findings |
upload-sarif | true | Upload to Security tab |
post-pr-comment | true | Post markdown summary |
Real Test: 12 Findings on a 3-Tier App
I tested the agent against a real open-source Terraform project — a 3-tier web application with VPC, EKS/ASG compute, RDS database, and load balancing.
Target repo structure:
terraform/main.tf # Root modulemodules/networking/main.tf # VPC, subnets, NAT gateway, security groupsmodules/compute/main.tf # 3x ASGs (bastion, app, backend)modules/database/main.tf # RDS MySQL instancemodules/loadbalancing/main.tf # ALBResults: 12 findings total (8 HIGH, 4 MEDIUM)
See it live: github.com/sharp-eagle/rel-agent-sample-tf/pull/1 — the actual PR with bot comment and inline annotations.
Sev. | Source | Resource | Finding |
|---|---|---|---|
HIGH | DB-001 | db_instance.three_tier_db | RDS must be Multi-AZ |
HIGH | DB-002 | db_instance.three_tier_db | No automated backups (retention = 0) |
HIGH | COMPUTE-001 | asg.three_tier_bastion | ASG doesn't span 3+ AZs |
HIGH | COMPUTE-001 | asg.three_tier_app | ASG doesn't span 3+ AZs |
HIGH | COMPUTE-001 | asg.three_tier_backend | ASG doesn't span 3+ AZs |
HIGH | NET-001 | nat_gateway.three_tier_ngw | Single NAT Gateway — one AZ serves all subnets |
HIGH | AI | db_instance.three_tier_db | Cross-service: ASGs span 3 AZs but DB is single-AZ |
HIGH | AI | db_instance.three_tier_db | Backup retention defaults to 0 for MySQL |
MED | AI | All ASGs | Sizing (min=2, max=3) violates static-stability |
MED | AI | All ASGs | Missing health_check_type = "ELB" behind LB |
Skills loaded automatically:
The agent detected resource types and loaded 4 skills:
Found 12 resources in .Loaded 4 skill(s): Compute & Auto Scaling, EKS Zonal, Networking HA, RDS & AuroraRunning skill-powered AI analysis via Amazon Bedrock...EKS Zonal was loaded (triggered by
aws_launch_template ) but contributed nothing — there are no EKS resources in this repo. That's expected and by design: loading is cheap, false positives from unused skills are zero.Static vs. AI findings:
Notice the overlap:
DB-001 (static) and the AI's "Multi-AZ disabled" are the same issue, but the AI adds cross-service context — it explains why this matters given that the compute layer spans 3 AZs. The static rule says "this is wrong"; the AI says "here's the blast radius."Screenshot from github

SARIF: Inline Annotations on the Exact Line
When the agent outputs SARIF 2.1.0 and uploads it via
github/codeql-action/upload-sarif@v3 , GitHub renders findings as:- Inline annotations on the PR diff (yellow/red markers on the exact line)
- Entries in the Security → Code Scanning tab (persistent across PRs)
- Check annotations that can block merge
Line 13: resource "aws_db_instance" "three_tier_db" {Line 14: engine = "mysql" ⚠️ DB-001: RDS must be Multi-AZ — single point of failure (REL11-BP02)Line 15: instance_class = "db.t3.medium"The developer sees the finding where they need to act. No scrolling to a bot comment at the bottom.
Important caveat: GitHub's UI wording
GitHub's Code Scanning was built for security tools (CodeQL, Snyk). When it renders resiliency findings, it uses its generic template:
"11 new alerts including 9 high severity security vulnerabilities"
That sentence is GitHub's wording, not ours. The findings are resiliency issues (single-AZ, missing failover), not security vulnerabilities. There's no way to change this label — it's baked into GitHub's UI for all SARIF-sourced results.
If this is confusing for your audience, set
upload-sarif: "false" and rely only on the PR comment, which uses your own wording throughout.Gotcha: annotations only appear on diff-touched lines
GitHub only renders inline annotations on lines that appear in the PR's diff. If a resource has always been
multi_az = false and the PR doesn't touch that line, the annotation shows in the Security tab but NOT inline on the PR.Workaround: ensure your test PR actually touches the flagged lines (even adding a comment on the same line triggers rendering).
Running It Locally (No GitHub Required)
You don't need GitHub Actions to use the agent:
# Clone and setupgit clone https://github.com/sharp-eagle/resiliency-ai-agent-v1.gitcd resiliency-ai-agent-v1python -m venv .venv && source .venv/bin/activatepip install -r requirements.txt
# Point it at any Terraform repo — static rules onlypython src/main.py scan /path/to/your/terraform/ --verbose
# Add AI analysis (needs AWS credentials via SSO, profile, etc.)python src/main.py scan /path/to/your/terraform/ --ai --format cli
# Generate SARIF filepython src/main.py scan . --ai --format sarif --output findings.sarifThe agent only reads
.tf files — static analysis, no live AWS calls, no terraform apply , no deployment.
Cost and Performance
Metric | Value |
|---|---|
Static rules only | ~2 seconds, $0 |
With AI (Bedrock) | ~15–30 seconds, ~$0.01–0.02/review |
Typical PR size | 5–50 resources |
Token usage | ~2K input (resources) + ~4K input (skills) → ~1K output |
At $0.01/review, even running on every PR across 100 repos costs less than a coffee per month.
Fork PR Security
id-token: write (required for OIDC) is not granted to workflows triggered by fork PRs — this is GitHub's design . On public repos with fork contributors:- AI analysis is automatically skipped for fork PRs (no credentials → graceful fallback)
- Static findings still run and post — they need zero AWS access
- The agent never crashes or exposes anything; it fails closed to "static only"
What's Next: Extending the Agent
The architecture is designed for extension:
- Add a new rule: Create a YAML entry in
rules/. Zero code changes.
- Add a new AI skill: Create
skills/your-service/manifest.yaml+SKILL.md. The loader picks it up automatically.
- Support a new IaC format (Pulumi, CDK output): Add a parser function in
scanner.py.
- Multi-cloud: Add Azure/GCP resource types to rules and skills. The architecture is cloud-agnostic.
Future directions I'm exploring:
- Agent memory — remembering that a team already accepted a risk, flagging regressions
- Org-wide policy — "all production databases in this org must be Multi-AZ" as a configurable standard
- Cost-aware recommendations — suggesting Multi-AZ only for production, not dev/staging
Try It
- Test target: github.com/sharp-eagle/rel-agent-sample-tf (forked 3-tier app with the Action pre-configured)
- Live PR with findings: rel-agent-sample-tf/pull/1
Fork the sample repo, open a PR that touches a
.tf file, and watch the agent post findings in under a minute.
Series Recap
Part | What | Key takeaway |
|---|---|---|
0 | Why this matters | Generators create; Reviewers enforce — they're complementary |
1 | How it works | Static rules + AI skills in ~500 lines of Python |
2 | How to use it (this post) | GitHub Action, OIDC, SARIF annotations, real results |
The agent catches resiliency issues before deployment, posts findings inline on the exact code lines, and blocks merges on HIGH-severity findings. It costs ~$0.01/review, takes ~30 seconds, and requires zero infrastructure to operate.
The gap in your CI/CD pipeline is one workflow file away from being closed.
The views expressed in this post are my own and do not necessarily reflect the position of my employer. This is a personal project shared for educational purposes.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article