Introducing a new way to review your PRs.

Read the announcement

affaan-m / agentshield

AI agent security scanner. Detect vulnerabilities in agent configurations, MCP servers, and tool permissions. Available as CLI, GitHub Action, ECC plugin, and GitHub App integration. 🛡️

View on GitHub

20 documents · Updated Sep 11, 2026

docs / policy-governance

Policy governance

AgentShield policy governance turns scan findings into repeatable security decisions. It lets a team define an approved posture, check each scan against that posture, compare new work with an accepted state, map findings to audit controls, and move stricter policy into use through a reviewed path.

Governance model

Security posture is the set of conditions that a team accepts for its agent configuration. AgentShield represents that posture through two related controls: policies judge whether the current state meets a rule set, while baselines show how the state changed from an accepted scan.

These controls answer different questions:

ControlMain questionDecision
PolicyDoes this scan meet the organization’s required posture?Compliant or non-compliant
BaselineDid this change introduce security drift?Passed or failed gate

Policy, baseline, and compliance checks can use the same scan findings. A policy sets the target state. A baseline protects the path toward that state by making new risk visible. A compliance report organizes the findings as control coverage for review.

Security assessment lifecycle

The governance flow starts with one scan result and then applies policy, change, and compliance checks before it produces a status for a developer or CI system. This keeps the security report, the decision, and the enforcement result tied to the same assessed state.

This diagram shows how one finding set produces separate governance signals for enforcement and review.

flowchart LR
    A[Configuration target] --> B[Scan findings and score]
    B --> C{Policy check}
    B --> D{Baseline comparison}
    B --> H{Compliance mapping}
    C --> E[Compliance decision]
    D --> F[Drift decision]
    H --> I[Control coverage]
    E --> G[CI or review outcome]
    F --> G
    I --> G

Scan results

The scan produces findings with a severity, category, location, and evidence. It also produces a numeric score and grade that summarize the assessed posture. Policy, baseline, and compliance checks use the findings selected by the scan’s severity threshold, so that threshold is part of the meaning of a governance result. References: src/types.ts• L15-28, src/types.ts• L100-118, src/index.ts• L320-332

Policy decisions

An organization policy defines the minimum score and the configuration conditions that must hold. The conditions can cover finding severity, denied permissions, banned tools and MCP servers, and required hooks. A scan passes when no unsuppressed violation remains.

Policy exceptions provide a controlled way to accept a known gap for a named owner and reason. Each exception has an end time. Active exceptions can remove a matching violation from the decision, while expired exceptions become violations and remain visible in the audit summary. See Policy evaluation and promotion for the policy data and decision flow. References: src/…/types.ts• L28-70, src/…/types.ts• L76-98, src/…/evaluate.ts• L52-176

Baseline decisions

A baseline is a saved picture of findings and score at an accepted point in time. A later scan compares its finding identities and score with that picture. The result separates new, resolved, and unchanged findings and records whether the score moved up or down.

The baseline gate turns that comparison into an enforcement choice. By default, new findings are not allowed, a score drop of more than five points fails the gate, and new critical or high findings fail it. See Baselines and fingerprints for finding identity and comparison rules. References: src/…/types.ts• L5-20, src/…/types.ts• L24-36, src/…/types.ts• L40-52, src/…/compare.ts• L72-123, src/…/compare.ts• L143-177

Compliance assessment

Compliance assessment turns findings into control coverage for a selected framework. The current mapping supports SOC 2, PCI DSS, and ISO/IEC 27001, and links each finding category to one or more control IDs. It reports mapped and unmapped findings so a reviewer can see both the covered risk and the gaps in the mapping.

The report groups findings under controls and preserves finding count, severity counts, highest severity, and up to three example titles. This makes the result useful as audit evidence while keeping its scope clear: the mapping is category-level security guidance, not a certified crosswalk or a final auditor decision. See Compliance assessment for the assessment flow and report meaning. References: src/…/index.ts• L13-21, src/…/index.ts• L70-87, src/…/index.ts• L114-167, src/…/index.ts• L179-211, tests/…/compliance.test.ts• L22-86, tests/…/compliance.test.ts• L103-117

Approved posture levels

Teams can start with a policy that matches their risk and then move toward a stricter approved posture. The available policy packs express common starting points rather than replacing the team’s ownership and review process.

Policy packs

Policy packs provide named posture choices for public repositories, shared team work, managed enterprise groups, regulated environments, high-risk hooks or MCP use, and CI enforcement. The packs raise score or configuration requirements as assurance needs grow. Teams can generate a pack with a policy name and owners, then adapt it to local needs.

The pack choice is part of the policy result. It gives reviewers a shared label for the level of protection that the scan was expected to meet. References: src/…/types.ts• L19-24, src/…/presets.ts• L37-68, src/…/presets.ts• L87-141

Policy promotion

Promotion moves a chosen policy pack from an exported policy bundle into the active policy path. The bundle includes a manifest and checksum for each policy. Promotion verifies the selected pack before it writes the active policy, or it can run as a dry run to review the evidence without changing enforcement.

Promotion also reports whether owners exist, whether the protected rollout path is in place, and whether a runtime smoke test still needs action. This makes a stricter posture an approved change rather than an untracked file replacement. See Policy evaluation and promotion for the detailed promotion flow. References: src/…/export.ts• L7-27, src/…/export.ts• L29-66, src/…/promote.ts• L20-39, src/…/promote.ts• L62-119, src/…/promote.ts• L134-179

Posture change control

Governance uses policy to define what must be true and baseline comparison to control how the system gets there. A team can first record an accepted baseline, fix or review its findings, and then promote a policy pack when the owners agree that the new rules are ready for enforcement.

When a change is assessed, policy violations and baseline regressions remain separate signals. A change can meet the current policy and still introduce drift against the accepted baseline. It can also preserve the baseline while failing a newly stricter policy. Keeping both signals lets reviewers distinguish improvement, accepted risk, and new risk.

The CLI and GitHub Action expose these decisions as statuses, counts, score changes, and exit codes. CI can therefore block a change on policy failure, baseline regression, or an incomplete promotion review without treating those outcomes as the same event. References: src/index.ts• L349-386, src/index.ts• L433-465, src/action.ts• L244-371, action.yml• L30-45, action.yml• L66-85, action.yml• L98-113, action.yml• L142-151

Governance records

The governance outputs provide the evidence needed for a review. A policy result records the policy name, pack, owners, score, violations, applied exceptions, and exception life cycle. A baseline result records its source time, score change, finding changes, and gate reasons. A compliance report records framework control coverage, finding totals, severity, and examples. These records support a decision without requiring a reviewer to reconstruct it from raw scan output.

The evidence pack can carry both policy and baseline results for audit or security review handoffs. Its role is to preserve the decision context around a scan, not to replace the policy or baseline that defines the decision. References: src/…/types.ts• L88-131, src/…/types.ts• L24-60, src/action.ts• L498-523

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep policy pack identifiers aligned across the policy schema, generated pack set, export manifest, and promotion selector. A mismatch can prevent a bundle from being selected or promoted.
  • Keep the policy file’s declared pack and the manifest entry’s pack and checksum aligned. Promotion rejects a bundle when either the content digest or pack identity changes.
  • Treat the scan severity threshold as part of a baseline or policy decision. Changing that threshold changes which findings reach both governance checks.
  • Keep exception expiry and audit output aligned. An exception that passes today can become a policy failure when its end time passes.
  • Keep policy and baseline status outputs aligned with their gate behavior so CI consumers do not read a passing status while the action exits with failure.
  • Keep finding categories aligned with the compliance control map. A new category can become unmapped and reduce the coverage shown to reviewers without changing the finding itself.
  • Keep framework selectors aligned with the supported framework identifiers. An unknown selector produces no compliance report rather than a partial match.

Important failure modes

TriggerConsequenceGuard
Policy file is missing or invalidPolicy status is error; enforcement can fail the runValidate the policy before relying on its result
Export manifest checksum does not match the policy filePromotion stops and the active policy is not writtenTreat the manifest and exported policy as one reviewed bundle
Promotion runs only as a dry runThe active policy remains unchanged; the rollout review still needs actionUse a protected promotion path after review
Exception is expiredThe exception no longer suppresses its gap and an expired_exception violation is addedRenew or remove the exception before its end time
Baseline file is missing or unreadableDrift comparison is skipped and status is missingStore the baseline at a stable, readable path
New critical or high finding enters the baseline comparisonThe default baseline gate failsReview the finding before accepting a new baseline
Compliance selector contains only unknown framework namesNo framework is selected and no control coverage is producedUse soc2, pci, iso, or all
Finding category has no framework mappingThe finding remains in the total but is counted as unmappedReview unmapped findings before treating coverage as complete

Key files

FileWhy to read it
src/index.tsShows how the CLI orders scan, policy evaluation, baseline comparison, and gate decisions.
src/action.tsShows how the same governance signals become GitHub Action outputs, summaries, and exit results.
src/…/types.tsDefines the shared policy, exception, violation, and evaluation concepts.
src/…/evaluate.tsExplains how a scan becomes a policy decision and how exception life cycles affect it.
src/…/presets.tsShows the posture levels that teams can use as policy starting points.
src/…/export.tsDefines the checksum-backed policy bundle used before promotion.
src/…/promote.tsDefines verification, dry-run review, and movement into the active policy path.
src/…/compare.tsExplains how accepted findings become drift and gate results.
src/fingerprint.tsDefines the stable identity used to tell the same finding from a new or resolved finding.
src/…/index.tsDefines framework selection, finding-to-control coverage, and the audit report disclaimer.
tests/…/compliance.test.tsShows the expected framework mappings, aggregation, selector behavior, and report shape.
action.ymlLists the CI inputs and outputs that make policy and baseline decisions enforceable outside the CLI.