Skip to content

feat(query): add OIDC trust policy misconfiguration queries for AWS IAM#8023

Open
cx-antero-silva wants to merge 2 commits intoCheckmarx:masterfrom
cx-antero-silva:aws_iam_policy_document
Open

feat(query): add OIDC trust policy misconfiguration queries for AWS IAM#8023
cx-antero-silva wants to merge 2 commits intoCheckmarx:masterfrom
cx-antero-silva:aws_iam_policy_document

Conversation

@cx-antero-silva
Copy link
Copy Markdown
Contributor

@cx-antero-silva cx-antero-silva commented Apr 1, 2026

Summary

Closes #6702

Adds two new Terraform/AWS queries to detect OIDC role trust policy misconfigurations between AWS IAM and CI/CD providers (GitHub Actions, GitLab CI, CircleCI, Bitbucket).

  • IAM Role OIDC Trust Missing Sub Condition (HIGH): Detects AssumeRoleWithWebIdentity trust policies with no condition restricting the OIDC sub (subject) claim, or a condition that only checks aud but not sub. Without this guard, any identity that can obtain a token from the OIDC provider can assume the role.

  • IAM Role OIDC Trust Wildcard Sub Condition (HIGH): Detects trust policies where StringLike is used on the sub claim with a value that wildcards the org/project segment — e.g. repo:* (any GitHub repo) or project_path:*:ref_type:branch:ref:* (any GitLab project on any branch). Allows repo:myorg/myrepo:ref:refs/heads/* as it scopes to a specific repo.

Both queries cover aws_iam_role (inline JSON heredoc) and data "aws_iam_policy_document" HCL data sources.

I submit this contribution under the Apache-2.0 license.

…AM roles

Adds two new Terraform/AWS queries addressing GitHub issue Checkmarx#6702:

- IAM Role OIDC Trust Missing Sub Condition: detects AssumeRoleWithWebIdentity
  trust policies with no condition restricting the OIDC 'sub' claim, allowing
  any identity from the provider to assume the role.

- IAM Role OIDC Trust Wildcard Sub Condition: detects AssumeRoleWithWebIdentity
  trust policies where StringLike is used with a 'sub' value that wildcards the
  repository/project segment (e.g. 'repo:*', 'project_path:*:...'), allowing
  any CI/CD pipeline on the OIDC provider to assume the role.

Both queries cover aws_iam_role (inline JSON) and aws_iam_policy_document (HCL).
Supports GitHub Actions, GitLab CI, CircleCI, and Bitbucket OIDC providers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cx-antero-silva cx-antero-silva requested a review from a team as a code owner April 1, 2026 14:32
@cx-antero-silva cx-antero-silva self-assigned this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(query): flag role + OIDC access misconfigurations between AWS and CI/CD

1 participant