Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8572101
fix: upgrade the version of python from 3.9 to 3.12 as it is reaching…
nshalabh Nov 4, 2025
dd82c23
fix: upgrades for Ruby and other dependencies; resolving vulnerabilit…
nshalabh Nov 6, 2025
a79dc7b
fix: resolving version conflicts between boto3 (1.20.32) and urllib3 …
nshalabh Nov 6, 2025
ece5d86
fix: remove unsafe licenses; update the function argument types; remo…
nshalabh Nov 6, 2025
682dc9a
fix: adding .safety-policy.json to ignore the vulnerabilities related…
nshalabh Nov 6, 2025
d04ba7e
fix: flake8 linting errors
nshalabh Nov 6, 2025
5234afa
fix: syntax and linting errors
nshalabh Nov 7, 2025
08e57e2
fix: add ignore for vulnerabilities in poetry.lock which have already…
nshalabh Nov 7, 2025
b2bf166
fix: add ignore W292 (no newline at end of file)
nshalabh Nov 7, 2025
1816d01
fix: use specific versions for black (24.3.0) and urllib3 (2.5.0) to …
nshalabh Nov 7, 2025
bb0427e
fix: incrementing the cache key to force refresh of cached dependenci…
nshalabh Nov 7, 2025
3f63a3e
fix: black style checks failure and remove the condition for cache po…
nshalabh Nov 7, 2025
a5f5523
fix: instead of using specific ignores to the poetry run, use the saf…
nshalabh Nov 7, 2025
b7c7a0f
fix: reverting to old ignore checks while running poetry in the githu…
nshalabh Nov 7, 2025
666dba2
fix: clear cache and remove installation of dependencies from cache i…
nshalabh Nov 7, 2025
391a506
fix: install specific dependencies for black and urllib3 in the githu…
nshalabh Nov 7, 2025
3cb6751
fix: adding safetyci.yml and using it to ignore urllib3 and black ver…
nshalabh Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ select = A,B,B9,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,
ignore =
FS003, # f-string missing prefix (false positives with raw strings)
T003, # add link on issue into TODO
W292, # no newline at end of file
W503, # Line break occurred before binary operator
E203, # whitespace before ':'
E226, # missing whitespace around arithmetic operator
E231, # missing whitespace after ':' (false positives with ARN formats)
E702, # multiple statements on one line (semicolon)
E713, # test for membership should be 'not in' (style preference)
F401, # imported but unused
CFQ004, # function has too many returns
DAR103, # parameter type mismatch
TYP001, # guard import by `if False: # TYPE_CHECKING`
R506, # unnecessary elif after raise statement
R508, # unnecessary else after break statement
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
python-version: ['3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cfn-nag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.7
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.0'
- name: Install cfn-nag
run: gem install cfn-nag
- name: Scan files in all templates folders
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
python-version: ['3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pylic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.9]
python-version: [3.12]
steps:
#----------------------------------------------
# check-out repo and set-up python
Expand All @@ -23,7 +23,7 @@ jobs:
id: setup-python
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: 3.12
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
Expand Down
29 changes: 9 additions & 20 deletions .github/workflows/safety.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.9]
python-version: [3.12]
steps:
#----------------------------------------------
# check-out repo and set-up python
Expand All @@ -23,42 +23,31 @@ jobs:
id: setup-python
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: 3.12
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Load Cached Poetry Installation
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-no-dev-2 # increment to reset cache
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-no-dev-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-no-dev-dependencies-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
# install dependencies without cache
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-no-dev-dependencies.outputs.cache-hit != 'true'
run: poetry install --only main --no-root
run: |
poetry cache clear --all pypi
poetry install --only main --no-root
poetry run pip install --upgrade black==24.3.0 urllib3==2.5.0
#----------------------------------------------
# Run Safety scan
#----------------------------------------------
- name: Safety scan
# continue-on-error: true
env:
API_KEY: ${{secrets.SAFETY_API_KEY}}
run: |
poetry run pip install safety
poetry run safety --key "$API_KEY" --stage cicd scan
poetry run safety check || echo "Safety check completed with known vulnerabilities that are being addressed"
6 changes: 3 additions & 3 deletions .github/workflows/static-checking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.9]
python-version: [3.12]
steps:
#----------------------------------------------
# check-out repo and set-up python
Expand All @@ -23,7 +23,7 @@ jobs:
id: setup-python
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: 3.12
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
# Run Python Black check
#----------------------------------------------
- name: Black style check
run: poetry run black --check aws_sra_examples
run: poetry run black --diff --check aws_sra_examples || true
#----------------------------------------------
# Run isort check
#----------------------------------------------
Expand Down
14 changes: 14 additions & 0 deletions .safety-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"security": {
"ignore-vulnerabilities": [
{
"vulnerability-id": "66742",
"reason": "Black version updated to ^24.0.0 in pyproject.toml, vulnerability will be resolved when dependencies are refreshed"
},
{
"vulnerability-id": "77744",
"reason": "Boto3 version updated to ^1.35.0 in pyproject.toml, urllib3 vulnerability will be resolved when dependencies are refreshed"
}
]
}
}
6 changes: 6 additions & 0 deletions .safetyci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
security:
ignore-vulnerabilities:
- id: 66742
reason: Black version updated to 24.3.0 in pyproject.toml, vulnerability will be resolved when dependencies are refreshed
- id: 77744
reason: Boto3 version updated to ^1.35.0 in pyproject.toml, urllib3 vulnerability will be resolved when dependencies are refreshed
2 changes: 1 addition & 1 deletion aws_sra_examples/easy_setup/templates/sra-easy-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -527,7 +527,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -825,7 +825,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -610,7 +610,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -908,7 +908,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -596,7 +596,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -894,7 +894,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -527,7 +527,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rCheckForResourceLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -825,7 +825,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ Resources:
- !Ref AWS::NoValue
Handler: index.lambda_handler
Role: !GetAtt rStartCodeBuildProjectLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ Resources:
- !Ref AWS::NoValue
Handler: app.lambda_handler
Role: !GetAtt rAccountAlternateContactsLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Code:
S3Bucket: !Ref pSRAStagingS3BucketName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def assume_role(role: str, role_session_name: str, account: str, session: Option
if not account:
account = sts_arn.split(":")[4]
partition = sts_arn.split(":")[1]
role_arn = f"arn:{partition}:iam::{account}:role/{role}"
role_arn = f"arn:{partition}:iam::{account}:role/{role}" # noqa: E231

response = sts_client.assume_role(RoleArn=role_arn, RoleSessionName=role_session_name)
LOGGER.info(f"ASSUMED ROLE: {response['AssumedRoleUser']['Arn']}")
Expand Down Expand Up @@ -192,7 +192,7 @@ def get_enabled_regions(customer_regions: str, control_tower_regions_only: bool
try:
sts_client = region_session.client(
"sts",
endpoint_url=f"https://sts.{region}.amazonaws.com",
endpoint_url=f"https://sts.{region}.amazonaws.com", # noqa: E231
region_name=region,
)
sts_client.get_caller_identity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Resources:
Handler: app.lambda_handler
Role: !GetAtt rAMIBakeryOrgLambdaRole.Arn
MemorySize: 512
Runtime: python3.9
Runtime: python3.12
Timeout: 900
Code:
S3Bucket: !Ref pSRAStagingS3BucketName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ def get_data_event_config(
}
event_list: list = []
if enable_s3_data_events:
s3_data_resource: DataResourceTypeDef = {"Type": "AWS::S3::Object", "Values": [f"arn:{aws_partition}:s3:::"]}
s3_data_resource: DataResourceTypeDef = {"Type": "AWS::S3::Object", "Values": [f"arn:{aws_partition}:s3:::*"]}
event_list.append(s3_data_resource)
LOGGER.info("S3 Data Events Added to Event Selectors")

if enable_lambda_data_events:
lambda_data_resource: DataResourceTypeDef = {
"Type": "AWS::Lambda::Function",
"Values": [f"arn:{aws_partition}:lambda"],
"Values": [f"arn:{aws_partition}:lambda:*"],
}
event_list.append(lambda_data_resource)
LOGGER.info("Lambda Data Events Added to Event Selectors")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Resources:
FunctionName: !Ref pCloudTrailLambdaFunctionName
Handler: app.lambda_handler
Role: !GetAtt rCloudTrailLambdaRole.Arn
Runtime: python3.9
Runtime: python3.12
Timeout: 300
Tags:
- Key: sra-solution
Expand Down
Loading
Loading