feat: add rule E3697 to validate Lambda env var 4KB size limit#4405
Merged
kddejong merged 2 commits intoMar 24, 2026
Merged
Conversation
AWS Lambda enforces a hard 4 KB limit on the total size of all environment variable keys and values. If exceeded, CloudFormation deployment fails. This rule catches that at lint time. Fixes #1945
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4405 +/- ##
==========================================
- Coverage 93.54% 93.44% -0.10%
==========================================
Files 418 423 +5
Lines 14145 14350 +205
Branches 2817 2865 +48
==========================================
+ Hits 13232 13410 +178
- Misses 567 582 +15
- Partials 346 358 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kddejong
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1945
Summary
AWS::Lambda::Functionenvironment variables do not exceed the 4KB (4096 bytes) limitEnvironment.VariablesCfnLintKeywordpattern used by other Lambda rulesChanges
src/cfnlint/rules/resources/lmbd/FunctionEnvironmentSize.py: New ruletest/unit/rules/resources/lmbd/test_function_environment_size.py: 5 parametrized testsTest plan