Dev.to Security 🔐 Cybersecurity 👁 0 📖 12 min read

Checking your infrastructure settings for gaps

This is part 8 of the series "Protect Your Own Service Yourself — Self-Defense Security in the Age of AI." Do the checks you can yourself; when it's hard, EarthLink Network can run the assessment for you, and fix the gap

Checking your infrastructure settings for gaps

This is part 8 of the series "Protect Your Own Service Yourself — Self-Defense Security in the Age of AI." Do the checks you can yourself; when it's hard, EarthLink Network can run the assessment for you, and fix the gaps you can't fix on your own.

Series contents

  1. Anyone can attack now, with AI — check your own site first
  2. What attackers now hold: when AI runs the attack itself
  3. Before you start: the whole picture of checking, and how to test without breaking production
  4. Testing from the outside (1): setup and the first run
  5. Testing from the outside (2): attack tools and legitimate scanners find different things
  6. Checking the code you wrote: static analysis
  7. Checking the parts you depend on: libraries and packages
  8. Checking your infrastructure settings for gaps (this article)
  9. Collect every result in one place and decide what to fix first (coming soon)
  10. How to fix what you found: three ways (coming soon)
  11. When you cannot fix it yourself: a maintenance contract (coming soon)
  12. Keep checking automatically every day — from building to protecting (coming soon)

The short version

Trivy reported 19 problems in the settings of the three storage buckets behind our production service. Fifteen were one complaint, "no public access block," and the setting was there all along. The export tool never wrote it down, so the scanner assumed it was missing. A scanner's count is not your count of gaps.

Our service, promptflow, was built with AWS CLI commands and shell scripts. There is no Terraform and no AWS CDK, and most infrastructure scanners read exactly those files. So we tried three read-only paths with free tools:

  1. Scan the deployment pipeline. zizmor, Checkov, and Trivy on 27 GitHub Actions workflows. zizmor showed 133 findings. Two of its five high-severity injection findings were real; we fixed them, plus a missing permissions block that Checkov flagged too, and pinned the five third-party actions.
  2. Write the live settings out as code, then scan. Terraformer exported our three S3 buckets; that is where the 19 came from.
  3. Scan the whole account. Prowler ran all 655 checks under a role that reads settings but not data.

None of our three buckets could be read, written, or listed by the public.

Why settings matter on their own

Your code can be clean and your dependencies patched, and a single setting can still expose data. The common ones:

  • Storage anyone can read. A misconfigured S3 bucket serves its contents to the whole internet. Leaks like this keep happening, worldwide.
  • Permissions wider than the job. If a program or person has more access than they need, a stolen access key does more damage.
  • Missing encryption. Unencrypted data is readable as-is by anyone who gets into the storage.
  • Missing logs. Without a record of who did what, you can't reconstruct an incident afterwards.

None of these involve a bug in your code, which is why they need a check of their own, separate from the code scan in Part 6 and the dependency scan in Part 7.

Path What it checks Tools (all free) Where we ran it
1. Scan the pipeline How the deployment is written zizmor, Checkov, Trivy Our Mac, on a copy of the workflow files
2. Export and scan Current values of live settings Terraformer, then Checkov and Trivy Our Mac, S3 only
3. Read-only account scan Settings across the whole account Prowler GitHub Actions, with a settings-only role

Nothing in production was changed. Path 1 never touched AWS. Paths 2 and 3 read from AWS and wrote nothing.

Path 1: scan the deployment pipeline

A deployment pipeline has direct access to production. Our GitHub Actions workflows receive AWS credentials and the right to ship code. If someone can tamper with a workflow, they can ship whatever they like or walk away with the credentials. That makes the pipeline part of your infrastructure.

zizmor

zizmor is a free, MIT-licensed scanner for GitHub Actions workflows. It is distributed as a Python package; we installed it with pip. You point it at the workflow folder:

zizmor .github/workflows

zizmor scanning promptflow's deployment workflows. The first line shows zizmor v1.30.1. One file, chromatic.yml, failed the format check; the other 26 were audited. In the middle: test-portal-reingest.yml line 62 inserts a manual-run input straight into a shell command (error[template-injection]), and the job in deploy.yml has no permissions block ("default permissions used due to no permissions: block"). The last line: "352 findings (219 suppressed, 30 unsafe fixes): 13 informational, 20 low, 3 medium, 97 high".

352 findings, 219 suppressed by the tool's defaults, 133 shown: 97 high, 3 medium, 20 low, 13 informational. (In the terminal images in this part, the output lines are exactly as they appeared; the command lines were written in afterwards to match that output.) That sounds alarming until you group them:

Audit Count What it means
unpinned-uses 80 An action is referenced by a movable tag such as @v7 instead of a commit hash
template-injection 18 (5 high, 13 informational) An outside value is pasted straight into a shell command
artipacked 11 The checkout step leaves GitHub credentials in the workspace
cache-poisoning 9 A release workflow uses a shared cache
adhoc-packages 6 A package is installed outside the lockfile
excessive-permissions 4 Permissions broader than needed, or none set
other 5 Secrets passed wholesale to another workflow (2), and so on

The 80 unpinned references are worth understanding. A tag like v7 can be moved by whoever controls the action's repository. If that account is compromised, the tag can point to new code, and every workflow that uses it runs that code. This happened in March 2025, when the popular action tj-actions/changed-files was compromised and secrets were exposed in workflow logs.

The CISA alert page. Headline: "Supply Chain Compromise of Third-Party tj-actions/changed-files (CVE-2025-30066) and reviewdog/action-setup@v1 (CVE-2025-30154)." The highlighted text says the popular action tj-actions/changed-files was compromised and the compromise allows disclosure of secrets including valid access keys, GitHub personal access tokens, npm tokens, and private RSA keys.

In our case, 75 of the 80 were GitHub's own actions (actions/checkout and friends). Only 5 came from other publishers: two for uploading to Google Play, two from AWS, one for Android. We pinned those five to full commit hashes. zizmor's defaults ask you to pin everything, including GitHub's own actions. We chose to keep GitHub's own actions on version tags and pin only third-party ones.

Real, or not? Check who controls the value

We then went through the five high-severity template-injection findings one by one, with the workflow open:

  • Real (2): test-portal-reingest.yml, lines 62 and 96. A manual-run input went straight into a shell command without any check. Only people with write access to the repository can start a manual run, so this was not open to the world, but it was still worth fixing. We now pass the input through an environment variable and read it from there.
  • Blocked earlier in the job (2): rollback.yml, lines 166 and 173. The same kind of input, but an earlier step in the same job (line 77) stops the run unless the value looks like 1.2.3. The scanner doesn't follow that earlier check.
  • No way for an outsider to supply the value (1): staging-e2e.yml, line 116. The value is a commit hash, and the workflow runs only when started by hand or when our tag-triggered release workflow (deploy-on-tag) finishes; both require write access.

The two questions that decide it: who controls the value, and is it validated before use? A scanner matches patterns; it can't answer either question for you.

Checkov and Trivy on the same folder

Top: Checkov 3.3.30. "github_actions scan results" with "Passed checks: 1661, Failed checks: 11". The first failure is CKV_GHA_7 (workflow_dispatch inputs must be empty) in deploy-on-tag.yml; the last is CKV2_GHA_1 (top-level permissions not write-all) in deploy.yml. Bottom: Trivy 0.74.0 config scan. Every cell in the Target, Type and Misconfigurations columns is "-", and the legend says "'-': Not scanned".

Checkov passed 1,661 checks and failed 11. Ten are the same rule: manual-run inputs should be empty. That rule comes from a strict build-provenance standard. The ten workflows it flagged (deploy, rollback, changelog, test-result re-ingest and others) take what to work on as a manual-run input on purpose, so having an input is intended. How an input is used is a separate question: where it was pasted into a command unchecked, as in test-portal-reingest.yml, we fixed it as described above.

The eleventh is deploy.yml with no permissions set, the same spot zizmor flagged. That workflow only calls a webhook and doesn't need the GitHub token at all, so we added permissions: {}. When two independent tools point at the same line, take it seriously.

After the fixes, we ran zizmor again: the injection findings in the fixed workflow and the unpinned third-party actions were gone.

Watch the Trivy result. "0" means scanned and clean. "-" means not scanned. Trivy's config scanner reads Terraform, Dockerfiles, Kubernetes manifests and the like, not GitHub Actions workflows or shell scripts. Our pipeline folder had nothing it could read. Mistaking "-" for "0" is how you end up trusting something nobody checked.

Path 2: write the live settings out as code, then scan them

If there are no settings files, make some. Terraformer (Apache-2.0) reads your current cloud resources and writes them out as Terraform files, which Checkov and Trivy can then scan.

One caution first: the official Terraformer repository was archived by its owner in March 2026 and is now read-only. It still works, but don't expect it to keep up with new cloud features. We hit exactly that kind of gap.

The official Terraformer repository on GitHub. The yellow banner at the top reads "This repository was archived by the owner on Mar 16, 2026. It is now read-only." The About panel describes a CLI tool to generate Terraform files from existing infrastructure, under the Apache-2.0 license.

Step 1: give it read-only credentials and import

Terraformer queries AWS, so it needs credentials. Give it read-only ones; there is no reason for an import tool to be able to change anything.

Our first run failed because no credentials reached it. "no EC2 IMDS role found" means it looked everywhere and found none. If you see that, fix how the credentials are passed in.

Terraformer 0.8.24. The first run fails with "aws error initializing resources in service s3, err: failed to refresh cached credentials, no EC2 IMDS role found". The second run with credentials reports "Number of resources for service s3: 45", reads the 4 promptflow lines (promptflow-logs-prod, promptflow-amplify-artifacts, promptflow-artifacts), and ends with "aws save s3" and "aws save tfstate for s3". The other products' 41 lines are left out and the account number is masked with *.

The second run read 45 S3 resources. Our AWS account is shared with other products, so most of those were not ours. We kept the 4 whose names contain promptflow (3 buckets and 1 bucket policy) and scanned only those. In a shared account, narrowing to your own service is a required step, not a nicety. This export covers S3.

An excerpt of the s3.tf Terraformer wrote, for the promptflow-artifacts bucket (lines 30–31, 43–47 and 126–148): a grant giving the owner FULL_CONTROL, access logging sent to the log bucket (logging with target_bucket = "promptflow-logs-prod"), encryption with sse_algorithm = "AES256", and versioning enabled = "true". There is no public access block setting anywhere in the file. The account number and owner ID are masked with *.

Step 2: scan the written-out files

checkov -d pf-only
trivy config pf-only

Checkov 3.3.30 on the written-out settings: "Passed checks: 21, Failed checks: 16". The 16 failures, extracted: no access logging (CKV_AWS_18) ×2, no lifecycle configuration (CKV2_AWS_61) ×1, no public access block (CKV2_AWS_6) ×3, no event notifications (CKV2_AWS_62) ×3, not encrypted with KMS by default (CKV_AWS_145) ×3, no cross-region replication (CKV_AWS_144) ×3, versioning off (CKV_AWS_21) ×1. Resource names are left out.

Trivy 0.74.0 on the same file. The summary shows 19 for s3.tf, "Tests: 19 (SUCCESSES: 0, FAILURES: 19)" and "Failures: 19 (UNKNOWN: 0, LOW: 4, MEDIUM: 1, HIGH: 14, CRITICAL: 0)". The first finding is AWS-0086 (HIGH) "No public access block so not blocking public acls". After a gap, AWS-0090 (MEDIUM) "Bucket does not have versioning enabled" points at line 212 of promptflow-logs-prod, enabled = "false".

Fifteen of Trivy's 19 are one issue counted five ways across three buckets.

Step 3: decide, finding by finding

No public access block (Checkov 3, Trivy 15): produced by the export. Open the written-out file and the setting isn't there at all. Terraformer's S3 import writes buckets and bucket policies; it does not write the public access block. The scanners are reporting the absence of something that was never exported. Our deployment script, meanwhile, turns all four public access block settings on when it creates the log bucket:

promptflow's deployment script infra/jobs/configure-s3-access-logging.sh, lines 145–149: aws s3api put-public-access-block with BlockPublicAcls=true, IgnorePublicAcls=true, BlockPublicPolicy=true, RestrictPublicBuckets=true. The script's Japanese comments are left out of this image.

The other two buckets aren't covered by that script, and AWS documents that new buckets block public access by default. We didn't settle it on the script and the docs alone; we read the real values. Both Prowler (path 3) and the AWS CLI (aws s3api get-public-access-block) showed all four settings on for all three buckets. All 18 of these findings were false positives. If you use the export route, the public access block isn't in the export, so read it separately with the AWS CLI.

The checks that look for a public-read or public-write ACL (CKV_AWS_20, CKV_AWS_57) passed for all three buckets, and the check for a policy that allows any principal (CKV_AWS_70) passed on the log bucket, the only one with a policy. That policy lets only the S3 logging service write, and only logs coming from promptflow buckets in our own account.

The rest: logging, intended settings, and choices

No access logging (Checkov 2, Trivy 1): a per-bucket check; the one on the log bucket is intended. Access logs record who read or wrote what, and when. A service runs fine without them, which is exactly why they get missed. The tools flag each bucket that has no logging block. Without those logs there is nothing to trace after an incident, so the fix for a flagged bucket is to send its access logs to a dedicated log bucket. promptflow's logging script is built to do this for buckets whose names start with promptflow-. The exception is the log bucket itself: the script deliberately skips it, because logging the log bucket generates logs about logs forever.

Versioning off (Checkov 1, Trivy 1): intended. Only the log bucket has it off, and that bucket exists to expire logs after 90 days.

Not encrypted with a customer-managed key (Checkov 3, Trivy 2): a choice, not a gap. All three buckets are encrypted with AWS-managed keys (AES256), and the basic encryption check (CKV_AWS_19) passed for all three. The tools want KMS keys you manage yourself. As Trivy's own text notes, a server-access-log destination bucket can't use that, so Checkov's finding on the log bucket doesn't apply.

No lifecycle rule, event notifications or cross-region replication (Checkov 7): not security gaps for us. Those are about cost and resilience.

Out of 35 findings across both tools, the most frequent one, "no public access block" (18 findings), turned out to be all on once we read the values. The rest were intended settings, cost and resilience choices, and the per-bucket logging check. Scanner counts are not gap counts.

Path 3: scan the whole account, read-only

The third path lets a tool read the account's settings directly: IAM, logging, encryption, bucket exposure, network rules. No export step, so nothing gets lost in translation.

Prowler is a common choice. Its CLI is Apache-2.0, and its pricing page says so plainly. The paid Prowler Cloud ($99 per cloud account per month) adds scheduling, dashboards and integrations; the checks themselves are free.

The official Prowler pricing page. Under OPEN SOURCE, highlighted: "Prowler Open Source is free, forever." Below: the Apache-2.0 CLI, SDK and self-hosted Local Server run every check on every provider, from your terminal, CI/CD or from inside Kubernetes.

Why we stopped the first run

We first started Prowler with a role named ReadOnlyAccess that was already at hand:

Prowler 5.45.0 starting. Under "Using the AWS credentials below": the profile ReadOnlyAccess, region us-east-1, and the account number (masked with *). The last line is "Executing 165 checks, please wait...". We stopped this run right after it started.

We stopped it right away, for two reasons.

First, "read-only" is wider than it sounds. AWS's managed ReadOnlyAccess policy includes s3:Get*, which means it can read the contents of files in your buckets, not just their settings. A scanner needs settings, not customer data. Prowler's own documentation asks for SecurityAudit and ViewOnlyAccess (plus a small extra read-only policy for some checks). SecurityAudit, on the S3 side, reads configuration and does not include s3:GetObject.

Second, the account is shared, so results would mix in other products' resources.

A settings-only role, run to the end

We built the dedicated role for GitHub Actions. It has exactly two policies attached, SecurityAudit and ViewOnlyAccess, and not ReadOnlyAccess. Each run, GitHub Actions assumes the role through OIDC and receives credentials that last at most one hour. There is no long-lived access key to store, so there is no stored key to leak. Only workflows in our blog's repository can assume the role.

With that role, Prowler ran all 655 checks across every region except two, in about 49 minutes.

The top of the Prowler 5.45.0 report. Report Information shows version 5.45.0 and the run time, and Audited Regions reads "All Regions" (the report says All Regions, but the run excluded two regions); AWS Assessment Summary shows the account (masked with *); AWS Credentials shows the User Id and Caller Identity ARN of a role assumed as GitHubActions (role name and account masked with *).

The report covers the whole account, so we filtered it to promptflow. First, the question path 2 couldn't answer: the public access block. All three buckets passed.

The Prowler report filtered to the check s3_bucket_level_public_access_block. Three rows, one per promptflow bucket, all PASS. Status Extended says Block Public Access is configured for each bucket. Account numbers at the end of bucket names are masked with *.

Then the checks Prowler rates critical: can anyone write to, read, or list the bucket? Three buckets times three checks, nine rows, all PASS.

The Prowler report filtered to checks starting with s3_bucket_public. For the three promptflow buckets: not publicly writable, not public, not publicly listable. Nine rows, all PASS, all rated critical. Account numbers at the end of bucket names are masked with *.

In the same workflow, we also read the three buckets with the AWS CLI (aws s3api get-public-access-block), separately from Prowler: all four settings true on each. Getting the same answer from a second, independent read is what keeps an export gap like the one in path 2 from sending you in circles.

What we don't turn on

AWS Config, Security Hub and Inspector watch your settings continuously, and they bill by usage. In this series we stick to what we can do at no cost: free tools, read-only, run when we need them.

What each path sees

Path Sees Misses
1. Scan the pipeline How the deployment is written: permissions, injected values, how actions are referenced What is configured right now
2. Export and scan Current values for whatever was exported Anything the export leaves out (here, the public access block)
3. Read-only account scan Current values across the account How the pipeline is written; needs a dedicated role first

No single path covers it all. Path 1 checks how things are written; paths 2 and 3 check current values. Given that Terraformer is archived, our approach is to use path 3 for current values and keep path 2 as a starting draft if we ever move to infrastructure-as-code.

Next

Part 9 brings every result from this series into one place and decides what to fix first: outside-in testing, our own code, our dependencies, and the infrastructure settings from this part. Results from different tools come in different shapes; we line them up and rank them by severity, how easy they are to exploit, and whether they can be reached from outside.

In this series, in an age when attack tools are free and one click away for anyone, I show step by step how to check your own service yourself and close the gaps before someone else finds them. The target is always our own service; the series does not cover attacking anyone else's site.
If running the checks yourself is hard, EarthLink Network can do the assessment for you. Found a gap you can't fix? We'll handle the fix. Feel free to reach out.
If this was useful, please like and follow.

Our products are listed at https://www.eln.ne.jp/products

EarthLink Network builds its own products to run the whole company on AI — each one born from a need along the way. See the full index of what we build:

→ The 18 products EarthLink Network builds in-house

For more about the company and each product, visit www.eln.ne.jp.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.