Skip to content

Commit f4c5d73

Browse files
author
Taniya Mathur
committed
re-order and adding permission for validate template
1 parent e012bc1 commit f4c5d73

File tree

4 files changed

+130
-1
lines changed

4 files changed

+130
-1
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ image: public.ecr.aws/docker/library/python:3.13-bookworm
1616

1717
stages:
1818
- developer_tests
19-
- integration_tests
2019
- deployment_validation
20+
- integration_tests
2121

2222
developer_tests:
2323
stage: developer_tests
@@ -111,6 +111,8 @@ deployment_validation:
111111
- pip install PyYAML
112112

113113
script:
114+
# Validate CloudFormation service role template syntax
115+
- aws cloudformation validate-template --template-body file://iam-roles/cloudformation-management/IDP-Cloudformation-Service-Role.yaml --no-cli-pager
114116
# Check if service role has sufficient permissions for main stack deployment
115117
- |
116118
python3 -c "

analyze_high_priority_issues.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python3
2+
3+
import json
4+
from collections import defaultdict
5+
6+
def analyze_high_priority_issues():
7+
"""Analyze high priority security issues from DSR report"""
8+
9+
# Load the issues file
10+
with open('.dsr/issues.json', 'r') as f:
11+
issues = json.load(f)
12+
13+
# Filter high priority issues (case insensitive)
14+
high_priority_issues = [
15+
issue for issue in issues
16+
if issue.get('priority', '').lower() == 'high'
17+
]
18+
19+
# Categorize by check_id prefix
20+
categories = defaultdict(list)
21+
22+
for issue in high_priority_issues:
23+
check_id = issue.get('check_id', 'UNKNOWN')
24+
prefix = check_id.split('-')[0] if '-' in check_id else check_id.split('_')[0]
25+
categories[prefix].append(issue)
26+
27+
# Print summary
28+
print("HIGH PRIORITY SECURITY ISSUES ANALYSIS")
29+
print("=" * 50)
30+
print(f"Total High Priority Issues: {len(high_priority_issues)}")
31+
print()
32+
33+
# Sort categories by count (descending)
34+
sorted_categories = sorted(categories.items(), key=lambda x: len(x[1]), reverse=True)
35+
36+
for category, issues_list in sorted_categories:
37+
print(f"{category}: {len(issues_list)} issues")
38+
39+
# Group by specific check_id within category
40+
check_ids = defaultdict(int)
41+
for issue in issues_list:
42+
check_ids[issue.get('check_id', 'UNKNOWN')] += 1
43+
44+
for check_id, count in sorted(check_ids.items(), key=lambda x: x[1], reverse=True):
45+
print(f" - {check_id}: {count}")
46+
print()
47+
48+
# Detailed breakdown by issue type
49+
print("DETAILED ISSUE BREAKDOWN")
50+
print("=" * 30)
51+
52+
issue_types = defaultdict(int)
53+
for issue in high_priority_issues:
54+
issue_desc = issue.get('issue', 'Unknown issue')[:80] + "..." if len(issue.get('issue', '')) > 80 else issue.get('issue', 'Unknown issue')
55+
issue_types[issue_desc] += 1
56+
57+
for issue_type, count in sorted(issue_types.items(), key=lambda x: x[1], reverse=True):
58+
if count > 1:
59+
print(f"{count}x: {issue_type}")
60+
61+
if __name__ == "__main__":
62+
analyze_high_priority_issues()

high_periority_issues.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
HIGH PRIORITY SECURITY ISSUES ANALYSIS
2+
==================================================
3+
Total High Priority Issues: 140
4+
5+
S3: 83 issues
6+
- S3-005: 30
7+
- S3-008: 27
8+
- S3-001: 26
9+
10+
DDB: 17 issues
11+
- DDB-002: 17
12+
13+
IAM: 14 issues
14+
- IAM-004: 8
15+
- IAM-005: 6
16+
17+
LAMBDA: 9 issues
18+
- LAMBDA-004: 3
19+
- LAMBDA-011: 3
20+
- LAMBDA-012: 3
21+
22+
EKS: 5 issues
23+
- EKS-024: 5
24+
25+
ASC: 3 issues
26+
- ASC-002: 3
27+
28+
CFR: 3 issues
29+
- CFR-004: 3
30+
31+
EC2: 2 issues
32+
- EC2-002: 2
33+
34+
CKV: 2 issues
35+
- CKV_AWS_99: 2
36+
37+
KMS: 2 issues
38+
- KMS-002: 1
39+
- KMS-007: 1
40+
41+
DETAILED ISSUE BREAKDOWN
42+
==============================
43+
30x: S3 bucket used as CloudFront origin lacks OAC configuration (intrinsic function ...
44+
27x: S3 bucket lacks lifecycle policy
45+
26x: S3 bucket does not have proper access logging or violates least privilege princi...
46+
17x: DynamoDB data plane events are not captured by CloudTrail logging
47+
8x: Compute resource has IAM role without permissions boundary, allowing unrestricte...
48+
6x: Resource policy allows cross-account access without proper confused deputy preve...
49+
5x: Container images are not being scanned for vulnerabilities (no image scanning st...
50+
3x: No X-Ray tracing configured for Lambda function
51+
3x: Lambda function lacks CloudWatch alarms for monitoring
52+
3x: Lambda function shares an IAM execution role with another function
53+
3x: AppSync GraphQL API is missing appropriate authorization method (missing or inco...
54+
3x: CloudFront distribution allows insecure HTTP traffic (no minimum TLS version spe...
55+
2x: EC2 instance role violates principle of least privilege
56+
2x: Ensure Glue Security Configuration Encryption is enabled

scripts/sdlc/cfn/credential-vendor.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ Resources:
9191
Action:
9292
- codebuild:BatchGetBuilds
9393
Resource: !Sub "arn:aws:codebuild:*:${AWS::AccountId}:project/*"
94+
- PolicyName: CloudFormationValidatePolicy
95+
PolicyDocument:
96+
Version: '2012-10-17'
97+
Statement:
98+
- Sid: CloudFormationValidate
99+
Effect: Allow
100+
Action:
101+
- cloudformation:ValidateTemplate
102+
Resource: "*"
94103
- PolicyName: CloudWatchLogsAccessPolicy
95104
PolicyDocument:
96105
Version: '2012-10-17'

0 commit comments

Comments
 (0)