Guides · ← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team · 7 min read

Infrastructure-as-Code Files in the Eval Folder: Policies Travel With the Stack

Your eval's real permissions are not in the harness. They are in the infrastructure files beside it — the ones reviewers skim and scanners read line by line.

The short answer: the infrastructure declarations are the eval's constitution: the IAM policies, network rules and storage ACLs written in Terraform, CloudFormation or raw policy JSON decide what the agent can reach, whatever the harness intends. EvalEgress reads those files as declared text and prices what they declare — admin_managed_policy and wildcard_principal at CRITICAL 25, the wildcards, open_ingress and public_bucket_acl at HIGH 15. Include the IaC in every declared set (it is where the heavy classes live), write eval infrastructure as its own module rather than a parameterised copy of production's, and verify with the free scan before the stack is ever applied.

What is infrastructure-as-code (for evals)?

Infrastructure-as-code is the practice of declaring cloud resources — roles, policies, networks, storage — in versioned text files that a tool applies. For an eval environment, the IaC files are the authoritative statement of the boundary: the role's true scope, the network's true posture, the bucket's true ACL, in a form both a reviewer and a scanner can audit before anything runs.

Why do eval IaC files drift toward production's shape?

Because they start as production's shape, minus a few edits made under deadline. The eval stack is stood up by copying the application's module and flipping the environment variable — retaining the deployment role's policy attachments, the shared network module with its demo-era ingress, the storage module whose public-read toggle exists for the marketing site. Parameterisation hides the inheritance: the files look eval-specific (every name says 'eval') while the grants say production. A declared-surface scan is the audit that reads grants instead of names, which is why including IaC in the set so often produces the report's CRITICALs — they were never in the harness to find; they were in the constitution nobody re-read.

The corrective pattern is a dedicated eval module, small enough to read in one sitting: its own role with named actions, its own network with enumerated ingress, its own storage with private defaults, outputs limited to what the harness consumes. Smallness is the security property — a 200-line module can be reviewed whole, diffed meaningfully, and scanned with findings a human can hold in their head. The production module's thousand lines cannot, and were never meant to be read by the eval's reviewers at all.

What should you check in the IaC before applying it?

The same classes, in the same order as any report — because the IaC scan is a report, taken at the cheapest moment: before the declarations become live resources. Policy attachments first (any managed admin policy referenced anywhere in the module tree), policy documents second (wildcards in actions, services and principals — including the ones inside JSON heredocs and templated strings, which reviewers' eyes slide off and pattern matching does not), network third (CIDRs, binds implied by security-group rules, resolver settings), storage fourth (ACLs and bucket policies, including the ones a shared module injects). Then the state question: IaC that manages shared state with production can reach further than its own declarations suggest, so the eval stack gets its own state, its own workspace, its own blast radius — separation the module layout should make visible at a glance.

Apply-time is also when declared-versus-live drift begins, and the scan's role continues after apply: the declared set remains the eval's constitution of record, console changes get written back into it or flagged by the next comparison, and the CI diff watches the text for new exposures between applies. IaC's gift to security is that the boundary is text; the discipline is keeping the text true.

How do shared modules fit an eval boundary?

Carefully, and usually less than teams assume. A shared network or storage module carries parameters whose defaults were tuned for the application's needs — an ingress default, a public toggle, a policy attachment list — and every default is a decision the eval inherits without making. Where a shared module is genuinely warranted (the organisation's hardened logging baseline, say), pin it, read the version being pinned as part of the eval's review, and pass every security-relevant parameter explicitly so the eval's declarations show their own values. Defaults you cannot see in the eval's files are declarations your scan cannot read — the set is only complete when the effective policies are materialised in it, which for templated stacks means scanning the rendered output, not only the templates.

That last point generalises beyond IaC: anywhere the effective declaration is generated — Helm values rendered, policies assembled by a script — the declared set for scanning is the generated artefact. Scan what will run, in the form it will run in, or accept a no_evidence about the layer you templated away.

Worked example: Aldercroft Systems, scored end to end

Example. Aldercroft, a fictional systems integrator, parameterised its application stack for a client eval: same modules, env = eval. The pre-apply scan of the rendered declarations — run as a habit by one engineer — stopped the apply:

FindingClassSeverityWeight
AdministratorAccess attached via the shared role moduleadmin_managed_policyCRITICAL25
Wildcard principal in the shared storage module's bucket policywildcard_principalCRITICAL25
Ingress open to 0.0.0.0/0 from the shared network module's demo ruleopen_ingressHIGH15
The 0.0.0.0 in that rule also matches the all-interface patternopen_bindingMEDIUM8

The arithmetic: 25 + 25 + 15 + 8 = 73 points of exposure, so the score is 100 − 73 = 27/100, grade D. Scoring uses EvalEgress's published weights — CRITICAL 25, HIGH 15, MEDIUM 8, LOW 3 — with grades at A ≥ 90, B ≥ 75, C ≥ 50 and D ≥ 25.

Every finding traced to a shared module's default rather than to anything the eval team had written. The eval stack was re-founded on a dedicated 180-line module — own role (eight named actions), own network (runner-range ingress), own storage (private, named grants) — and the rendered output of that module became the declared set. Its scan reported zero findings. The shared modules were fixed at the source over the following month, with the eval's report as the evidence that their defaults had production consequences the module authors had never intended.

Govern the eval's constitution: the five actions

Small module, rendered truth, scanned before apply:

  1. Give the eval its own small IaC module. Own role, own network, own storage, readable in one sitting — inherited production modules import production grants under eval names.
  2. Scan the rendered declarations before every apply. Templated and generated policies materialised: what will run is what gets scanned, heredocs and injected defaults included.
  3. Check in weight order: attachments, documents, network, storage. Admin references and wildcard principals hide in module trees and JSON strings; read the scan's CRITICALs before anything is applied.
  4. Separate state and workspace from production's. The eval stack's blast radius is its own; shared state is a reach the declarations alone will not show, so layout must make it visible.
  5. Keep the text true after apply. Console changes are written back to the IaC or flagged at the next comparison; the CI diff watches the constitution between applies.

The IaC is where the boundary is written down — make it short, make it the eval's own, and scan it like it matters, because the classes it carries are the heaviest in the scoring table.

Keep checking the boundary

Run the free exposure scan on the files your next eval will run with. Compare plans, read the scoring documentation, and keep reading: what is eval-to-production exposure?, what is egress in AI evaluation?, pre-deployment eval safety checklist, how to stop an AI evaluation from reaching production secrets, Docker and Compose configs in eval setups, credentials in CI configuration for evals, re-scanning eval configs and drift. EvalEgress is one of the Ingenious AI platforms.

Sources

Frequently asked questions

Our IaC is templated — what exactly should we scan?
The rendered output: the effective policies, rules and ACLs as they will be applied. Templates hide defaults; rendered declarations expose them, and the scanner prices what will actually exist.

Is a dedicated eval module not just duplicated effort?
It is the opposite: a small module is reviewable, diffable and scannable in a way a parameterised production stack never is. The duplication is of structure; the grants — the part that matters — are deliberately different.

The wildcard came from a vendor module. Can we still fix it?
Yes — override or replace the specific resource in your module, and report it upstream. You own the applied result regardless of authorship; the declaration in your stack is your boundary.

Should eval IaC and app IaC share state for convenience?
No. Separate state is the eval stack's blast-radius boundary; shared state lets an eval-side apply reach resources its own files never mention, defeating the declared-set model.

When should the IaC scan happen in the pipeline?
Before apply, as a gate on the rendered plan — the cheapest moment a CRITICAL can be caught is when it is still text. The CI verdict pattern applies to IaC changes exactly as to harness configs.