Repository navigation
fix: Check the length of a template Description that mentions a dynamic reference - #4765
Conversation
|
Hi maintainers, I'd appreciate a review of this edge case. I've reproduced a case where an over-length template-level I recognize that the original issue was retracted as unverified. Could a maintainer please confirm whether validating the Thanks! |
…ic reference
FunctionFilter treats any string containing {{resolve:...}} as a dynamic
reference and returns before the cfnLint keyword is added, so E1004 and
E1003 never ran on such a template Description. CloudFormation does not
resolve dynamic references there: ValidateTemplate rejects a Description
over 1024 characters whether or not it mentions one.
Fixes aws-cloudformation#4603
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4f4c870 to
a82e36f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4765 +/- ##
=======================================
Coverage 94.72% 94.72%
=======================================
Files 439 439
Lines 15908 15908
Branches 3079 3079
=======================================
Hits 15069 15069
Misses 458 458
Partials 381 381
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Confirmed — this is the intended behavior, and the fix is correct. CloudFormation does not resolve dynamic references in the template-level The scoping looks good too: the dynamic-reference short-circuit is skipped only for the exact The retraction of the original issue doesn't change this — the reported behavior reproduces on 1.57.2 and against the CloudFormation API. Thanks for the clear write-up and the test. |
Issue #, if available: Fixes #4603
Description of changes:
A template
Descriptionover 1024 characters is reported by E1003, except when its text contains something that looks like a dynamic reference ({{resolve:...}}). Then nothing is reported.FunctionFilter.filtertreats any string matchingREGEX_DYN_REFas a dynamic reference and returns before thecfnLintkeyword is added, so E1004/E1003 never run on it.CloudFormation doesn't resolve dynamic references in the template
Description. I checked withaws cloudformation validate-template, and both of these templates (1710 and 1753 characters) are rejected withTemplate format error: 'Description' length is greater than 1024.:On main, cfn-lint reports E1003 for the first and nothing for the second. With this change it reports E1003 for both. Strings with dynamic references elsewhere, such as resource properties, are handled as before.
(The issue was retracted by its author as unverified. The behavior above is reproducible on 1.57.2 and against the CloudFormation API.)
Tests:
test_filter.py: a dynamic-reference-shaped string at the templateDescriptionpath keeps its normal schema.test_api.py: linting a template whose 1000+ characterDescriptionmentions a dynamic reference reports E1003.pytest test/unit test/integrationpasses (2974), and ruff, isort and mypy are clean.I used Claude Code (AI) to help investigate and write this change, and reviewed and tested it before submitting.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code