Skip to content

feat(CKV_AWS_341): ensure IAM role max session duration does not exceed 1 hour#7522

Open
Sage-Canty wants to merge 1 commit intobridgecrewio:mainfrom
Sage-Canty:feat/ckv-aws-iam-role-max-session-duration
Open

feat(CKV_AWS_341): ensure IAM role max session duration does not exceed 1 hour#7522
Sage-Canty wants to merge 1 commit intobridgecrewio:mainfrom
Sage-Canty:feat/ckv-aws-iam-role-max-session-duration

Conversation

@Sage-Canty
Copy link
Copy Markdown

@Sage-Canty Sage-Canty commented Apr 20, 2026

Closes #7521

What

Adds a new Terraform check CKV_AWS_341 for aws_iam_role resources.

Check: Ensure IAM role max session duration does not exceed 1 hour (3600 seconds)

AWS allows max_session_duration up to 43200 seconds (12 hours). Roles with elevated session durations extend the blast radius of a compromised credential. CIS AWS Foundations Benchmark recommends keeping this at or below 3600 seconds.

Logic

  • PASS: max_session_duration not set (defaults to 3600) or <= 3600
  • FAIL: max_session_duration > 3600
  • UNKNOWN: value is a variable reference, cannot evaluate at scan time

Files changed

  • checkov/terraform/checks/resource/aws/IAMRoleMaxSessionDuration.py — check implementation
  • tests/terraform/checks/resource/aws/test_IAMRoleMaxSessionDuration.py — 6 unit tests, all passing

Tests

6 passed, 1 warning in 3.62s

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.

Add check CKV_AWS_341: Ensure IAM role max session duration does not exceed 1 hour

1 participant