New: Access Diff now reviews Terraform pull requests on GitHub

Access Diff

See which identities gain, lose or change access to resources in a pull request, before you merge.

Access Diff compares the access a proposed infrastructure change would create with the access that exists today. It reports the difference as added, removed and changed access paths, attached to the pull request that introduces them. The aim is to put the access consequence of a change in front of the reviewer, next to the code.

How it works

  1. Read the proposed change. When a pull request that changes Terraform or OpenTofu is opened or updated, AccessRoot analyzes the proposed plan. It identifies the identities, roles, permissions and trust relationships being modified.
  2. Resolve the access path. AccessRoot evaluates those changes against the connected cloud environment. It follows the relationships between identities, assumable roles, permissions and resources to determine what the proposed state would make reachable.
  3. Compare and explain. Access Diff compares the proposed access with the current access. It highlights added, removed and changed paths, identifies the sensitive resources affected and links each finding to the code responsible.

The result is published as a check on the pull request. For GitHub, the check is named AccessRoot / Access Diff. See GitHub and GitLab for the workflow in each system.

Example: a trust relationship

Pull request #187 in halvorne/platform-infra changes infra/iam/data-access.tf. It adds ci-deploy-role to the trust policy of data-maintenance-role, which is the role that can write to the CustomerRecords table.

Principal = { AWS = [
+       aws_iam_role.ci_deploy.arn,
        aws_iam_role.ops_maintenance.arn,
] }

Access Diff reports a critical finding, “New production write path”. The reasons it gives are that a sensitive production resource becomes newly reachable, through an indirect path involving an existing privileged role and a machine identity. The permission on the table did not change. Who can reach it did.

Anatomy of a finding

A severity label tells you something needs attention. It does not tell you enough to decide. Each finding answers five questions.

Question What the finding shows
Who gained access? The human or machine identity affected, such as the deploy.yml workflow
What can it reach? The resources, privileges and actions that become available, such as dynamodb:PutItem on CustomerRecords
How is the access possible? The chain of roles, trust relationships and permissions connecting the identity to the resource
Why does it matter? The privilege level, resource sensitivity and other signals behind the priority
Where did it come from? The infrastructure file, the pull request and the responsible team

Each finding also states a recommended review. For #187, that is to confirm whether the deployment role requires the relationship, and if not, to narrow the proposed trust policy. From the finding you can open the access path, review the source change or explore a remediation.

Not every change is a problem

Access Diff considers resource sensitivity, privilege level, identity type and reachability, so the findings on a pull request are not all treated alike. Typical outcomes are:

  • A new write path from a CI/CD identity to a sensitive production database. This is a critical finding.
  • An analytics workload gaining read access to a non-production resource. This is a lower-priority finding.
  • A legacy deployment role being removed, so that an unused path to a production resource is no longer reachable. This is reported as removed access.

See Prioritization for how the levels are set.

Example: a permission added by mistake

The same pattern applies to resource permissions. A different pull request, #184 in the same repository, edits infra/aws/iam/export-worker.tf. Its stated goal is to let the export-worker Lambda function write export files, and the proposed export-bucket-access policy does that by adding s3:PutObject. It also adds s3:DeleteObject on arn:aws:s3:::customer-exports-prod/*.

Action Current Proposed Suggested fix
s3:GetObject Granted Unchanged Unchanged
s3:PutObject Not granted Added, intended Retained
s3:DeleteObject Not granted Added, needs review Removed

Access Diff shows the path (export-worker runs as export-worker-role, which has the export-bucket-access policy, which grants the actions on the bucket objects) and flags s3:DeleteObject as a destructive capability that needs a reason. The suggested change keeps s3:PutObject, removes s3:DeleteObject and arrives through the same pull request workflow. The finding is labeled as projected from the policy change, because effective access may also depend on other AWS controls.

PR #184 and PR #187 are unrelated changes. They are used here only because each shows a different kind of finding.

What to do with a finding

  1. Open the finding and read who gains access and how.
  2. Decide whether the path is intended. If it is not, change the code in the same pull request and push. The analysis runs again.
  3. If the path is intended, approve it through your normal review. The record stays attached to the pull request.
  4. If you need a narrower change, use Remediation.

What Access Diff does not say

  • It describes newly reachable authorization paths. It is not proof that anyone used the access.
  • It models the expected change in authorization. It cannot guarantee how every application dependency will behave.
  • It does not decide. Your repository rules determine whether a failing check blocks the merge.