Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(terraform): CKV_AZURE_249 & CKV_AWS_358 - better support for OIDC 'repo' detection regex and conditions order #6994

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

aviadhahami
Copy link
Contributor

@aviadhahami aviadhahami commented Feb 4, 2025

User description

Description

Fixes


Generated description

Below is a concise technical summary of the changes proposed in this PR:

Enhances OIDC support for GitHub Actions in AWS and Azure. Improves the gh_repo_regex in oidc_utils.py to better match GitHub repository naming conventions. Modifies the GithubActionsOIDCTrustPolicy check in AWS to handle multiple conditions and their order. Updates test files to reflect these changes and adds new test cases for special characters in repo names.

TopicDetails
OIDC Regex Update Improves the GitHub repository regex pattern in oidc_utils.py to support more complex repository names
Modified files (1)
  • checkov/common/util/oidc_utils.py
Latest Contributors(1)
UserCommitDate
ahahami@paloaltonetwor...feat-terraform-Update-...January 22, 2025
Trust Policy Check Enhances the GithubActionsOIDCTrustPolicy check for AWS to handle multiple conditions and their order
Modified files (5)
  • tests/terraform/checks/data/aws/example_GithubActionsOIDCTrustPolicy/main.tf
  • tests/terraform/checks/resource/azure/test_GithubActionsOIDCTrustPolicy.py
  • checkov/terraform/checks/data/aws/GithubActionsOIDCTrustPolicy.py
  • tests/terraform/checks/resource/azure/example_GithubActionsOIDCTrustPolicy/main.tf
  • tests/terraform/checks/data/aws/test_GithubActionsOIDCTrustPolicy.py
Latest Contributors(2)
UserCommitDate
tsmithv11fix-terraform-OIDC-che...January 23, 2025
ahahami@paloaltonetwor...feat-terraform-Update-...January 22, 2025
This pull request is reviewed by Baz. Join @aviadhahami and the rest of your team on (Baz).

@aviadhahami aviadhahami requested a review from tsmithv11 February 4, 2025 13:10
@aviadhahami aviadhahami changed the title Fixes for CKV_AZURE_249 CKV_AWS_358: better support for OIDC 'repo' detection regex and conditions order fix | CKV_AZURE_249 CKV_AWS_358: better support for OIDC 'repo' detection regex and conditions order Feb 4, 2025
@aviadhahami aviadhahami changed the title fix | CKV_AZURE_249 CKV_AWS_358: better support for OIDC 'repo' detection regex and conditions order FIX(OIDC): CKV_AZURE_249 & CKV_AWS_358 -better support for OIDC 'repo' detection regex and conditions order Feb 4, 2025
@aviadhahami aviadhahami changed the title FIX(OIDC): CKV_AZURE_249 & CKV_AWS_358 -better support for OIDC 'repo' detection regex and conditions order FIX(OIDC): CKV_AZURE_249 & CKV_AWS_358 - better support for OIDC 'repo' detection regex and conditions order Feb 4, 2025
@aviadhahami aviadhahami changed the title FIX(OIDC): CKV_AZURE_249 & CKV_AWS_358 - better support for OIDC 'repo' detection regex and conditions order fix(OIDC): CKV_AZURE_249 & CKV_AWS_358 - better support for OIDC 'repo' detection regex and conditions order Feb 4, 2025
@aviadhahami aviadhahami changed the title fix(OIDC): CKV_AZURE_249 & CKV_AWS_358 - better support for OIDC 'repo' detection regex and conditions order fix(terraform): CKV_AZURE_249 & CKV_AWS_358 - better support for OIDC 'repo' detection regex and conditions order Feb 4, 2025
@aviadhahami aviadhahami marked this pull request as ready for review February 4, 2025 13:18
Improved the regex detecting the `repo` claim usage within OIDC configs so
it will match GitHub's namings allowance and restrictions.
This is a fix for bridgecrewio#6978
Fixed a bug where policies' `condition` blocks order would matter - it does not
Fixing bridgecrewio#6986.
@aviadhahami
Copy link
Contributor Author

rebased on main

@tsmithv11 tsmithv11 merged commit e871dab into bridgecrewio:main Feb 5, 2025
47 checks passed
Saarett pushed a commit that referenced this pull request Feb 5, 2025
… 'repo' detection regex and conditions order (#6994)

* FIX(CKV_AZURE_249): better support for OIDC 'repo' detection regex

Improved the regex detecting the `repo` claim usage within OIDC configs so
it will match GitHub's namings allowance and restrictions.
This is a fix for #6978

* FIX(CKV_AWS_358): condition order doesn't matter in OIDC check

Fixed a bug where policies' `condition` blocks order would matter - it does not
Fixing #6986.
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.

3 participants